Exemple #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);
 }
Exemple #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);
 }
Exemple #3
0
 public function testFormatTime()
 {
     $time = date('M j, Y g:m:s A');
     $date1 = new \Magento\Framework\Stdlib\DateTime\Date(1347260470, null, $this->locale);
     $date2 = new \Magento\Framework\Stdlib\DateTime\Date(strtotime($time), null, $this->locale);
     $this->dateFactory->expects($this->at(0))->method('create')->with(['date' => 1347260470, 'part' => null, 'locale' => $this->locale])->will($this->returnValue($date1));
     $this->dateFactory->expects($this->at(1))->method('create')->will($this->returnValue($date2));
     $this->dateFactory->expects($this->exactly(2))->method('create');
     $this->markTestIncomplete('MAGETWO-26166');
     $this->locale->staticExpects($this->at(0))->method('getTranslation')->with('medium', 'time', $this->locale)->will($this->returnValue('h:mm:ss a'));
     $this->locale->staticExpects($this->at(1))->method('getTranslation')->with('medium', 'time', $this->locale)->will($this->returnValue('h:mm:ss a'));
     $this->locale->staticExpects($this->at(2))->method('getTranslation')->with('medium', 'date', $this->locale)->will($this->returnValue('MMM d, y'));
     $this->locale->staticExpects($this->at(3))->method('getTranslation')->with('medium', 'time', $this->locale)->will($this->returnValue('h:mm:ss a'));
     $this->locale->staticExpects($this->exactly(4))->method('getTranslation');
     $this->assertSame('10 September 2012', $this->timezone->formatTime('10 September 2012', 'wrong_type'));
     $this->assertSame('12:01:10 AM', $this->timezone->formatTime('September 10, 2012 12:01:10 AM', 'medium'));
     $this->assertSame('12:01:10 AM', $this->timezone->formatTime($date1, 'medium'));
     $this->assertSame($time, $this->timezone->formatTime(null, 'medium', true));
 }