1
0
mirror of https://github.com/laravel/valet.git synced 2026-02-06 08:40:09 +01:00

Maintain compatibility with the old name of the PHP version

This commit is contained in:
Jesus Urrutia
2018-04-09 11:20:19 -03:00
parent ab8705425c
commit b52ae454a2
3 changed files with 27 additions and 5 deletions

View File

@@ -7,7 +7,8 @@
class Brew class Brew
{ {
const SUPPORTED_PHP_VERSIONS = ['php', 'php@7.2', 'php@7.1', 'php@7.0', 'php@5.6']; const SUPPORTED_PHP_VERSIONS = ['php', 'php@7.2', 'php@7.1', 'php@7.0', 'php@5.6', 'php72', 'php71', 'php70', 'php56'];
const LATEST_PHP_VERSION = 'php@7.2';
var $cli, $files; var $cli, $files;

View File

@@ -111,10 +111,11 @@ function fpmConfigPath()
$confLookup = []; $confLookup = [];
foreach (Brew::SUPPORTED_PHP_VERSIONS as $version) { foreach (Brew::SUPPORTED_PHP_VERSIONS as $version) {
$versionNormalized = preg_replace('/([^\d\.])/', '', $version); $versionNormalized = preg_replace(
$versionNormalized = $versionNormalized === '' '/php@?(\d)\.?(\d)/',
? '7.2' '$1.$2',
: $versionNormalized; $version === 'php' ? Brew::LATEST_PHP_VERSION : $version
);
$confLookup[$version] = $versionNormalized === '5.6' $confLookup[$version] = $versionNormalized === '5.6'
? '/usr/local/etc/php/5.6/php-fpm.conf' ? '/usr/local/etc/php/5.6/php-fpm.conf'

View File

@@ -67,6 +67,10 @@ public function test_has_installed_php_indicates_if_php_is_installed_via_brew()
{ {
$brew = Mockery::mock(Brew::class.'[installed]', [new CommandLine, new Filesystem]); $brew = Mockery::mock(Brew::class.'[installed]', [new CommandLine, new Filesystem]);
$brew->shouldReceive('installed')->with('php')->andReturn(true); $brew->shouldReceive('installed')->with('php')->andReturn(true);
$brew->shouldReceive('installed')->with('php72')->andReturn(true);
$brew->shouldReceive('installed')->with('php71')->andReturn(false);
$brew->shouldReceive('installed')->with('php70')->andReturn(false);
$brew->shouldReceive('installed')->with('php56')->andReturn(false);
$brew->shouldReceive('installed')->with('php@7.2')->andReturn(true); $brew->shouldReceive('installed')->with('php@7.2')->andReturn(true);
$brew->shouldReceive('installed')->with('php@7.1')->andReturn(false); $brew->shouldReceive('installed')->with('php@7.1')->andReturn(false);
$brew->shouldReceive('installed')->with('php@7.0')->andReturn(false); $brew->shouldReceive('installed')->with('php@7.0')->andReturn(false);
@@ -75,6 +79,10 @@ public function test_has_installed_php_indicates_if_php_is_installed_via_brew()
$brew = Mockery::mock(Brew::class.'[installed]', [new CommandLine, new Filesystem]); $brew = Mockery::mock(Brew::class.'[installed]', [new CommandLine, new Filesystem]);
$brew->shouldReceive('installed')->with('php')->andReturn(false); $brew->shouldReceive('installed')->with('php')->andReturn(false);
$brew->shouldReceive('installed')->with('php72')->andReturn(false);
$brew->shouldReceive('installed')->with('php71')->andReturn(true);
$brew->shouldReceive('installed')->with('php70')->andReturn(false);
$brew->shouldReceive('installed')->with('php56')->andReturn(false);
$brew->shouldReceive('installed')->with('php@7.2')->andReturn(false); $brew->shouldReceive('installed')->with('php@7.2')->andReturn(false);
$brew->shouldReceive('installed')->with('php@7.1')->andReturn(true); $brew->shouldReceive('installed')->with('php@7.1')->andReturn(true);
$brew->shouldReceive('installed')->with('php@7.0')->andReturn(false); $brew->shouldReceive('installed')->with('php@7.0')->andReturn(false);
@@ -83,6 +91,10 @@ public function test_has_installed_php_indicates_if_php_is_installed_via_brew()
$brew = Mockery::mock(Brew::class.'[installed]', [new CommandLine, new Filesystem]); $brew = Mockery::mock(Brew::class.'[installed]', [new CommandLine, new Filesystem]);
$brew->shouldReceive('installed')->with('php')->andReturn(false); $brew->shouldReceive('installed')->with('php')->andReturn(false);
$brew->shouldReceive('installed')->with('php72')->andReturn(false);
$brew->shouldReceive('installed')->with('php71')->andReturn(false);
$brew->shouldReceive('installed')->with('php70')->andReturn(true);
$brew->shouldReceive('installed')->with('php56')->andReturn(false);
$brew->shouldReceive('installed')->with('php@7.2')->andReturn(false); $brew->shouldReceive('installed')->with('php@7.2')->andReturn(false);
$brew->shouldReceive('installed')->with('php@7.1')->andReturn(false); $brew->shouldReceive('installed')->with('php@7.1')->andReturn(false);
$brew->shouldReceive('installed')->with('php@7.0')->andReturn(true); $brew->shouldReceive('installed')->with('php@7.0')->andReturn(true);
@@ -91,6 +103,10 @@ public function test_has_installed_php_indicates_if_php_is_installed_via_brew()
$brew = Mockery::mock(Brew::class.'[installed]', [new CommandLine, new Filesystem]); $brew = Mockery::mock(Brew::class.'[installed]', [new CommandLine, new Filesystem]);
$brew->shouldReceive('installed')->with('php')->andReturn(false); $brew->shouldReceive('installed')->with('php')->andReturn(false);
$brew->shouldReceive('installed')->with('php72')->andReturn(false);
$brew->shouldReceive('installed')->with('php71')->andReturn(false);
$brew->shouldReceive('installed')->with('php70')->andReturn(false);
$brew->shouldReceive('installed')->with('php56')->andReturn(true);
$brew->shouldReceive('installed')->with('php@7.2')->andReturn(false); $brew->shouldReceive('installed')->with('php@7.2')->andReturn(false);
$brew->shouldReceive('installed')->with('php@7.1')->andReturn(false); $brew->shouldReceive('installed')->with('php@7.1')->andReturn(false);
$brew->shouldReceive('installed')->with('php@7.0')->andReturn(false); $brew->shouldReceive('installed')->with('php@7.0')->andReturn(false);
@@ -99,6 +115,10 @@ public function test_has_installed_php_indicates_if_php_is_installed_via_brew()
$brew = Mockery::mock(Brew::class.'[installed]', [new CommandLine, new Filesystem]); $brew = Mockery::mock(Brew::class.'[installed]', [new CommandLine, new Filesystem]);
$brew->shouldReceive('installed')->with('php')->andReturn(false); $brew->shouldReceive('installed')->with('php')->andReturn(false);
$brew->shouldReceive('installed')->with('php72')->andReturn(false);
$brew->shouldReceive('installed')->with('php71')->andReturn(false);
$brew->shouldReceive('installed')->with('php70')->andReturn(false);
$brew->shouldReceive('installed')->with('php56')->andReturn(false);
$brew->shouldReceive('installed')->with('php@7.2')->andReturn(false); $brew->shouldReceive('installed')->with('php@7.2')->andReturn(false);
$brew->shouldReceive('installed')->with('php@7.1')->andReturn(false); $brew->shouldReceive('installed')->with('php@7.1')->andReturn(false);
$brew->shouldReceive('installed')->with('php@7.0')->andReturn(false); $brew->shouldReceive('installed')->with('php@7.0')->andReturn(false);