當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Dao::expects方法代碼示例

本文整理匯總了PHP中Dao::expects方法的典型用法代碼示例。如果您正苦於以下問題:PHP Dao::expects方法的具體用法?PHP Dao::expects怎麽用?PHP Dao::expects使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Dao的用法示例。


在下文中一共展示了Dao::expects方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: testGettingReferenceCachesTheReference

 /**
  * @covers Dao::getReference
  */
 public function testGettingReferenceCachesTheReference()
 {
     $reference = $this->getMockForAbstractClass('BasicDaoReference', array(), '', false);
     $this->dao->expects($this->once())->method('getUserReference')->will($this->returnValue($reference));
     self::assertEquals($reference, $this->dao->getReference('user'));
     self::assertEquals($reference, $this->dao->getReference('user'));
 }
開發者ID:enyo,項目名稱:rincewind,代碼行數:10,代碼來源:Dao.ReferenceTest.php

示例2: testReferenceGetsByIdIfPresentDataIsInt

 /**
  * @covers DaoToOneReference::getReferenced
  */
 public function testReferenceGetsByIdIfPresentDataIsInt()
 {
     $this->getMockForAbstractClass('Dao', array('createDao'), 'BBB_NotAbstractDao2', false);
     $this->dao = $this->getMock('BBB_NotAbstractDao2', array('getRecordFromData'), array(), '', false);
     $this->record->expects($this->once())->method('getDirectly')->with('address')->will($this->returnValue(123));
     $this->dao->expects($this->once())->method('getRecordFromData')->with(array('id' => 123), true, false)->will($this->returnValue('RECORD'));
     $reference = new DaoToOneReference($this->dao, 'localKey', 'foreignKey');
     self::assertSame('RECORD', $reference->getReferenced($this->record, 'address'));
 }
開發者ID:enyo,項目名稱:rincewind,代碼行數:12,代碼來源:DaoToOneReferenceTest.php

示例3: testRecordCallsLoadIfAnAttributeWasNotSetYet

 public function testRecordCallsLoadIfAnAttributeWasNotSetYet()
 {
     $record = new Record(array('id' => 4), $this->dao, TRUE);
     $this->dao->expects($this->any())->method('getAttributes')->will($this->returnValue(array('id' => Dao::INT, 'name' => Dao::STRING)));
     $this->dao->expects($this->once())->method('getData')->with(array('id' => 4))->will($this->returnValue(array('id' => 4, 'name' => 'Test')));
     self::assertEquals('Test', $record->get('name'));
     self::assertEquals('Test', $record->get('name'));
     // Checking it doesn't load twice
 }
開發者ID:enyo,項目名稱:rincewind,代碼行數:9,代碼來源:Record.LazyLoading.php


注:本文中的Dao::expects方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。