-
Notifications
You must be signed in to change notification settings - Fork 17
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
IHF: New tests for
call_in_background
helper.
- Loading branch information
1 parent
b776772
commit 943d153
Showing
2 changed files
with
44 additions
and
90 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,57 +1,50 @@ | ||
<?php | ||
|
||
// use Mockery as m; | ||
// | ||
use Mockery as m; | ||
|
||
// /** | ||
// * @runTestsInSeparateProcesses | ||
// * @preserveGlobalState disabled | ||
// */ | ||
// class CallInBackgroundTest extends TestCase | ||
// { | ||
// protected function setUp() | ||
// { | ||
// $phpMock = m::mock('overload:Symfony\Component\Process\PhpExecutableFinder'); | ||
// $phpMock->shouldReceive('find')->with(false)->once()->andReturn('php'); | ||
// | ||
// $utilsMock = m::mock('alias:Symfony\Component\Process\ProcessUtils'); | ||
// $utilsMock->shouldReceive('escapeArgument')->withAnyArgs()->atLeast()->once()->andReturnUsing(function ($v) { | ||
// return $v; | ||
// }); | ||
// } | ||
// | ||
// /** @test */ | ||
// public function it_works_without_before_and_after_parameters() | ||
// { | ||
// $mock = m::mock('alias:Illuminated\Helpers\System\Command'); | ||
// $mock->shouldReceive('exec')->with('(php artisan test command) > /dev/null 2>&1 &')->once(); | ||
// | ||
// call_in_background('test command'); | ||
// } | ||
// | ||
// /** @test */ | ||
// public function it_works_with_only_before_parameter() | ||
// { | ||
// $mock = m::mock('alias:Illuminated\Helpers\System\Command'); | ||
// $mock->shouldReceive('exec')->with('(before command && php artisan test command) > /dev/null 2>&1 &')->once(); | ||
// | ||
// call_in_background('test command', 'before command'); | ||
// } | ||
// | ||
// /** @test */ | ||
// public function it_works_with_only_after_parameter() | ||
// { | ||
// $mock = m::mock('alias:Illuminated\Helpers\System\Command'); | ||
// $mock->shouldReceive('exec')->with('(php artisan test command && after command) > /dev/null 2>&1 &')->once(); | ||
// | ||
// call_in_background('test command', null, 'after command'); | ||
// } | ||
// | ||
// /** @test */ | ||
// public function it_works_with_before_and_after_parameters() | ||
// { | ||
// $mock = m::mock('alias:Illuminated\Helpers\System\Command'); | ||
// $mock->shouldReceive('exec')->with('(before && php artisan test command && after) > /dev/null 2>&1 &')->once(); | ||
// | ||
// call_in_background('test command', 'before', 'after'); | ||
// } | ||
// } | ||
class CallInBackgroundTest extends TestCase | ||
{ | ||
/** @test */ | ||
public function it_works_without_before_and_after_parameters() | ||
{ | ||
$mock = m::mock('alias:Illuminated\Helpers\Artisan\Command'); | ||
$mock->shouldReceive('factory')->withArgs(['test command', null, null])->once()->andReturnSelf(); | ||
$mock->shouldReceive('runInBackground')->withNoArgs()->once(); | ||
|
||
call_in_background('test command'); | ||
} | ||
|
||
/** @test */ | ||
public function it_works_with_only_before_parameter() | ||
{ | ||
$mock = m::mock('alias:Illuminated\Helpers\Artisan\Command'); | ||
$mock->shouldReceive('factory')->withArgs(['test command', 'before command', null])->once()->andReturnSelf(); | ||
$mock->shouldReceive('runInBackground')->withNoArgs()->once(); | ||
|
||
call_in_background('test command', 'before command'); | ||
} | ||
|
||
/** @test */ | ||
public function it_works_with_only_after_parameter() | ||
{ | ||
$mock = m::mock('alias:Illuminated\Helpers\Artisan\Command'); | ||
$mock->shouldReceive('factory')->withArgs(['test command', null, 'after command'])->once()->andReturnSelf(); | ||
$mock->shouldReceive('runInBackground')->withNoArgs()->once(); | ||
|
||
call_in_background('test command', null, 'after command'); | ||
} | ||
|
||
/** @test */ | ||
public function it_works_with_before_and_after_parameters() | ||
{ | ||
$mock = m::mock('alias:Illuminated\Helpers\Artisan\Command'); | ||
$mock->shouldReceive('factory')->withArgs(['test command', 'before', 'after'])->once()->andReturnSelf(); | ||
$mock->shouldReceive('runInBackground')->withNoArgs()->once(); | ||
|
||
call_in_background('test command', 'before', 'after'); | ||
} | ||
} |
This file was deleted.
Oops, something went wrong.