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
99 private $ command ;
1010 private $ before ;
1111 private $ after ;
12+ private $ phpBinary ;
1213
1314 public function __construct ($ command , $ before = null , $ after = null )
1415 {
1516 $ this ->command = $ command ;
1617 $ this ->before = $ before ;
1718 $ this ->after = $ after ;
19+ $ this ->phpBinary = (new PhpExecutableFinder )->find ();
1820 }
1921
2022 public static function factory ($ command , $ before = null , $ after = null )
@@ -40,7 +42,7 @@ protected function composeForRun()
4042 $ parts [] = (string ) $ this ->before ;
4143 }
4244
43- $ parts [] = "{$ this ->getPhpBinary () } {$ this ->getArtisan ()} {$ this ->command }" ;
45+ $ parts [] = "{$ this ->phpBinary } {$ this ->getArtisan ()} {$ this ->command }" ;
4446
4547 if (!empty ($ this ->after )) {
4648 $ parts [] = (string ) $ this ->after ;
@@ -49,12 +51,6 @@ protected function composeForRun()
4951 return implode (' && ' , $ parts );
5052 }
5153
52- protected function getPhpBinary ()
53- {
54- $ finder = new PhpExecutableFinder ();
55- return $ finder ->find ();
56- }
57-
5854 protected function getArtisan ()
5955 {
6056 return defined ('ARTISAN_BINARY ' ) ? ARTISAN_BINARY : 'artisan ' ;
Original file line number Diff line number Diff line change @@ -15,7 +15,7 @@ protected function setUp()
1515 self ::$ functions = Mockery::mock ();
1616
1717 $ phpBinaryMock = Mockery::mock ('overload:Symfony\Component\Process\PhpExecutableFinder ' );
18- $ phpBinaryMock ->shouldReceive ('find ' )->withNoArgs ()->zeroOrMoreTimes ()->andReturn ('php ' );
18+ $ phpBinaryMock ->shouldReceive ('find ' )->withNoArgs ()->once ()->andReturn ('php ' );
1919 }
2020
2121 /** @test */
You can’t perform that action at this time.
0 commit comments