function it_can_be_converted_to_an_array(FileContentsRetriever $fileContentsRetriever, YamlParser $yamlParser) { $fileContents = "node1:\n node2: value"; $fileContentsRetriever->fileGetContents('file-path.yaml')->willReturn($fileContents); $yamlParser->parse($fileContents)->willReturn(['node1' => ['node2' => 'value']]); $this->toArray()->shouldReturn(['node1' => ['node2' => 'value']]); }
function it_can_be_converted_to_an_array(FileContentsRetriever $fileContentsRetriever) { $fileContents = 'node1[node2] = value'; $fileContentsRetriever->fileGetContents('file-path.ini')->willReturn($fileContents); $this->toArray()->shouldReturn(['node1' => ['node2' => 'value']]); }
/** * @return array */ public function toArray() { $fileContents = $this->fileContentsRetriever->fileGetContents($this->path); return $this->yamlParser->parse($fileContents); }
/** * @expectedException \ConfigTree\Exception\FileNotReadable */ public function testGetExceptionForUnreadableFiles() { $fileContentsRetriever = new FileContentsRetriever(); $fileContentsRetriever->fileGetContents($this->unreadableFile); }
/** * @return array */ public function toArray() { $fileContents = $this->fileContentsRetriever->fileGetContents($this->path); return parse_ini_string($fileContents); }
/** * @return array */ public function toArray() { $fileContents = $this->fileContentsRetriever->fileGetContents($this->path); return json_decode($fileContents, true); }