Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions cli/Valet/Brew.php
Original file line number Diff line number Diff line change
Expand Up @@ -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');
}
Expand Down Expand Up @@ -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';
Expand Down
9 changes: 6 additions & 3 deletions cli/Valet/PhpFpm.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -83,7 +84,7 @@ public function restart()
*/
public function stop()
{
$this->brew->stopService('php55', 'php56', 'php70');
$this->brew->stopService('php55', 'php56', 'php70', 'php71');
}

/**
Expand All @@ -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';
Expand Down
5 changes: 4 additions & 1 deletion tests/BrewTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down