public function testShouldWriteContentToFileWhenNotExists()
 {
     $content = sha1(microtime());
     $path = TESTS_ROOT_DIR . DIRECTORY_SEPARATOR . 'fixtures' . DIRECTORY_SEPARATOR . 'test.tmp';
     $this->assertGreaterThan(0, FileWriter::write($path, $content, true));
     unlink($path);
 }
Beispiel #2
0
 public function dump($inputDirectory, $outputDirectory)
 {
     $modulesList = [];
     $directoryIterator = new \DirectoryIterator($inputDirectory);
     foreach ($directoryIterator as $moduleDir) {
         if ($moduleDir->isDot()) {
             continue;
         }
         $moduleSettingFile = $moduleDir->getPathname() . DIRECTORY_SEPARATOR . self::MODULE_SETTINGS_FILE;
         if (!file_exists($moduleSettingFile)) {
             continue;
         }
         $modulesList[$moduleDir->getBasename()] = ['className' => $moduleDir->getBasename() . '\\' . pathinfo(self::MODULE_SETTINGS_FILE, PATHINFO_FILENAME), 'path' => $moduleSettingFile];
     }
     FileWriter::writeObject($outputDirectory . self::MODULE_STATIC_FILE, $modulesList, true);
     return $modulesList;
 }