Esempio n. 1
0
 /**
  * @dataProvider dateTimeFilterWithExceptionDataProvider
  */
 public function testFilterWithException($inputData)
 {
     $this->setExpectedException('\\Exception');
     $localeMock = $this->getMock('\\Magento\\Framework\\Stdlib\\DateTime\\TimezoneInterface');
     $localeMock->expects($this->once())->method('getDateFormat')->with(\IntlDateFormatter::SHORT)->will($this->returnValue('MM-dd-yyyy'));
     $model = new DateTime($localeMock);
     $model->filter($inputData);
 }
Esempio n. 2
0
 public function testFilter()
 {
     $localeMock = $this->getMock('\\Magento\\Framework\\Stdlib\\DateTime\\TimezoneInterface');
     $localeMock->expects($this->once())->method('getDateTimeFormat')->with(\IntlDateFormatter::SHORT)->will($this->returnValue('HH:mm:ss MM-dd-yyyy'));
     $model = new DateTime($localeMock);
     // Check that datetime is converted to 'yyyy-MM-dd HH:mm:ss' format
     $this->assertEquals('2241-12-31 23:59:53', $model->filter('23:59:53 12-31-2241'));
 }