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

Allows Valet to run under PHP 5.5 (#57)

* Allows for valet to run under PHP 5.5 as well.

Add checks for php55 to the mix.

* Allows for valet to run under PHP 5.5 as well.

Add checks for php55 to the mix.

* Update .travis.yml

* Update PhpFpm.php

* Add tests for php55
This commit is contained in:
Glendon Solsberry
2016-05-10 22:56:25 -04:00
committed by Taylor Otwell
parent 0139d506f5
commit e714082d50
5 changed files with 20 additions and 5 deletions

View File

@@ -1,6 +1,7 @@
language: php
php:
- 5.5
- 5.6
- 7.0

View File

@@ -41,7 +41,9 @@ function installed($formula)
*/
function hasInstalledPhp()
{
return $this->installed('php70') || $this->installed('php56');
return $this->installed('php70')
|| $this->installed('php56')
|| $this->installed('php55');
}
/**
@@ -140,6 +142,8 @@ function linkedPhp()
return 'php70';
} elseif (strpos($resolvedPath, 'php56') !== false) {
return 'php56';
} elseif (strpos($resolvedPath, 'php55') !== false) {
return 'php55';
} else {
throw new DomainException("Unable to determine linked PHP.");
}

View File

@@ -2,6 +2,7 @@
namespace Valet;
use DomainException;
use Exception;
use Symfony\Component\Process\Process;
@@ -35,7 +36,9 @@ function __construct(Brew $brew, CommandLine $cli, Filesystem $files)
*/
function install()
{
if (! $this->brew->installed('php70') && ! $this->brew->installed('php56')) {
if (! $this->brew->installed('php70')
&& ! $this->brew->installed('php56')
&& ! $this->brew->installed('php55')) {
$this->brew->ensureInstalled('php70', $this->taps);
}
@@ -80,7 +83,7 @@ function restart()
*/
function stop()
{
$this->brew->stopService('php56', 'php70');
$this->brew->stopService('php55', 'php56', 'php70');
}
/**
@@ -92,8 +95,12 @@ function fpmConfigPath()
{
if ($this->brew->linkedPhp() === 'php70') {
return '/usr/local/etc/php/7.0/php-fpm.d/www.conf';
} else {
} elseif ($this->brew->linkedPhp() === 'php56') {
return '/usr/local/etc/php/5.6/php-fpm.conf';
} elseif ($this->brew->linkedPhp() === 'php55') {
return '/usr/local/etc/php/5.5/php-fpm.conf';
} else {
throw new DomainException('Unable to find php-fpm config.');
}
}
}

View File

@@ -33,7 +33,7 @@
},
"require-dev": {
"mockery/mockery": "0.9.*",
"phpunit/phpunit": "~5.0"
"phpunit/phpunit": ">=4.8.24"
},
"bin": [
"valet"

View File

@@ -68,16 +68,19 @@ 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')->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('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('php70')->andReturn(false);
$brew->shouldReceive('installed')->once()->with('php56')->andReturn(false);
$brew->shouldReceive('installed')->once()->with('php55')->andReturn(false);
$this->assertFalse($brew->hasInstalledPhp());
}