File tree Expand file tree Collapse file tree 1 file changed +33
-1
lines changed
Expand file tree Collapse file tree 1 file changed +33
-1
lines changed Original file line number Diff line number Diff line change @@ -47,11 +47,43 @@ public function it_has_static_constructor_named_factory()
4747 /** @test */
4848 public function it_can_run_command_in_background ()
4949 {
50- self :: $ functions -> shouldReceive ( ' exec ' )-> with ( ' ( php artisan test:command) > /dev/null 2>&1 & ')-> once ( );
50+ $ this -> shouldRecieveExecCallOnceWith ( ' ( php artisan test:command) > /dev/null 2>&1 & ' );
5151
5252 $ command = Command::factory ('test:command ' );
5353 $ command ->runInBackground ();
5454 }
55+
56+ /** @test */
57+ public function run_in_background_supports_before_command ()
58+ {
59+ $ this ->shouldRecieveExecCallOnceWith ('(before command && php artisan test:command) > /dev/null 2>&1 & ' );
60+
61+ $ command = Command::factory ('test:command ' , 'before command ' );
62+ $ command ->runInBackground ();
63+ }
64+
65+ /** @test */
66+ public function run_in_background_supports_after_command ()
67+ {
68+ $ this ->shouldRecieveExecCallOnceWith ('(php artisan test:command && after command) > /dev/null 2>&1 & ' );
69+
70+ $ command = Command::factory ('test:command ' , null , 'after command ' );
71+ $ command ->runInBackground ();
72+ }
73+
74+ /** @test */
75+ public function run_in_background_supports_before_and_after_commands_both ()
76+ {
77+ $ this ->shouldRecieveExecCallOnceWith ('(before && php artisan test:command && after) > /dev/null 2>&1 & ' );
78+
79+ $ command = Command::factory ('test:command ' , 'before ' , 'after ' );
80+ $ command ->runInBackground ();
81+ }
82+
83+ private function shouldRecieveExecCallOnceWith ($ with )
84+ {
85+ self ::$ functions ->shouldReceive ('exec ' )->with ($ with )->once ();
86+ }
5587}
5688
5789function exec ($ command )
You can’t perform that action at this time.
0 commit comments