Skip to content

Commit 5b6e816

Browse files
committed
ICM: Tests added.
1 parent 0b9ebd0 commit 5b6e816

File tree

1 file changed

+14
-1
lines changed

1 file changed

+14
-1
lines changed

tests/ConsoleMutex/MutexTest.php

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
use NinjaMutex\Lock\FlockLock;
1010
use NinjaMutex\Lock\MemcachedLock;
1111
use NinjaMutex\Lock\MySqlLock;
12+
use NinjaMutex\Lock\PhpRedisLock;
1213
use NinjaMutex\Lock\PredisRedisLock;
1314
use Predis\Client as PredisClient;
1415

@@ -64,7 +65,7 @@ public function it_supports_mysql_strategy()
6465
}
6566

6667
/** @test */
67-
public function it_supports_redis_strategy()
68+
public function it_supports_redis_strategy_with_predis_client_by_default()
6869
{
6970
$this->command->shouldReceive('getMutexStrategy')->withNoArgs()->once()->andReturn('redis');
7071

@@ -73,6 +74,18 @@ public function it_supports_redis_strategy()
7374
$this->assertEquals($expectedStrategy, $mutex->getStrategy());
7475
}
7576

77+
/** @test */
78+
public function it_supports_redis_strategy_with_phpredis_client()
79+
{
80+
config(['database.redis.client' => 'phpredis']);
81+
82+
$this->command->shouldReceive('getMutexStrategy')->withNoArgs()->once()->andReturn('redis');
83+
84+
$mutex = new Mutex($this->command);
85+
$expectedStrategy = new PhpRedisLock($mutex->getPhpRedisClient());
86+
$this->assertEquals($expectedStrategy, $mutex->getStrategy());
87+
}
88+
7689
/** @test */
7790
public function it_has_get_predis_client_method_which_always_returns_an_instance_of_predis_client_class()
7891
{

0 commit comments

Comments
 (0)