Пример #1
0
 /**
  * @param ClassGenerator $phpClass
  * @return string
  */
 public static function saveClass($phpClass)
 {
     $tempDirectory = sys_get_temp_dir();
     $fileInstance = new File($tempDirectory);
     self::$fileWriter = self::$fileWriter ?: (self::$fileWriter = new FileWriter());
     self::$fileWriter->setFile($fileInstance);
     return self::$fileWriter->generate($phpClass);
 }
Пример #2
0
 /**
  * @expectedException \Vegas\ODM\Proxy\Generator\File\Exception\FileNotWritableException
  */
 public function testPathNotWritable()
 {
     $classGenerator = new ClassGenerator('test', 'Test\\Model');
     $file = new File('/root');
     $writer = new File\Writer();
     $writer->setFile($file);
     $path = $writer->generate($classGenerator);
     $this->assertTrue(file_exists($path));
 }