コード例 #1
0
ファイル: TripTest.php プロジェクト: egrivel/vacationblog
 /**
  * Extra test. Different trips can have different values for the same
  * attribute.
  * @depends testSetAttributes
  * @depends testSaveEmptyObject
  * @depends testLoadExistent
  * @depends testSetAttributeValues
  */
 public function testSetAttributesOnSeparateTrips()
 {
     global $testTripId1;
     global $testTripId2;
     // Setting attributes for first trip
     $object = new Trip($testTripId1);
     $object->setName("Trip Name 1");
     $object->save();
     $object->setAttribute("attrib1", "value1");
     $object->setAttribute("attrib2", "value2");
     $this->assertEquals("value1", $object->getAttribute("attrib1"));
     $this->assertEquals("value2", $object->getAttribute("attrib2"));
     // Setting attributes for second trip
     $object = new Trip($testTripId2);
     $object->setName("Trip Name 2");
     $object->save();
     $object->setAttribute("attrib1", "value3");
     $object->setAttribute("attrib2", "value4");
     $this->assertEquals("value3", $object->getAttribute("attrib1"));
     $this->assertEquals("value4", $object->getAttribute("attrib2"));
     $object = new Trip($testTripId1);
     $this->assertEquals("value1", $object->getAttribute("attrib1"));
     $this->assertEquals("value2", $object->getAttribute("attrib2"));
     $object = new Trip($testTripId2);
     $this->assertEquals("value3", $object->getAttribute("attrib1"));
     $this->assertEquals("value4", $object->getAttribute("attrib2"));
 }