File tree Expand file tree Collapse file tree 1 file changed +10
-2
lines changed
Expand file tree Collapse file tree 1 file changed +10
-2
lines changed Original file line number Diff line number Diff line change 55use NinjaMutex \Lock \MemcachedLock ;
66use NinjaMutex \Lock \MySqlLock ;
77use NinjaMutex \Lock \PredisRedisLock ;
8+ use Predis \Client ;
89
910class MutexTest extends TestCase
1011{
1112 private $ command ;
1213
13- protected function setUp ()
14+ public function setUp ()
1415 {
1516 parent ::setUp ();
1617
@@ -52,13 +53,20 @@ public function it_supports_mysql_strategy()
5253 $ this ->assertEquals ($ expectedStrategy , $ mutex ->getStrategy ());
5354 }
5455
56+ /** @test */
57+ public function it_has_get_redis_client_method ()
58+ {
59+ $ mutex = new Mutex ($ this ->command );
60+ $ this ->assertInstanceOf (Client::class, $ mutex ->getRedisClient ());
61+ }
62+
5563 /** @test */
5664 public function it_supports_redis_strategy ()
5765 {
5866 $ this ->command ->shouldReceive ('getMutexStrategy ' )->withNoArgs ()->once ()->andReturn ('redis ' );
5967
6068 $ mutex = new Mutex ($ this ->command );
61- $ expectedStrategy = new PredisRedisLock (Redis:: connection ()-> client ());
69+ $ expectedStrategy = new PredisRedisLock ($ mutex -> getRedisClient ());
6270 $ this ->assertEquals ($ expectedStrategy , $ mutex ->getStrategy ());
6371 }
6472
You can’t perform that action at this time.
0 commit comments