File tree Expand file tree Collapse file tree 1 file changed +13
-1
lines changed
Expand file tree Collapse file tree 1 file changed +13
-1
lines changed Original file line number Diff line number Diff line change 22
33use Illuminated \Console \Mutex ;
44use NinjaMutex \Lock \FlockLock ;
5+ use NinjaMutex \Lock \MySqlLock ;
56
67class 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}
You can’t perform that action at this time.
0 commit comments