Skip to content

Commit 5737e01

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

File tree

1 file changed

+13
-1
lines changed

1 file changed

+13
-1
lines changed

tests/MutexTest.php

Lines changed: 13 additions & 1 deletion
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\MySqlLock;
56

67
class MutexTest extends TestCase
78
{
@@ -35,6 +36,17 @@ public function it_has_default_strategy_which_is_file()
3536
$this->command->shouldReceive('getMutexStrategy')->withNoArgs()->once()->andReturn('foobar');
3637

3738
$mutex = new Mutex($this->command);
38-
$this->assertEquals(new FlockLock(storage_path('app')), $mutex->getStrategy());
39+
$expectedStrategy = new FlockLock(storage_path('app'));
40+
$this->assertEquals($expectedStrategy, $mutex->getStrategy());
41+
}
42+
43+
/** @test */
44+
public function it_supports_mysql_strategy()
45+
{
46+
$this->command->shouldReceive('getMutexStrategy')->withNoArgs()->once()->andReturn('mysql');
47+
48+
$mutex = new Mutex($this->command);
49+
$expectedStrategy = new MySqlLock(env('DB_USERNAME'), env('DB_PASSWORD'), env('DB_HOST'));
50+
$this->assertEquals($expectedStrategy, $mutex->getStrategy());
3951
}
4052
}

0 commit comments

Comments
 (0)