本文整理匯總了PHP中DateTime::expects方法的典型用法代碼示例。如果您正苦於以下問題:PHP DateTime::expects方法的具體用法?PHP DateTime::expects怎麽用?PHP DateTime::expects使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類DateTime
的用法示例。
在下文中一共展示了DateTime::expects方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: setUpCommon
/**
* Common testcase constructor parts.
*
* @return void
*/
private function setUpCommon()
{
$this->reflection = new ReflectionClass('Lunr\\Ticks\\FileTimer');
$this->file = $this->getMockBuilder('\\SplFileObject')->setConstructorArgs([tempnam('/tmp', 'tick')])->getMock();
$this->datetime = $this->getMock('Lunr\\Core\\DateTime');
$this->datetime->expects($this->once())->method('set_datetime_format')->with('%Y-%m-%d %H:%M:%S');
}
示例2: testLogReturnsStringWhenObjectPassedAsMessage
/**
* Test that log() returns a string when an object is passed as message.
*
* @covers Lunr\Feedback\PHPLogger::log
*/
public function testLogReturnsStringWhenObjectPassedAsMessage()
{
$object = new MockLogMessage();
$this->datetime->expects($this->once())->method('get_datetime')->will($this->returnValue(self::DATETIME_STRING));
$this->fao->expects($this->once())->method('put_file_content')->with($this->equalTo($this->filename), $this->equalTo("[2011-11-10 10:30:22]: WARNING: Foo\n"), $this->equalTo(TRUE));
$this->class->log(LogLevel::WARNING, $object);
}