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 2
2
3
3
abstract class TestCase extends \PHPUnit \Framework \TestCase
4
4
{
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
+
5
17
protected function tearDown ()
6
18
{
7
19
Mockery::close ();
Original file line number Diff line number Diff line change 8
8
9
9
class CommandTest extends TestCase
10
10
{
11
- public static $ functions ;
12
-
13
11
protected function setUp ()
14
12
{
15
- self :: $ functions = Mockery:: mock ();
13
+ parent :: setUp ();
16
14
17
15
$ phpBinaryMock = Mockery::mock ('overload:Symfony\Component\Process\PhpExecutableFinder ' );
18
16
$ phpBinaryMock ->shouldReceive ('find ' )->withNoArgs ()->once ()->andReturn ('php ' );
@@ -88,14 +86,11 @@ public function it_supports_overriding_of_artisan_binary_through_constant()
88
86
$ command = Command::factory ('test:command ' , 'before ' , 'after ' );
89
87
$ command ->runInBackground ();
90
88
}
89
+ }
91
90
92
- private function shouldReceiveExecCallOnceWith ($ with )
91
+ if (!function_exists (__NAMESPACE__ . '\exec ' )) {
92
+ function exec ($ command )
93
93
{
94
- self ::$ functions ->shouldReceive ( ' exec ' )-> with ( $ with )-> once ( );
94
+ return TestCase ::$ functions ->exec ( $ command );
95
95
}
96
96
}
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