Exemplo n.º 1
0
 protected function setUp()
 {
     $this->_generationDirectory = rtrim(self::GENERATION_DIRECTORY, '/') . '/';
     $this->_filesystemDriverMock = $this->getMock('Magento\\Framework\\Filesystem\\Driver\\File', array('isWritable', 'filePutContents', 'createDirectory', 'isExists'), array());
     $this->_autoLoaderMock = $this->getMock('Magento\\Framework\\Autoload\\IncludePath', array('getFilePath'), array(), '', false);
     $this->_autoLoaderMock->expects($this->any())->method('getFilePath')->with(self::CLASS_NAME)->will($this->returnValue(self::CLASS_FILE_NAME));
     $this->_object = new \Magento\Framework\Code\Generator\Io($this->_filesystemDriverMock, $this->_autoLoaderMock, self::GENERATION_DIRECTORY);
 }
Exemplo n.º 2
0
 /**
  * @expectedException \Magento\Framework\Exception
  */
 public function testGenerateClassWithError()
 {
     $this->autoloader->expects($this->once())->method('getFile')->will($this->returnValue(false));
     $this->model = new \Magento\Framework\Code\Generator($this->autoloader, $this->ioObjectMock, array('factory' => '\\Magento\\Framework\\ObjectManager\\Code\\Generator\\Factory', 'proxy' => '\\Magento\\Framework\\ObjectManager\\Code\\Generator\\Proxy', 'interceptor' => '\\Magento\\Framework\\Interception\\Code\\Generator\\Interceptor'));
     $expectedEntities = array_values($this->expectedEntities);
     $resultClassName = self::SOURCE_CLASS . ucfirst(array_shift($expectedEntities));
     $this->model->generateClass($resultClassName);
 }