本文整理汇总了PHP中Datetime::getValue方法的典型用法代码示例。如果您正苦于以下问题:PHP Datetime::getValue方法的具体用法?PHP Datetime::getValue怎么用?PHP Datetime::getValue使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Datetime
的用法示例。
在下文中一共展示了Datetime::getValue方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: testGetValueWhenDateCannotBeRepresentedUsingIso8601
public function testGetValueWhenDateCannotBeRepresentedUsingIso8601()
{
$attributeValue = '11-11-2011';
$dateFormat = 'dd-mm-yyyy';
$object = new \Magento\Framework\Object(['datetime' => $attributeValue]);
$this->localeDateMock->expects($this->once())->method('getDateFormat')->with(\Magento\Framework\Stdlib\DateTime\TimezoneInterface::FORMAT_TYPE_MEDIUM)->will($this->returnValue($dateFormat));
$this->attributeMock->expects($this->any())->method('getData')->with('frontend_input')->will($this->returnValue('text'));
$dateMock = $this->getMock('\\Magento\\Framework\\Stdlib\\DateTime\\DateInterface');
$dateMock->expects($this->once())->method('toString')->with($dateFormat)->will($this->returnValue($attributeValue));
$this->localeDateMock->expects($this->at(1))->method('date')->will($this->throwException(new \Exception('Wrong Date')));
$this->localeDateMock->expects($this->at(2))->method('date')->with($attributeValue, null, null, false)->will($this->returnValue($dateMock));
$this->assertEquals($attributeValue, $this->model->getValue($object));
}