mirror of
https://github.com/laravel/valet.git
synced 2026-02-05 08:30:07 +01:00
StyleCI Patch
This commit is contained in:
@@ -310,12 +310,12 @@ public function getPhpExecutablePath($phpVersion = null)
|
||||
}
|
||||
|
||||
// Check if the default PHP is the version we are looking for
|
||||
if ($this->files->isLink(BREW_PREFIX."/opt/php")) {
|
||||
$resolvedPath = $this->files->readLink(BREW_PREFIX."/opt/php");
|
||||
if ($this->files->isLink(BREW_PREFIX.'/opt/php')) {
|
||||
$resolvedPath = $this->files->readLink(BREW_PREFIX.'/opt/php');
|
||||
$matches = $this->parsePhpPath($resolvedPath);
|
||||
$resolvedPhpVersion = $matches[3] ?: $matches[2];
|
||||
if ($this->isPhpVersionsEqual($resolvedPhpVersion, $phpVersion)) {
|
||||
return BREW_PREFIX."/opt/php/bin/php";
|
||||
return BREW_PREFIX.'/opt/php/bin/php';
|
||||
}
|
||||
}
|
||||
|
||||
@@ -489,10 +489,9 @@ function ($exitCode, $errorOutput) {
|
||||
}
|
||||
|
||||
/**
|
||||
* Parse homebrew PHP Path
|
||||
* Parse homebrew PHP Path.
|
||||
*
|
||||
* @param string $resolvedPath
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
public function parsePhpPath($resolvedPath)
|
||||
@@ -510,11 +509,10 @@ public function parsePhpPath($resolvedPath)
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if two PHP versions are equal
|
||||
* Check if two PHP versions are equal.
|
||||
*
|
||||
* @param string $resolvedPhpVersion
|
||||
* @param string $version
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function isPhpVersionsEqual($resolvedPhpVersion, $version)
|
||||
|
||||
@@ -425,9 +425,9 @@ public function test_it_can_get_php_binary_path_from_php_version()
|
||||
|
||||
$files->shouldReceive('exists')->once()->with(BREW_PREFIX.'/opt/php@7.4/bin/php')->andReturn(false);
|
||||
$files->shouldReceive('exists')->with(BREW_PREFIX.'/opt/php74/bin/php')->andReturn(false);
|
||||
$files->shouldReceive('isLink')->with(BREW_PREFIX."/opt/php")->andReturn(true);
|
||||
$files->shouldReceive('readLink')->with(BREW_PREFIX."/opt/php")->andReturn('../Cellar/php@7.4/7.4.13/bin/php');
|
||||
$this->assertEquals(BREW_PREFIX."/opt/php/bin/php", $brewMock->getPhpExecutablePath('php@7.4'));
|
||||
$files->shouldReceive('isLink')->with(BREW_PREFIX.'/opt/php')->andReturn(true);
|
||||
$files->shouldReceive('readLink')->with(BREW_PREFIX.'/opt/php')->andReturn('../Cellar/php@7.4/7.4.13/bin/php');
|
||||
$this->assertEquals(BREW_PREFIX.'/opt/php/bin/php', $brewMock->getPhpExecutablePath('php@7.4'));
|
||||
|
||||
// When the default PHP is not the version we are looking for
|
||||
$brewMock = Mockery::mock(Brew::class, [
|
||||
@@ -437,9 +437,9 @@ public function test_it_can_get_php_binary_path_from_php_version()
|
||||
|
||||
$files->shouldReceive('exists')->once()->with(BREW_PREFIX.'/opt/php@7.4/bin/php')->andReturn(false);
|
||||
$files->shouldReceive('exists')->with(BREW_PREFIX.'/opt/php74/bin/php')->andReturn(false);
|
||||
$files->shouldReceive('isLink')->with(BREW_PREFIX."/opt/php")->andReturn(true);
|
||||
$files->shouldReceive('readLink')->with(BREW_PREFIX."/opt/php")->andReturn('../Cellar/php@8.1/8.1.13/bin/php');
|
||||
$this->assertEquals(BREW_PREFIX."/bin/php", $brewMock->getPhpExecutablePath('php@7.4')); // Could not find a version, so retuned the default binary
|
||||
$files->shouldReceive('isLink')->with(BREW_PREFIX.'/opt/php')->andReturn(true);
|
||||
$files->shouldReceive('readLink')->with(BREW_PREFIX.'/opt/php')->andReturn('../Cellar/php@8.1/8.1.13/bin/php');
|
||||
$this->assertEquals(BREW_PREFIX.'/bin/php', $brewMock->getPhpExecutablePath('php@7.4')); // Could not find a version, so retuned the default binary
|
||||
|
||||
// When no PHP Version is provided
|
||||
$brewMock = Mockery::mock(Brew::class, [
|
||||
|
||||
Reference in New Issue
Block a user