mirror of
https://github.com/laravel/valet.git
synced 2026-02-05 08:30:07 +01:00
Merge pull request #100 from drbyte/php71
Add basic changes to allow php71
This commit is contained in:
@@ -40,7 +40,8 @@ function installed($formula)
|
||||
*/
|
||||
function hasInstalledPhp()
|
||||
{
|
||||
return $this->installed('php70')
|
||||
return $this->installed('php71')
|
||||
|| $this->installed('php70')
|
||||
|| $this->installed('php56')
|
||||
|| $this->installed('php55');
|
||||
}
|
||||
@@ -137,7 +138,9 @@ function linkedPhp()
|
||||
|
||||
$resolvedPath = $this->files->readLink('/usr/local/bin/php');
|
||||
|
||||
if (strpos($resolvedPath, 'php70') !== false) {
|
||||
if (strpos($resolvedPath, 'php71') !== false) {
|
||||
return 'php71';
|
||||
} elseif (strpos($resolvedPath, 'php70') !== false) {
|
||||
return 'php70';
|
||||
} elseif (strpos($resolvedPath, 'php56') !== false) {
|
||||
return 'php56';
|
||||
|
||||
@@ -36,7 +36,8 @@ public function __construct(Brew $brew, CommandLine $cli, Filesystem $files)
|
||||
*/
|
||||
public function install()
|
||||
{
|
||||
if (! $this->brew->installed('php70') &&
|
||||
if (! $this->brew->installed('php71') &&
|
||||
! $this->brew->installed('php70') &&
|
||||
! $this->brew->installed('php56') &&
|
||||
! $this->brew->installed('php55')) {
|
||||
$this->brew->ensureInstalled('php70', $this->taps);
|
||||
@@ -83,7 +84,7 @@ public function restart()
|
||||
*/
|
||||
public function stop()
|
||||
{
|
||||
$this->brew->stopService('php55', 'php56', 'php70');
|
||||
$this->brew->stopService('php55', 'php56', 'php70', 'php71');
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -93,7 +94,9 @@ public function stop()
|
||||
*/
|
||||
public function fpmConfigPath()
|
||||
{
|
||||
if ($this->brew->linkedPhp() === 'php70') {
|
||||
if ($this->brew->linkedPhp() === 'php71') {
|
||||
return '/usr/local/etc/php/7.1/php-fpm.d/www.conf';
|
||||
} elseif ($this->brew->linkedPhp() === 'php70') {
|
||||
return '/usr/local/etc/php/7.0/php-fpm.d/www.conf';
|
||||
} elseif ($this->brew->linkedPhp() === 'php56') {
|
||||
return '/usr/local/etc/php/5.6/php-fpm.conf';
|
||||
|
||||
@@ -66,18 +66,21 @@ public function test_installed_returns_false_when_given_formula_is_not_installed
|
||||
public function test_has_installed_php_indicates_if_php_is_installed_via_brew()
|
||||
{
|
||||
$brew = Mockery::mock(Brew::class.'[installed]', [new CommandLine, new Filesystem]);
|
||||
$brew->shouldReceive('installed')->once()->with('php70')->andReturn(true);
|
||||
$brew->shouldReceive('installed')->once()->with('php71')->andReturn(true);
|
||||
$brew->shouldReceive('installed')->with('php70')->andReturn(true);
|
||||
$brew->shouldReceive('installed')->with('php56')->andReturn(true);
|
||||
$brew->shouldReceive('installed')->with('php55')->andReturn(true);
|
||||
$this->assertTrue($brew->hasInstalledPhp());
|
||||
|
||||
$brew = Mockery::mock(Brew::class.'[installed]', [new CommandLine, new Filesystem]);
|
||||
$brew->shouldReceive('installed')->once()->with('php70')->andReturn(true);
|
||||
$brew->shouldReceive('installed')->with('php71')->andReturn(false);
|
||||
$brew->shouldReceive('installed')->with('php56')->andReturn(false);
|
||||
$brew->shouldReceive('installed')->with('php55')->andReturn(false);
|
||||
$this->assertTrue($brew->hasInstalledPhp());
|
||||
|
||||
$brew = Mockery::mock(Brew::class.'[installed]', [new CommandLine, new Filesystem]);
|
||||
$brew->shouldReceive('installed')->once()->with('php71')->andReturn(false);
|
||||
$brew->shouldReceive('installed')->once()->with('php70')->andReturn(false);
|
||||
$brew->shouldReceive('installed')->once()->with('php56')->andReturn(false);
|
||||
$brew->shouldReceive('installed')->once()->with('php55')->andReturn(false);
|
||||
|
||||
Reference in New Issue
Block a user