File tree Expand file tree Collapse file tree 1 file changed +14
-1
lines changed
Expand file tree Collapse file tree 1 file changed +14
-1
lines changed Original file line number Diff line number Diff line change 99use NinjaMutex \Lock \FlockLock ;
1010use NinjaMutex \Lock \MemcachedLock ;
1111use NinjaMutex \Lock \MySqlLock ;
12+ use NinjaMutex \Lock \PhpRedisLock ;
1213use NinjaMutex \Lock \PredisRedisLock ;
1314use 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 {
You can’t perform that action at this time.
0 commit comments