44
55use GrumPHP \Exception \RuntimeException ;
66use GrumPHP \Locator \ExternalCommand ;
7+ use GrumPHP \Util \Platform ;
78use PhpSpec \ObjectBehavior ;
89use Symfony \Component \Process \ExecutableFinder ;
910
@@ -23,25 +24,35 @@ function it_throws_exception_when_external_command_is_not_found(ExecutableFinder
2324 {
2425 $ executableFinder ->find ('test ' , null , ['bin ' ])->willReturn (false );
2526 $ executableFinder ->find ('test.phar ' , null , ['bin ' ])->willReturn (false );
27+ $ executableFinder ->find ('test.bat ' , null , ['bin ' ])->willReturn (false );
2628 $ this ->shouldThrow (RuntimeException::class)->duringLocate ('test ' );
2729 }
2830
2931 function it_locates_external_commands (ExecutableFinder $ executableFinder )
3032 {
33+ $ executableFinder ->find ('test.bat ' , null , ['bin ' ])->willReturn (false );
3134 $ executableFinder ->find ('test ' , null , ['bin ' ])->willReturn ('bin/test ' );
3235 $ this ->locate ('test ' )->shouldEqual ('bin/test ' );
3336 }
3437
3538 function it_locates_external_commands_with_a_suffix (ExecutableFinder $ executableFinder )
3639 {
40+ $ executableFinder ->find ('test.bat ' , null , ['bin ' ])->willReturn (false );
3741 $ executableFinder ->find ('test ' , null , ['bin ' ])->willReturn (false );
3842 $ executableFinder ->find ('test.phar ' , null , ['bin ' ])->willReturn ('bin/test.phar ' );
3943 $ this ->locate ('test ' )->shouldEqual ('bin/test.phar ' );
4044 }
4145
4246 function it_locates_external_commands_without_suffix_first (ExecutableFinder $ executableFinder ) {
47+ $ executableFinder ->find ('test.bat ' , null , ['bin ' ])->willReturn ('bin/test.bat ' );
4348 $ executableFinder ->find ('test ' , null , ['bin ' ])->willReturn ('bin/test ' );
4449 $ executableFinder ->find ('test.phar ' , null , ['bin ' ])->willReturn ('bin/test.phar ' );
50+
51+ if (Platform::isWindows ()) {
52+ $ this ->locate ('test ' )->shouldEqual ('bin/test.bat ' );
53+ return ;
54+ }
55+
4556 $ this ->locate ('test ' )->shouldEqual ('bin/test ' );
4657 }
4758}
0 commit comments