Skip to content

Commit 38f8d95

Browse files
committed
ICM: Tests added.
1 parent c38172b commit 38f8d95

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

tests/MutexTest.php

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
use Illuminated\Console\Mutex;
44
use NinjaMutex\Lock\FlockLock;
5+
use NinjaMutex\Lock\MemcachedLock;
56
use NinjaMutex\Lock\MySqlLock;
67
use NinjaMutex\Lock\PredisRedisLock;
78

@@ -60,4 +61,16 @@ public function it_supports_redis_strategy()
6061
$expectedStrategy = new PredisRedisLock(Redis::connection());
6162
$this->assertEquals($expectedStrategy, $mutex->getStrategy());
6263
}
64+
65+
/** @test */
66+
public function it_supports_memcached_strategy()
67+
{
68+
Cache::shouldReceive('getStore')->withNoArgs()->twice()->andReturnSelf();
69+
Cache::shouldReceive('getMemcached')->withNoArgs()->twice()->andReturnSelf();
70+
$this->command->shouldReceive('getMutexStrategy')->withNoArgs()->once()->andReturn('memcached');
71+
72+
$mutex = new Mutex($this->command);
73+
$expectedStrategy = new MemcachedLock(Cache::getStore()->getMemcached());
74+
$this->assertEquals($expectedStrategy, $mutex->getStrategy());
75+
}
6376
}

0 commit comments

Comments
 (0)