Skip to content

Commit

Permalink
Mock filesystem in test
Browse files Browse the repository at this point in the history
  • Loading branch information
cpriego committed Apr 22, 2017
1 parent c0eb2e4 commit 66db0f6
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions tests/Integration/DnsMasqTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,12 +29,12 @@ public function tearDown()

public function test_install_calls_the_right_methods_and_restarts()
{
$files = Mockery::mock(CommandLine::class);
$cli = Mockery::mock(Filesystem::class);
$cli = Mockery::mock(CommandLine::class);
$files = Mockery::mock(Filesystem::class);
$sm = Mockery::mock(ServiceManager::class);
$pm = Mockery::mock(PackageManager::class);

$dnsMasq = Mockery::mock(DnsMasq::class.'[dnsmasqSetup,createCustomConfigFile]', [$pm, $sm, $cli, $files]);
$dnsMasq = Mockery::mock(DnsMasq::class.'[dnsmasqSetup,createCustomConfigFile]', [$pm, $sm, $files, $cli]);

$dnsMasq->shouldReceive('dnsmasqSetup')->once();
$dnsMasq->shouldReceive('createCustomConfigFile')->once()->with('dev');
Expand All @@ -47,6 +47,7 @@ public function test_dnsmasqSetup_correctly_installs_and_configures_dnsmasq_cont
$pm = Mockery::mock(PackageManager::class);
$pm->shouldReceive('ensureInstalled')->once()->with('dnsmasq');
$sm = Mockery::mock(ServiceManager::class);
$files = Mockery::mock(Filesystem::class);

swap(PackageManager::class, $pm);
swap(ServiceManager::class, $sm);
Expand Down

0 comments on commit 66db0f6

Please sign in to comment.