File tree Expand file tree Collapse file tree 1 file changed +22
-8
lines changed
Expand file tree Collapse file tree 1 file changed +22
-8
lines changed Original file line number Diff line number Diff line change 11<?php
22
33use Illuminated \Console \Mutex ;
4+ use NinjaMutex \Lock \FlockLock ;
45
56class MutexTest extends TestCase
67{
8+ private $ command ;
9+
10+ protected function setUp ()
11+ {
12+ parent ::setUp ();
13+
14+ $ this ->command = Mockery::mock (GenericCommand::class)->makePartial ();
15+ $ this ->command ->shouldReceive ('argument ' )->withNoArgs ()->once ()->andReturn (['foo ' => 'bar ' ]);
16+ }
17+
718 /** @test */
819 public function it_has_one_required_constructor_argument_which_is_command ()
920 {
10- $ command = Mockery::mock (GenericCommand::class)->makePartial ();
11- $ command ->shouldReceive ('argument ' )->withNoArgs ()->once ()->andReturn (['foo ' => 'bar ' ]);
12-
13- $ mutex = new Mutex ($ command );
21+ $ mutex = new Mutex ($ this ->command );
1422 $ this ->assertInstanceOf (Mutex::class, $ mutex );
1523 }
1624
1725 /** @test */
1826 public function it_determines_mutex_strategy_once_while_creation ()
1927 {
20- $ command = Mockery::mock (GenericCommand::class)->makePartial ();
21- $ command ->shouldReceive ('argument ' )->withNoArgs ()->once ()->andReturn (['foo ' => 'bar ' ]);
22-
23- $ mutex = new Mutex ($ command );
28+ $ mutex = new Mutex ($ this ->command );
2429 $ this ->assertSame ($ mutex ->getStrategy (), $ mutex ->getStrategy ());
2530 }
31+
32+ /** @test */
33+ public function it_has_default_strategy_which_is_file ()
34+ {
35+ $ this ->command ->shouldReceive ('getMutexStrategy ' )->withNoArgs ()->once ()->andReturn ('foobar ' );
36+
37+ $ mutex = new Mutex ($ this ->command );
38+ $ this ->assertEquals (new FlockLock (storage_path ('app ' )), $ mutex ->getStrategy ());
39+ }
2640}
You can’t perform that action at this time.
0 commit comments