Exemplo n.º 1
0
 /**
  * @throws FileFormatNotParsable
  * @throws FileNotReadable
  *
  * @param string $pathToFile
  */
 private function addSettingsFromPath($pathToFile)
 {
     $arrayableFile = $this->arrayableFileFactory->getArrayableFileFromPath($pathToFile);
     $fileContentsAsArray = $arrayableFile->toArray();
     $config = new ConfigTree($fileContentsAsArray);
     $this->configTreeToReturn = $this->configTreeToReturn->withAnotherConfigTreeMergedIn($config);
 }
 /**
  * @dataProvider provideFilenames
  *
  * @param string $filename
  * @param string $errorMessage
  */
 public function testReadingFileContents($filename, $errorMessage)
 {
     // ARRANGE
     $arrayableFileFactory = new ArrayableFileFactory();
     $arrayableFile = $arrayableFileFactory->getArrayableFileFromPath(TEST_DIR . '/fixtures/file_formats/' . $filename);
     $expectedArray = ['node1' => ['node2' => 'value']];
     // ACT
     $arrayReadFromFile = $arrayableFile->toArray();
     // ASSERT
     $this->assertEquals($expectedArray, $arrayReadFromFile, $errorMessage);
 }