mirror of
https://github.com/laravel/valet.git
synced 2026-02-05 08:30:07 +01:00
Run brew list as user
As brew no longer allows running itself as root, we need to run it at the current user. This resolves #221.
This commit is contained in:
@@ -30,12 +30,12 @@ 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('run')->once()->with('brew list | grep php70')->andReturn('php70');
|
||||
$cli->shouldReceive('run')->once()->with('sudo -u '.user().' brew list | grep php70')->andReturn('php70');
|
||||
swap(CommandLine::class, $cli);
|
||||
$this->assertTrue(resolve(Brew::class)->installed('php70'));
|
||||
|
||||
$cli = Mockery::mock(CommandLine::class);
|
||||
$cli->shouldReceive('run')->once()->with('brew list | grep php70')->andReturn('php70-mcrypt
|
||||
$cli->shouldReceive('run')->once()->with('sudo -u '.user().' brew list | grep php70')->andReturn('php70-mcrypt
|
||||
php70');
|
||||
swap(CommandLine::class, $cli);
|
||||
$this->assertTrue(resolve(Brew::class)->installed('php70'));
|
||||
@@ -45,17 +45,17 @@ public function test_installed_returns_true_when_given_formula_is_installed()
|
||||
public function test_installed_returns_false_when_given_formula_is_not_installed()
|
||||
{
|
||||
$cli = Mockery::mock(CommandLine::class);
|
||||
$cli->shouldReceive('run')->once()->with('brew list | grep php70')->andReturn('');
|
||||
$cli->shouldReceive('run')->once()->with('sudo -u '.user().' brew list | grep php70')->andReturn('');
|
||||
swap(CommandLine::class, $cli);
|
||||
$this->assertFalse(resolve(Brew::class)->installed('php70'));
|
||||
|
||||
$cli = Mockery::mock(CommandLine::class);
|
||||
$cli->shouldReceive('run')->once()->with('brew list | grep php70')->andReturn('php70-mcrypt');
|
||||
$cli->shouldReceive('run')->once()->with('sudo -u '.user().' brew list | grep php70')->andReturn('php70-mcrypt');
|
||||
swap(CommandLine::class, $cli);
|
||||
$this->assertFalse(resolve(Brew::class)->installed('php70'));
|
||||
|
||||
$cli = Mockery::mock(CommandLine::class);
|
||||
$cli->shouldReceive('run')->once()->with('brew list | grep php70')->andReturn('php70-mcrypt
|
||||
$cli->shouldReceive('run')->once()->with('sudo -u '.user().' brew list | grep php70')->andReturn('php70-mcrypt
|
||||
php70-something-else
|
||||
php7');
|
||||
swap(CommandLine::class, $cli);
|
||||
|
||||
Reference in New Issue
Block a user