Skip to content

Commit

Permalink
change by comment
Browse files Browse the repository at this point in the history
  • Loading branch information
Erik Bohony committed Feb 2, 2024
1 parent d16e160 commit 6f2a0e7
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 6 deletions.
6 changes: 3 additions & 3 deletions src/RedisProxy.php
Original file line number Diff line number Diff line change
Expand Up @@ -807,14 +807,14 @@ public function rename(string $key, string $newKey): bool

/**
* Subscribes the client to the specified channels
* @param string|array ...$channels
* @throws RedisProxyException
*/
public function subscribe(...$channels): array
public function subscribe(callable $callback, ...$channels): array
{
$channels = $this->prepareArguments('subscribe', $channels);
$this->init();
return $this->driver->call('subscribe', [...$channels, function () {
}]);
return $this->driver->call('subscribe', [...$channels, $callback]);
}

/**
Expand Down
9 changes: 6 additions & 3 deletions tests/BaseDriverTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -1352,17 +1352,20 @@ public function testRename():void
self::assertTrue($this->redisProxy->rename('new_key', 'new_new_key'));
}

public function testWrongRename(){
public function testWrongRename()
{
self::assertFalse($this->redisProxy->rename('my_keyaaa', 'new_key'));
}

public function testEmptySubscribe(){
public function testEmptySubscribe()
{
$this->expectExceptionMessage("Error for command 'subscribe', use getPrevious() for more info");
$this->expectException(RedisProxyException::class);
$this->redisProxy->subscribe();
}

public function testPublish(){
public function testPublish()
{
self::assertEquals(0, $this->redisProxy->publish('test', 'aaaa'));
}

Expand Down

0 comments on commit 6f2a0e7

Please sign in to comment.