Skip to content

Commit 261b372

Browse files
committed
Mockery 1.0 features used.
1 parent 6dab25f commit 261b372

File tree

2 files changed

+10
-8
lines changed

2 files changed

+10
-8
lines changed

tests/HelperFunctions/TestCase.php

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@
66
use Mockery;
77
use Mockery\Adapter\Phpunit\MockeryPHPUnitIntegration;
88

9+
Mockery::globalHelpers();
10+
911
abstract class TestCase extends \PHPUnit\Framework\TestCase
1012
{
1113
use TestingTools;
@@ -15,11 +17,11 @@ abstract class TestCase extends \PHPUnit\Framework\TestCase
1517

1618
protected function setUp()
1719
{
18-
self::$functions = Mockery::mock();
20+
self::$functions = mock();
1921
}
2022

21-
protected function shouldReceiveExecCallOnceWith($with)
23+
protected function expectsExecWith($command)
2224
{
23-
self::$functions->shouldReceive('exec')->with($with)->once();
25+
self::$functions->expects()->exec($command);
2426
}
2527
}

tests/HelperFunctions/classes/Artisan/CommandTest.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ public function it_has_static_constructor_named_factory()
3232
/** @test */
3333
public function it_can_run_command_in_background()
3434
{
35-
$this->shouldReceiveExecCallOnceWith('(php artisan test:command) > /dev/null 2>&1 &');
35+
$this->expectsExecWith('(php artisan test:command) > /dev/null 2>&1 &');
3636

3737
$command = Command::factory('test:command');
3838
$command->runInBackground();
@@ -41,7 +41,7 @@ public function it_can_run_command_in_background()
4141
/** @test */
4242
public function run_in_background_supports_before_subcommand()
4343
{
44-
$this->shouldReceiveExecCallOnceWith('(before command && php artisan test:command) > /dev/null 2>&1 &');
44+
$this->expectsExecWith('(before command && php artisan test:command) > /dev/null 2>&1 &');
4545

4646
$command = Command::factory('test:command', 'before command');
4747
$command->runInBackground();
@@ -50,7 +50,7 @@ public function run_in_background_supports_before_subcommand()
5050
/** @test */
5151
public function run_in_background_supports_after_subcommand()
5252
{
53-
$this->shouldReceiveExecCallOnceWith('(php artisan test:command && after command) > /dev/null 2>&1 &');
53+
$this->expectsExecWith('(php artisan test:command && after command) > /dev/null 2>&1 &');
5454

5555
$command = Command::factory('test:command', null, 'after command');
5656
$command->runInBackground();
@@ -59,7 +59,7 @@ public function run_in_background_supports_after_subcommand()
5959
/** @test */
6060
public function run_in_background_supports_before_and_after_subcommands_together()
6161
{
62-
$this->shouldReceiveExecCallOnceWith('(before && php artisan test:command && after) > /dev/null 2>&1 &');
62+
$this->expectsExecWith('(before && php artisan test:command && after) > /dev/null 2>&1 &');
6363

6464
$command = Command::factory('test:command', 'before', 'after');
6565
$command->runInBackground();
@@ -72,7 +72,7 @@ public function run_in_background_supports_before_and_after_subcommands_together
7272
*/
7373
public function it_supports_overriding_of_artisan_binary_through_constant()
7474
{
75-
$this->shouldReceiveExecCallOnceWith('(before && php custom-artisan test:command && after) > /dev/null 2>&1 &');
75+
$this->expectsExecWith('(before && php custom-artisan test:command && after) > /dev/null 2>&1 &');
7676

7777
define('ARTISAN_BINARY', 'custom-artisan');
7878
$command = Command::factory('test:command', 'before', 'after');

0 commit comments

Comments
 (0)