Skip to content

Commit c38172b

Browse files
committed
ICM: Tests added.
1 parent 5737e01 commit c38172b

File tree

3 files changed

+65
-3
lines changed

3 files changed

+65
-3
lines changed

composer.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,8 @@
1717
"require-dev": {
1818
"phpunit/phpunit": "^5.6",
1919
"orchestra/testbench": "^3.3",
20-
"mockery/mockery": "^0.9.5"
20+
"mockery/mockery": "^0.9.5",
21+
"predis/predis": "^1.1"
2122
},
2223
"suggest" : {
2324
"predis/predis": "If you want to use `redis` strategy."

composer.lock

Lines changed: 52 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

tests/MutexTest.php

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
use Illuminated\Console\Mutex;
44
use NinjaMutex\Lock\FlockLock;
55
use NinjaMutex\Lock\MySqlLock;
6+
use NinjaMutex\Lock\PredisRedisLock;
67

78
class MutexTest extends TestCase
89
{
@@ -49,4 +50,14 @@ public function it_supports_mysql_strategy()
4950
$expectedStrategy = new MySqlLock(env('DB_USERNAME'), env('DB_PASSWORD'), env('DB_HOST'));
5051
$this->assertEquals($expectedStrategy, $mutex->getStrategy());
5152
}
53+
54+
/** @test */
55+
public function it_supports_redis_strategy()
56+
{
57+
$this->command->shouldReceive('getMutexStrategy')->withNoArgs()->once()->andReturn('redis');
58+
59+
$mutex = new Mutex($this->command);
60+
$expectedStrategy = new PredisRedisLock(Redis::connection());
61+
$this->assertEquals($expectedStrategy, $mutex->getStrategy());
62+
}
5263
}

0 commit comments

Comments
 (0)