File tree Expand file tree Collapse file tree 1 file changed +30
-0
lines changed
Expand file tree Collapse file tree 1 file changed +30
-0
lines changed Original file line number Diff line number Diff line change 22
33namespace Illuminated \Helpers \Artisan ;
44
5+ use Mockery as m ;
56use PHPUnit_Framework_Error ;
67use TestCase ;
78
89class CommandTest extends TestCase
910{
11+ public static $ functions ;
12+
13+ protected function setUp ()
14+ {
15+ self ::$ functions = m::mock ();
16+
17+ $ phpBinaryMock = m::mock ('overload:Symfony\Component\Process\PhpExecutableFinder ' );
18+ $ phpBinaryMock ->shouldReceive ('find ' )->with (false )->zeroOrMoreTimes ()->andReturn ('php ' );
19+
20+ $ utilsMock = m::mock ('alias:Symfony\Component\Process\ProcessUtils ' );
21+ $ utilsMock ->shouldReceive ('escapeArgument ' )->withAnyArgs ()->zeroOrMoreTimes ()->andReturnUsing (function ($ value ) {
22+ return $ value ;
23+ });
24+ }
25+
1026 /** @test */
1127 public function it_has_required_arguments ()
1228 {
@@ -27,4 +43,18 @@ public function it_has_static_constructor_named_factory()
2743 $ command = Command::factory ('test ' );
2844 $ this ->assertInstanceOf (Command::class, $ command );
2945 }
46+
47+ /** @test */
48+ public function it_can_run_command_in_background ()
49+ {
50+ self ::$ functions ->shouldReceive ('exec ' )->with ("(php artisan test command) > /dev/null 2>&1 & " )->once ();
51+
52+ $ command = Command::factory ('test command ' );
53+ $ command ->runInBackground ();
54+ }
55+ }
56+
57+ function exec ($ command )
58+ {
59+ return CommandTest::$ functions ->exec ($ command );
3060}
You can’t perform that action at this time.
0 commit comments