File tree Expand file tree Collapse file tree 2 files changed +17
-10
lines changed Expand file tree Collapse file tree 2 files changed +17
-10
lines changed Original file line number Diff line number Diff line change 22
33abstract class TestCase extends \PHPUnit \Framework \TestCase
44{
5+ public static $ functions ;
6+
7+ protected function setUp ()
8+ {
9+ self ::$ functions = Mockery::mock ();
10+ }
11+
12+ protected function shouldReceiveExecCallOnceWith ($ with )
13+ {
14+ self ::$ functions ->shouldReceive ('exec ' )->with ($ with )->once ();
15+ }
16+
517 protected function tearDown ()
618 {
719 Mockery::close ();
Original file line number Diff line number Diff line change 88
99class CommandTest extends TestCase
1010{
11- public static $ functions ;
12-
1311 protected function setUp ()
1412 {
15- self :: $ functions = Mockery:: mock ();
13+ parent :: setUp ();
1614
1715 $ phpBinaryMock = Mockery::mock ('overload:Symfony\Component\Process\PhpExecutableFinder ' );
1816 $ phpBinaryMock ->shouldReceive ('find ' )->withNoArgs ()->once ()->andReturn ('php ' );
@@ -88,14 +86,11 @@ public function it_supports_overriding_of_artisan_binary_through_constant()
8886 $ command = Command::factory ('test:command ' , 'before ' , 'after ' );
8987 $ command ->runInBackground ();
9088 }
89+ }
9190
92- private function shouldReceiveExecCallOnceWith ($ with )
91+ if (!function_exists (__NAMESPACE__ . '\exec ' )) {
92+ function exec ($ command )
9393 {
94- self ::$ functions ->shouldReceive ( ' exec ' )-> with ( $ with )-> once ( );
94+ return TestCase ::$ functions ->exec ( $ command );
9595 }
9696}
97-
98- function exec ($ command )
99- {
100- return CommandTest::$ functions ->exec ($ command );
101- }
You can’t perform that action at this time.
0 commit comments