File tree Expand file tree Collapse file tree 2 files changed +4
-8
lines changed Expand file tree Collapse file tree 2 files changed +4
-8
lines changed Original file line number Diff line number Diff line change @@ -9,12 +9,14 @@ class Command
9
9
private $ command ;
10
10
private $ before ;
11
11
private $ after ;
12
+ private $ phpBinary ;
12
13
13
14
public function __construct ($ command , $ before = null , $ after = null )
14
15
{
15
16
$ this ->command = $ command ;
16
17
$ this ->before = $ before ;
17
18
$ this ->after = $ after ;
19
+ $ this ->phpBinary = (new PhpExecutableFinder )->find ();
18
20
}
19
21
20
22
public static function factory ($ command , $ before = null , $ after = null )
@@ -40,7 +42,7 @@ protected function composeForRun()
40
42
$ parts [] = (string ) $ this ->before ;
41
43
}
42
44
43
- $ parts [] = "{$ this ->getPhpBinary () } {$ this ->getArtisan ()} {$ this ->command }" ;
45
+ $ parts [] = "{$ this ->phpBinary } {$ this ->getArtisan ()} {$ this ->command }" ;
44
46
45
47
if (!empty ($ this ->after )) {
46
48
$ parts [] = (string ) $ this ->after ;
@@ -49,12 +51,6 @@ protected function composeForRun()
49
51
return implode (' && ' , $ parts );
50
52
}
51
53
52
- protected function getPhpBinary ()
53
- {
54
- $ finder = new PhpExecutableFinder ();
55
- return $ finder ->find ();
56
- }
57
-
58
54
protected function getArtisan ()
59
55
{
60
56
return defined ('ARTISAN_BINARY ' ) ? ARTISAN_BINARY : 'artisan ' ;
Original file line number Diff line number Diff line change @@ -15,7 +15,7 @@ protected function setUp()
15
15
self ::$ functions = Mockery::mock ();
16
16
17
17
$ phpBinaryMock = Mockery::mock ('overload:Symfony\Component\Process\PhpExecutableFinder ' );
18
- $ phpBinaryMock ->shouldReceive ('find ' )->withNoArgs ()->zeroOrMoreTimes ()->andReturn ('php ' );
18
+ $ phpBinaryMock ->shouldReceive ('find ' )->withNoArgs ()->once ()->andReturn ('php ' );
19
19
}
20
20
21
21
/** @test */
You can’t perform that action at this time.
0 commit comments