public function testPopulateDataExistingFile() { $path = __DIR__ . '/bar/'; mkdir($path); $output = array('foo' => 2, 'bar' => 3); file_put_contents($path . 'foo.json', json_encode($output)); $this->config->shouldReceive('getStoragePath')->once()->andReturn($path)->shouldReceive('getOption')->once()->andReturn('foo'); $this->assertEquals($this->config->populateData(array('foo' => 'something', 'bar' => 'something')), $output); unlink($path . 'foo.json'); rmdir($path); }