X-Git-Url: http://www.aleph1.co.uk/gitweb/?p=yaffs-website;a=blobdiff_plain;f=vendor%2Fsymfony%2Fprocess%2FTests%2FExecutableFinderTest.php;h=ee25eda02b453d2ca6182d0cf9caf3cff295f659;hp=bc692f6a75df6a77a2ef1cf3dec8f4e9f3bde902;hb=0bf8d09d2542548982e81a441b1f16e75873a04f;hpb=74df008bdbb3a11eeea356744f39b802369bda3c diff --git a/vendor/symfony/process/Tests/ExecutableFinderTest.php b/vendor/symfony/process/Tests/ExecutableFinderTest.php index bc692f6a7..ee25eda02 100644 --- a/vendor/symfony/process/Tests/ExecutableFinderTest.php +++ b/vendor/symfony/process/Tests/ExecutableFinderTest.php @@ -41,7 +41,7 @@ class ExecutableFinderTest extends TestCase $this->markTestSkipped('Cannot test when open_basedir is set'); } - $this->setPath(dirname(PHP_BINARY)); + $this->setPath(\dirname(PHP_BINARY)); $finder = new ExecutableFinder(); $result = $finder->find($this->getPhpBinaryName()); @@ -73,7 +73,7 @@ class ExecutableFinderTest extends TestCase $this->setPath(''); - $extraDirs = array(dirname(PHP_BINARY)); + $extraDirs = array(\dirname(PHP_BINARY)); $finder = new ExecutableFinder(); $result = $finder->find($this->getPhpBinaryName(), null, $extraDirs); @@ -83,7 +83,7 @@ class ExecutableFinderTest extends TestCase public function testFindWithOpenBaseDir() { - if ('\\' === DIRECTORY_SEPARATOR) { + if ('\\' === \DIRECTORY_SEPARATOR) { $this->markTestSkipped('Cannot run test on windows'); } @@ -91,7 +91,7 @@ class ExecutableFinderTest extends TestCase $this->markTestSkipped('Cannot test when open_basedir is set'); } - $this->iniSet('open_basedir', dirname(PHP_BINARY).(!defined('HHVM_VERSION') || HHVM_VERSION_ID >= 30800 ? PATH_SEPARATOR.'/' : '')); + $this->iniSet('open_basedir', \dirname(PHP_BINARY).(!\defined('HHVM_VERSION') || HHVM_VERSION_ID >= 30800 ? PATH_SEPARATOR.'/' : '')); $finder = new ExecutableFinder(); $result = $finder->find($this->getPhpBinaryName()); @@ -104,12 +104,12 @@ class ExecutableFinderTest extends TestCase if (ini_get('open_basedir')) { $this->markTestSkipped('Cannot test when open_basedir is set'); } - if ('\\' === DIRECTORY_SEPARATOR) { + if ('\\' === \DIRECTORY_SEPARATOR) { $this->markTestSkipped('Cannot run test on windows'); } $this->setPath(''); - $this->iniSet('open_basedir', PHP_BINARY.(!defined('HHVM_VERSION') || HHVM_VERSION_ID >= 30800 ? PATH_SEPARATOR.'/' : '')); + $this->iniSet('open_basedir', PHP_BINARY.(!\defined('HHVM_VERSION') || HHVM_VERSION_ID >= 30800 ? PATH_SEPARATOR.'/' : '')); $finder = new ExecutableFinder(); $result = $finder->find($this->getPhpBinaryName(), false); @@ -117,9 +117,39 @@ class ExecutableFinderTest extends TestCase $this->assertSamePath(PHP_BINARY, $result); } + /** + * @requires PHP 5.4 + */ + public function testFindBatchExecutableOnWindows() + { + if (ini_get('open_basedir')) { + $this->markTestSkipped('Cannot test when open_basedir is set'); + } + if ('\\' !== \DIRECTORY_SEPARATOR) { + $this->markTestSkipped('Can be only tested on windows'); + } + + $target = tempnam(sys_get_temp_dir(), 'example-windows-executable'); + + touch($target); + touch($target.'.BAT'); + + $this->assertFalse(is_executable($target)); + + $this->setPath(sys_get_temp_dir()); + + $finder = new ExecutableFinder(); + $result = $finder->find(basename($target), false); + + unlink($target); + unlink($target.'.BAT'); + + $this->assertSamePath($target.'.BAT', $result); + } + private function assertSamePath($expected, $tested) { - if ('\\' === DIRECTORY_SEPARATOR) { + if ('\\' === \DIRECTORY_SEPARATOR) { $this->assertEquals(strtolower($expected), strtolower($tested)); } else { $this->assertEquals($expected, $tested); @@ -128,6 +158,6 @@ class ExecutableFinderTest extends TestCase private function getPhpBinaryName() { - return basename(PHP_BINARY, '\\' === DIRECTORY_SEPARATOR ? '.exe' : ''); + return basename(PHP_BINARY, '\\' === \DIRECTORY_SEPARATOR ? '.exe' : ''); } }