From d263838b3ece7cf5150cb5d436d6476a3bab7bbb Mon Sep 17 00:00:00 2001 From: Sergey Sevrugin Date: Wed, 3 Apr 2019 12:32:40 +0300 Subject: [PATCH] =?UTF-8?q?Added=20scripting=20commands=20(#eval,=20#evals?= =?UTF-8?q?ha)=20which=20are=20just=20stubs=E2=80=94they=20won't=20execute?= =?UTF-8?q?=20anything?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 3 ++- src/M6Web/Component/RedisMock/RedisMock.php | 26 +++++++++++++++++++++ 2 files changed, 28 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 5a6705a..6cd0a48 100644 --- a/README.md +++ b/README.md @@ -89,7 +89,8 @@ Redis command | Description It mocks **MULTI**, **DISCARD** and **EXEC** commands but without any transaction behaviors, they just make the interface fluent and return each command results. -**PIPELINE** and **EXECUTE** pseudo commands (client pipelining) are also mocked. +**PIPELINE** and **EXECUTE** pseudo commands (client pipelining) are also mocked. +**EVAL** and **EVALSHA** are just stubs—they won't execute anything ## Usage diff --git a/src/M6Web/Component/RedisMock/RedisMock.php b/src/M6Web/Component/RedisMock/RedisMock.php index 841f383..ceb7cb8 100644 --- a/src/M6Web/Component/RedisMock/RedisMock.php +++ b/src/M6Web/Component/RedisMock/RedisMock.php @@ -1196,4 +1196,30 @@ public function rpoplpush(string $sourceList, string $destinationList) // return the rpop value; return $rpopValue; } + + /** + * Evaluate a LUA script serverside, from the SHA1 hash of the script instead of the script itself. + * + * @param string $script + * @param int $numkeys + * @param mixed $arguments + * @return mixed + */ + public function evalsha($script, $numkeys, ...$arguments) + { + return; + } + + /** + * Evaluate a script and return its result. + * + * @param string $script + * @param int $numberOfKeys + * @param dynamic $arguments + * @return mixed + */ + public function eval($script, $numberOfKeys, ...$arguments) + { + return; + } }