public function testRetrieveByRank() { $t = Table11Peer::retrieveByRank(5); $this->assertNull($t, 'retrieveByRank() returns null for an unknown rank'); $t3 = Table11Peer::retrieveByRank(3); $this->assertEquals(3, $t3->getRank(), 'retrieveByRank() returns the object with the required rank'); $this->assertEquals('row3', $t3->getTitle(), 'retrieveByRank() returns the object with the required rank'); }
public function testRemoveFromList() { $t2 = Table11Peer::retrieveByRank(2); $res = $t2->removeFromList(); $this->assertTrue($res instanceof Table11, 'removeFromList() returns the current object'); $this->assertNull($res->getRank(), 'removeFromList() resets the object\'s rank'); Table11Peer::clearInstancePool(); $expected = array(1 => 'row1', 2 => 'row2', 3 => 'row3', 4 => 'row4'); $this->assertEquals($expected, $this->getFixturesArray(), 'removeFromList() does not change the list until the object is saved'); $t2->save(); Table11Peer::clearInstancePool(); $expected = array(null => 'row2', 1 => 'row1', 2 => 'row3', 3 => 'row4'); $this->assertEquals($expected, $this->getFixturesArray(), 'removeFromList() changes the list once the object is saved'); }