Example #1
0
 public function saveInstanceToFile($template, $to_filename, $replacements = array(), $delete_template = false)
 {
     $content = self::createInstance($template, $replacements);
     Pfw_Script_FileSystem::createFileWithContents($to_filename, $content);
     if ($delete_template) {
         Pfw_Script_FileSystem::unlink($template);
     }
 }
 function testFileCopy($test = true)
 {
     $file = '/tmp/mypfwtestdir/recursive/text.txt';
     $new_file = '/tmp/mypfwtestdir/text.txt';
     $contents = "hello world";
     Pfw_Script_FileSystem::createFileWithContents($file, $contents);
     if ($test) {
         Pfw_Script_FileSystem::fileCopy($file, $new_file);
         $this->assertTrue(file_exists($file));
         $this->assertTrue(file_exists($new_file));
         $this->assertEquals($contents, file_get_contents($new_file));
     }
 }