public function testFilter()
 {
     $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 Date($localeMock);
     // Check that date is converted to 'yyyy-MM-dd' format
     $this->assertEquals('2241-12-31', $model->filter('12-31-2241'));
 }
Exemple #2
0
 /**
  * @dataProvider dateFilterWithExceptionDataProvider
  */
 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 Date($localeMock);
     $model->filter($inputData);
 }