Example #1
0
 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']]);
 }
Example #2
0
 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']]);
 }
Example #3
0
 /**
  * @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);
 }
Example #5
0
 /**
  * @return array
  */
 public function toArray()
 {
     $fileContents = $this->fileContentsRetriever->fileGetContents($this->path);
     return parse_ini_string($fileContents);
 }
Example #6
0
 /**
  * @return array
  */
 public function toArray()
 {
     $fileContents = $this->fileContentsRetriever->fileGetContents($this->path);
     return json_decode($fileContents, true);
 }