Skip to content

Commit 075207c

Browse files
committed
ICM: Laravel 5.1 support.
1 parent 5eb5b49 commit 075207c

File tree

2 files changed

+1
-41
lines changed

2 files changed

+1
-41
lines changed

src/Mutex.php

+1-7
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@
1111
use NinjaMutex\Lock\PhpRedisLock;
1212
use NinjaMutex\Lock\PredisRedisLock;
1313
use NinjaMutex\Mutex as Ninja;
14-
use Predis\Client as PredisClient;
1514

1615
class Mutex
1716
{
@@ -69,12 +68,7 @@ public function getPhpRedisClient()
6968

7069
public function getPredisClient()
7170
{
72-
$connection = RedisFacade::connection();
73-
74-
/* @laravel-versions */
75-
$predisClient = ($connection instanceof PredisClient) ? $connection : $connection->client();
76-
77-
return $predisClient;
71+
return RedisFacade::connection();
7872
}
7973

8074
public function __call($method, $parameters)

tests/ConsoleMutex/MutexTest.php

-34
Original file line numberDiff line numberDiff line change
@@ -3,17 +3,14 @@
33
namespace Illuminated\Console\ConsoleMutex\Tests;
44

55
use GenericCommand;
6-
use Illuminate\Redis\Connectors\PhpRedisConnector;
76
use Illuminate\Support\Facades\Cache;
87
use Illuminated\Console\Mutex;
98
use Mockery;
109
use NinjaMutex\Lock\FlockLock;
1110
use NinjaMutex\Lock\MemcachedLock;
1211
use NinjaMutex\Lock\MySqlLock;
13-
use NinjaMutex\Lock\PhpRedisLock;
1412
use NinjaMutex\Lock\PredisRedisLock;
1513
use Predis\Client as PredisClient;
16-
use Redis;
1714

1815
class MutexTest extends TestCase
1916
{
@@ -76,44 +73,13 @@ public function it_supports_redis_strategy_with_predis_client_which_is_default()
7673
$this->assertEquals($expectedStrategy, $mutex->getStrategy());
7774
}
7875

79-
/** @test */
80-
public function it_supports_redis_strategy_with_phpredis_client()
81-
{
82-
/* @laravel-versions */
83-
if (!class_exists(PhpRedisConnector::class)) {
84-
return;
85-
}
86-
87-
config(['database.redis.client' => 'phpredis']);
88-
89-
$this->command->shouldReceive('getMutexStrategy')->withNoArgs()->once()->andReturn('redis');
90-
91-
$mutex = new Mutex($this->command);
92-
$expectedStrategy = new PhpRedisLock($mutex->getPhpRedisClient());
93-
$this->assertEquals($expectedStrategy, $mutex->getStrategy());
94-
}
95-
9676
/** @test */
9777
public function it_has_get_predis_client_method_which_always_returns_an_instance_of_predis_client_class()
9878
{
9979
$mutex = new Mutex($this->command);
10080
$this->assertInstanceOf(PredisClient::class, $mutex->getPredisClient());
10181
}
10282

103-
/** @test */
104-
public function it_has_get_phpredis_client_method_which_always_returns_an_instance_of_redis_class()
105-
{
106-
/* @laravel-versions */
107-
if (!class_exists(PhpRedisConnector::class)) {
108-
return;
109-
}
110-
111-
config(['database.redis.client' => 'phpredis']);
112-
113-
$mutex = new Mutex($this->command);
114-
$this->assertInstanceOf(Redis::class, $mutex->getPhpRedisClient());
115-
}
116-
11783
/** @test */
11884
public function it_supports_memcached_strategy()
11985
{

0 commit comments

Comments
 (0)