mirror of
https://github.com/laravel/valet.git
synced 2026-02-05 08:30:07 +01:00
Fix testing for Brew class
This commit is contained in:
@@ -67,42 +67,42 @@ 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')->with('php')->andReturn(true);
|
||||
$brew->shouldReceive('installed')->with('php72')->andReturn(true);
|
||||
$brew->shouldReceive('installed')->with('php71')->andReturn(false);
|
||||
$brew->shouldReceive('installed')->with('php70')->andReturn(false);
|
||||
$brew->shouldReceive('installed')->with('php56')->andReturn(false);
|
||||
$brew->shouldReceive('installed')->with('php@7.2')->andReturn(true);
|
||||
$brew->shouldReceive('installed')->with('php@7.1')->andReturn(false);
|
||||
$brew->shouldReceive('installed')->with('php@7.0')->andReturn(false);
|
||||
$brew->shouldReceive('installed')->with('php@5.6')->andReturn(false);
|
||||
$this->assertTrue($brew->hasInstalledPhp());
|
||||
|
||||
$brew = Mockery::mock(Brew::class.'[installed]', [new CommandLine, new Filesystem]);
|
||||
$brew->shouldReceive('installed')->with('php')->andReturn(false);
|
||||
$brew->shouldReceive('installed')->with('php72')->andReturn(false);
|
||||
$brew->shouldReceive('installed')->with('php71')->andReturn(true);
|
||||
$brew->shouldReceive('installed')->with('php70')->andReturn(false);
|
||||
$brew->shouldReceive('installed')->with('php56')->andReturn(false);
|
||||
$brew->shouldReceive('installed')->with('php@7.2')->andReturn(false);
|
||||
$brew->shouldReceive('installed')->with('php@7.1')->andReturn(true);
|
||||
$brew->shouldReceive('installed')->with('php@7.0')->andReturn(false);
|
||||
$brew->shouldReceive('installed')->with('php@5.6')->andReturn(false);
|
||||
$this->assertTrue($brew->hasInstalledPhp());
|
||||
|
||||
$brew = Mockery::mock(Brew::class.'[installed]', [new CommandLine, new Filesystem]);
|
||||
$brew->shouldReceive('installed')->with('php')->andReturn(false);
|
||||
$brew->shouldReceive('installed')->with('php72')->andReturn(false);
|
||||
$brew->shouldReceive('installed')->with('php71')->andReturn(false);
|
||||
$brew->shouldReceive('installed')->with('php70')->andReturn(true);
|
||||
$brew->shouldReceive('installed')->with('php56')->andReturn(false);
|
||||
$brew->shouldReceive('installed')->with('php@7.2')->andReturn(false);
|
||||
$brew->shouldReceive('installed')->with('php@7.1')->andReturn(false);
|
||||
$brew->shouldReceive('installed')->with('php@7.0')->andReturn(true);
|
||||
$brew->shouldReceive('installed')->with('php@5.6')->andReturn(false);
|
||||
$this->assertTrue($brew->hasInstalledPhp());
|
||||
|
||||
$brew = Mockery::mock(Brew::class.'[installed]', [new CommandLine, new Filesystem]);
|
||||
$brew->shouldReceive('installed')->with('php')->andReturn(false);
|
||||
$brew->shouldReceive('installed')->with('php72')->andReturn(false);
|
||||
$brew->shouldReceive('installed')->with('php71')->andReturn(false);
|
||||
$brew->shouldReceive('installed')->with('php70')->andReturn(false);
|
||||
$brew->shouldReceive('installed')->with('php56')->andReturn(true);
|
||||
$brew->shouldReceive('installed')->with('php@7.2')->andReturn(false);
|
||||
$brew->shouldReceive('installed')->with('php@7.1')->andReturn(false);
|
||||
$brew->shouldReceive('installed')->with('php@7.0')->andReturn(false);
|
||||
$brew->shouldReceive('installed')->with('php@5.6')->andReturn(true);
|
||||
$this->assertTrue($brew->hasInstalledPhp());
|
||||
|
||||
$brew = Mockery::mock(Brew::class.'[installed]', [new CommandLine, new Filesystem]);
|
||||
$brew->shouldReceive('installed')->with('php')->andReturn(false);
|
||||
$brew->shouldReceive('installed')->with('php72')->andReturn(false);
|
||||
$brew->shouldReceive('installed')->with('php71')->andReturn(false);
|
||||
$brew->shouldReceive('installed')->with('php70')->andReturn(false);
|
||||
$brew->shouldReceive('installed')->with('php56')->andReturn(false);
|
||||
$brew->shouldReceive('installed')->with('php@7.2')->andReturn(false);
|
||||
$brew->shouldReceive('installed')->with('php@7.1')->andReturn(false);
|
||||
$brew->shouldReceive('installed')->with('php@7.0')->andReturn(false);
|
||||
$brew->shouldReceive('installed')->with('php@5.6')->andReturn(false);
|
||||
$this->assertFalse($brew->hasInstalledPhp());
|
||||
}
|
||||
|
||||
@@ -145,13 +145,13 @@ public function test_linked_php_returns_linked_php_formula_name()
|
||||
$files->shouldReceive('isLink')->once()->with('/usr/local/bin/php')->andReturn(true);
|
||||
$files->shouldReceive('readLink')->once()->with('/usr/local/bin/php')->andReturn('/test/path/php71/test');
|
||||
swap(Filesystem::class, $files);
|
||||
$this->assertSame('php71', resolve(Brew::class)->linkedPhp());
|
||||
$this->assertSame('php@7.1', resolve(Brew::class)->linkedPhp());
|
||||
|
||||
$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/php56/test');
|
||||
swap(Filesystem::class, $files);
|
||||
$this->assertSame('php56', resolve(Brew::class)->linkedPhp());
|
||||
$this->assertSame('php@5.6', resolve(Brew::class)->linkedPhp());
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user