Fix: Method can also return null

This commit is contained in:
Andreas Möller 2018-12-27 19:08:15 +01:00
parent 3be0445596
commit a7755f8663
No known key found for this signature in database
GPG Key ID: 9FB20A0BAF60E11F
2 changed files with 16 additions and 1 deletions

View File

@ -46,7 +46,7 @@ class ExecutableFinder
* @param string $default The default to return if no executable is found
* @param array $extraDirs Additional dirs to check into
*
* @return string The executable path or default value
* @return string|null The executable path or default value
*/
public function find($name, $default = null, array $extraDirs = array())
{

View File

@ -65,6 +65,21 @@ class ExecutableFinderTest extends TestCase
$this->assertEquals($expected, $result);
}
public function testFindWithNullAsDefault()
{
if (ini_get('open_basedir')) {
$this->markTestSkipped('Cannot test when open_basedir is set');
}
$this->setPath('');
$finder = new ExecutableFinder();
$result = $finder->find('foo');
$this->assertNull($result);
}
public function testFindWithExtraDirs()
{
if (ini_get('open_basedir')) {