Skip to content

Commit 7e9e028

Browse files
authored
Merge pull request #100 from drbyte/php71
Add basic changes to allow php71
2 parents 58e3c07 + 77cd98f commit 7e9e028

File tree

3 files changed

+15
-6
lines changed

3 files changed

+15
-6
lines changed

cli/Valet/Brew.php

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,8 @@ function installed($formula)
4040
*/
4141
function hasInstalledPhp()
4242
{
43-
return $this->installed('php70')
43+
return $this->installed('php71')
44+
|| $this->installed('php70')
4445
|| $this->installed('php56')
4546
|| $this->installed('php55');
4647
}
@@ -137,7 +138,9 @@ function linkedPhp()
137138

138139
$resolvedPath = $this->files->readLink('/usr/local/bin/php');
139140

140-
if (strpos($resolvedPath, 'php70') !== false) {
141+
if (strpos($resolvedPath, 'php71') !== false) {
142+
return 'php71';
143+
} elseif (strpos($resolvedPath, 'php70') !== false) {
141144
return 'php70';
142145
} elseif (strpos($resolvedPath, 'php56') !== false) {
143146
return 'php56';

cli/Valet/PhpFpm.php

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,8 @@ public function __construct(Brew $brew, CommandLine $cli, Filesystem $files)
3636
*/
3737
public function install()
3838
{
39-
if (! $this->brew->installed('php70') &&
39+
if (! $this->brew->installed('php71') &&
40+
! $this->brew->installed('php70') &&
4041
! $this->brew->installed('php56') &&
4142
! $this->brew->installed('php55')) {
4243
$this->brew->ensureInstalled('php70', $this->taps);
@@ -83,7 +84,7 @@ public function restart()
8384
*/
8485
public function stop()
8586
{
86-
$this->brew->stopService('php55', 'php56', 'php70');
87+
$this->brew->stopService('php55', 'php56', 'php70', 'php71');
8788
}
8889

8990
/**
@@ -93,7 +94,9 @@ public function stop()
9394
*/
9495
public function fpmConfigPath()
9596
{
96-
if ($this->brew->linkedPhp() === 'php70') {
97+
if ($this->brew->linkedPhp() === 'php71') {
98+
return '/usr/local/etc/php/7.1/php-fpm.d/www.conf';
99+
} elseif ($this->brew->linkedPhp() === 'php70') {
97100
return '/usr/local/etc/php/7.0/php-fpm.d/www.conf';
98101
} elseif ($this->brew->linkedPhp() === 'php56') {
99102
return '/usr/local/etc/php/5.6/php-fpm.conf';

tests/BrewTest.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,18 +66,21 @@ public function test_installed_returns_false_when_given_formula_is_not_installed
6666
public function test_has_installed_php_indicates_if_php_is_installed_via_brew()
6767
{
6868
$brew = Mockery::mock(Brew::class.'[installed]', [new CommandLine, new Filesystem]);
69-
$brew->shouldReceive('installed')->once()->with('php70')->andReturn(true);
69+
$brew->shouldReceive('installed')->once()->with('php71')->andReturn(true);
70+
$brew->shouldReceive('installed')->with('php70')->andReturn(true);
7071
$brew->shouldReceive('installed')->with('php56')->andReturn(true);
7172
$brew->shouldReceive('installed')->with('php55')->andReturn(true);
7273
$this->assertTrue($brew->hasInstalledPhp());
7374

7475
$brew = Mockery::mock(Brew::class.'[installed]', [new CommandLine, new Filesystem]);
7576
$brew->shouldReceive('installed')->once()->with('php70')->andReturn(true);
77+
$brew->shouldReceive('installed')->with('php71')->andReturn(false);
7678
$brew->shouldReceive('installed')->with('php56')->andReturn(false);
7779
$brew->shouldReceive('installed')->with('php55')->andReturn(false);
7880
$this->assertTrue($brew->hasInstalledPhp());
7981

8082
$brew = Mockery::mock(Brew::class.'[installed]', [new CommandLine, new Filesystem]);
83+
$brew->shouldReceive('installed')->once()->with('php71')->andReturn(false);
8184
$brew->shouldReceive('installed')->once()->with('php70')->andReturn(false);
8285
$brew->shouldReceive('installed')->once()->with('php56')->andReturn(false);
8386
$brew->shouldReceive('installed')->once()->with('php55')->andReturn(false);

0 commit comments

Comments
 (0)