Skip to content

Commit acf0023

Browse files
committed
adding unwatch() method
1 parent 1e823fa commit acf0023

File tree

3 files changed

+16
-1
lines changed

3 files changed

+16
-1
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ Redis command | Description
8282

8383
It mocks **MULTI**, **DISCARD** and **EXEC** commands but without any transaction behaviors, they just make the interface fluent and return each command results.
8484
**PIPELINE** and **EXECUTE** pseudo commands (client pipelining) are also mocked.
85-
**EVAL**, **EVALSHA** and **WATCH** are just stubs—they won't execute anything
85+
**EVAL**, **EVALSHA**, **WATCH** and **UNWATCH** are just stubs—they won't execute anything
8686

8787
## Usage
8888

src/M6Web/Component/RedisMock/RedisMock.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1161,6 +1161,11 @@ public function watch($key)
11611161
return new Status('OK');
11621162
}
11631163

1164+
public function unwatch()
1165+
{
1166+
return new Status('OK');
1167+
}
1168+
11641169
// Client pipeline
11651170

11661171
public function pipeline()

tests/units/RedisMock.php

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1758,6 +1758,16 @@ public function testWatch()
17581758
->isInstanceOf(Status::class);
17591759
}
17601760

1761+
public function testUnwatch()
1762+
{
1763+
$redisMock = new Redis();
1764+
$redisMock->set('test', 'something');
1765+
1766+
$this->assert
1767+
->object($redisMock->unwatch())
1768+
->isInstanceOf(Status::class);
1769+
}
1770+
17611771
public function testDbsize()
17621772
{
17631773
$redisMock = new Redis();

0 commit comments

Comments
 (0)