Skip to content

Commit 4d05eb4

Browse files
committed
IHF: More Artisan\Command tests added.
1 parent f442114 commit 4d05eb4

File tree

1 file changed

+33
-1
lines changed

1 file changed

+33
-1
lines changed

tests/classes/Artisan/CommandTest.php

Lines changed: 33 additions & 1 deletion
Original file line numberDiff line numberDiff 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

5789
function exec($command)

0 commit comments

Comments
 (0)