/** * @test */ public function writeLocalConfigurationWritesSortedContentToConfigurationFile() { $configurationFile = PATH_site . 'typo3temp/var/tests/' . $this->getUniqueId('localConfiguration'); if (!is_file($configurationFile)) { if (!($fh = fopen($configurationFile, 'wb'))) { $this->markTestSkipped('Can not create file ' . $configurationFile . '. Please check your write permissions.'); } fclose($fh); } if (!@is_file($configurationFile)) { throw new \RuntimeException('File ' . $configurationFile . ' could not be found. Please check your write permissions', 1346364362); } $this->testFilesToDelete[] = $configurationFile; $this->subject->expects($this->any())->method('getLocalConfigurationFileLocation')->will($this->returnValue($configurationFile)); $pairs = array('foo' => 42, 'bar' => 23); $expectedContent = '<?php' . LF . 'return [' . LF . ' \'bar\' => 23,' . LF . ' \'foo\' => 42,' . LF . '];' . LF; $this->subject->writeLocalConfiguration($pairs); $this->assertSame($expectedContent, file_get_contents($configurationFile)); }