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

Upgrading PHP to 7.1 (#227)

This commit is contained in:
Daniel Polito
2016-12-14 18:14:33 -02:00
committed by Taylor Otwell
parent 9c8f5de52a
commit 5a25224e11
2 changed files with 17 additions and 16 deletions

View File

@@ -40,7 +40,7 @@ function install()
! $this->brew->installed('php70') &&
! $this->brew->installed('php56') &&
! $this->brew->installed('php55')) {
$this->brew->ensureInstalled('php70', [], $this->taps);
$this->brew->ensureInstalled('php71', [], $this->taps);
}
$this->files->ensureDirExists('/usr/local/var/log', user());

View File

@@ -30,36 +30,36 @@ public function test_brew_can_be_resolved_from_container()
public function test_installed_returns_true_when_given_formula_is_installed()
{
$cli = Mockery::mock(CommandLine::class);
$cli->shouldReceive('runAsUser')->once()->with('brew list | grep php70')->andReturn('php70');
$cli->shouldReceive('runAsUser')->once()->with('brew list | grep php71')->andReturn('php71');
swap(CommandLine::class, $cli);
$this->assertTrue(resolve(Brew::class)->installed('php70'));
$this->assertTrue(resolve(Brew::class)->installed('php71'));
$cli = Mockery::mock(CommandLine::class);
$cli->shouldReceive('runAsUser')->once()->with('brew list | grep php70')->andReturn('php70-mcrypt
php70');
$cli->shouldReceive('runAsUser')->once()->with('brew list | grep php71')->andReturn('php71-mcrypt
php71');
swap(CommandLine::class, $cli);
$this->assertTrue(resolve(Brew::class)->installed('php70'));
$this->assertTrue(resolve(Brew::class)->installed('php71'));
}
public function test_installed_returns_false_when_given_formula_is_not_installed()
{
$cli = Mockery::mock(CommandLine::class);
$cli->shouldReceive('runAsUser')->once()->with('brew list | grep php70')->andReturn('');
$cli->shouldReceive('runAsUser')->once()->with('brew list | grep php71')->andReturn('');
swap(CommandLine::class, $cli);
$this->assertFalse(resolve(Brew::class)->installed('php70'));
$this->assertFalse(resolve(Brew::class)->installed('php71'));
$cli = Mockery::mock(CommandLine::class);
$cli->shouldReceive('runAsUser')->once()->with('brew list | grep php70')->andReturn('php70-mcrypt');
$cli->shouldReceive('runAsUser')->once()->with('brew list | grep php71')->andReturn('php71-mcrypt');
swap(CommandLine::class, $cli);
$this->assertFalse(resolve(Brew::class)->installed('php70'));
$this->assertFalse(resolve(Brew::class)->installed('php71'));
$cli = Mockery::mock(CommandLine::class);
$cli->shouldReceive('runAsUser')->once()->with('brew list | grep php70')->andReturn('php70-mcrypt
php70-something-else
$cli->shouldReceive('runAsUser')->once()->with('brew list | grep php71')->andReturn('php71-mcrypt
php71-something-else
php7');
swap(CommandLine::class, $cli);
$this->assertFalse(resolve(Brew::class)->installed('php70'));
$this->assertFalse(resolve(Brew::class)->installed('php71'));
}
@@ -91,10 +91,11 @@ public function test_has_installed_php_indicates_if_php_is_installed_via_brew()
public function test_tap_taps_the_given_homebrew_repository()
{
$cli = Mockery::mock(CommandLine::class);
$cli->shouldReceive('passthru')->once()->with('sudo -u '.user().' brew tap php71');
$cli->shouldReceive('passthru')->once()->with('sudo -u '.user().' brew tap php70');
$cli->shouldReceive('passthru')->once()->with('sudo -u '.user().' brew tap php56');
swap(CommandLine::class, $cli);
resolve(Brew::class)->tap('php70', 'php56');
resolve(Brew::class)->tap('php71', 'php70', 'php56');
}
@@ -120,9 +121,9 @@ public function test_linked_php_returns_linked_php_formula_name()
{
$files = Mockery::mock(Filesystem::class);
$files->shouldReceive('isLink')->once()->with('/usr/local/bin/php')->andReturn(true);
$files->shouldReceive('readLink')->once()->with('/usr/local/bin/php')->andReturn('/test/path/php70/test');
$files->shouldReceive('readLink')->once()->with('/usr/local/bin/php')->andReturn('/test/path/php71/test');
swap(Filesystem::class, $files);
$this->assertSame('php70', resolve(Brew::class)->linkedPhp());
$this->assertSame('php71', resolve(Brew::class)->linkedPhp());
$files = Mockery::mock(Filesystem::class);
$files->shouldReceive('isLink')->once()->with('/usr/local/bin/php')->andReturn(true);