protected function verifyValidPath($executionMethod, $configMethod) { $this->createModuleMock([]); if ($executionMethod == 'routesFilePath') { $this->module->shouldReceive('getPath')->once()->with($configMethod, '')->passthru(); } else { $this->module->shouldReceive('getPath')->once()->with($configMethod)->passthru(); } $this->config->shouldReceive($configMethod)->once()->with('')->andReturn('routing/file.php'); $this->module->shouldReceive('directory')->once()->withNoArgs()->andReturn('module/dir'); $this->module->shouldReceive('replace')->once()->with('routing/file.php', m::on(function ($arg) { return $arg instanceof Module && $arg->foo() == 'bar'; }))->andReturn('result'); $this->assertSame('module/dir' . DIRECTORY_SEPARATOR . 'result', $this->module->{$executionMethod}('')); }