Пример #1
0
 protected function setUp()
 {
     $this->_generationDirectory = rtrim(self::GENERATION_DIRECTORY, self::DIRECTORY_SEPARATOR) . self::DIRECTORY_SEPARATOR;
     $this->_ioObjectMock = $this->getMock('Varien_Io_File', array('dirsep', 'isWriteable', 'mkdir', 'fileExists', 'write'));
     $this->_ioObjectMock->expects($this->any())->method('dirsep')->will($this->returnValue(self::DIRECTORY_SEPARATOR));
     $this->_autoLoaderMock = $this->getMock('Magento_Autoload_IncludePath', array('getFilePath'), array(), '', false);
     $this->_autoLoaderMock->staticExpects($this->any())->method('getFilePath')->with(self::CLASS_NAME)->will($this->returnValue(self::CLASS_FILE_NAME));
     $this->_object = new Magento_Di_Generator_Io($this->_ioObjectMock, $this->_autoLoaderMock, self::GENERATION_DIRECTORY);
 }
Пример #2
0
 /**
  * @expectedException Magento_Exception
  */
 public function testGenerateClassWithError()
 {
     $this->_autoloader->staticExpects($this->once())->method('getFile')->will($this->returnValue(false));
     $this->_generator->expects($this->once())->method('generate')->will($this->returnValue(false));
     $this->_model = new Magento_Di_Generator($this->_generator, $this->_autoloader);
     $expectedEntities = array_values($this->_expectedEntities);
     $resultClassName = self::SOURCE_CLASS . ucfirst(array_shift($expectedEntities));
     $this->_model->generateClass($resultClassName);
 }