本文整理汇总了PHP中Feedback::load方法的典型用法代码示例。如果您正苦于以下问题:PHP Feedback::load方法的具体用法?PHP Feedback::load怎么用?PHP Feedback::load使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Feedback
的用法示例。
在下文中一共展示了Feedback::load方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: testLoadExistent
/**
* test #9.
* Loading a valid, existing key overrides all the attributes with the
* loaded values. The load() function returns true, indicating that
* data was found.
* @depends testSaveEmptyObject
* @depends testSetAttributes
*/
public function testLoadExistent()
{
global $testTripId1, $testReferenceId1, $testUserId1;
global $testTripId2, $testReferenceId2, $testUserId2;
// create a first instance
$object = new Feedback($testTripId1, $testReferenceId1, $testUserId1);
$object->setType("like");
$object->setDeleted('Y');
$object->save();
$this->assertEquals(1, $this->countTestRows());
// Get the automatically created attributes for this instance
$created1 = $object->getCreated();
$updated1 = $object->getUpdated();
$hash1 = $object->getHash();
// create a second instance
$object = new Feedback($testTripId2, $testReferenceId2, $testUserId2);
$object->setType("hugs");
$object->setDeleted('N');
$object->save();
$this->assertEquals(2, $this->countTestRows());
// Get the automatically created attributes for this instance, and
// make sure they are different from those of the first instance.
$created2 = $object->getCreated();
$updated2 = $object->getUpdated();
$hash2 = $object->getHash();
$this->assertNotEquals($created1, $created2);
$this->assertNotEquals($updated1, $updated2);
$this->assertNotEquals($hash1, $hash2);
// Load the first object, which overrides all the attributes
$this->assertTrue($object->load($testTripId1, $testReferenceId1, $testUserId1));
$this->assertEquals($testTripId1, $object->getTripId());
$this->assertEquals($testReferenceId1, $object->getReferenceId());
$this->assertEquals($testUserId1, $object->getUserId());
$this->assertEquals($created1, $object->getCreated());
$this->assertEquals($updated1, $object->getUpdated());
$this->assertEquals('like', $object->getType());
$this->assertEquals('Y', $object->getDeleted());
$this->assertEquals($hash1, $object->getHash());
// Load the second object, which overrides all the attributes
$this->assertTrue($object->load($testTripId2, $testReferenceId2, $testUserId2));
$this->assertEquals($testTripId2, $object->getTripId());
$this->assertEquals($testReferenceId2, $object->getReferenceId());
$this->assertEquals($testUserId2, $object->getUserId());
$this->assertEquals($created2, $object->getCreated());
$this->assertEquals($updated2, $object->getUpdated());
$this->assertEquals('hugs', $object->getType());
$this->assertEquals('N', $object->getDeleted());
$this->assertEquals($hash2, $object->getHash());
}