public function testRetrieveByRank() { $t = SortableTable12Query::retrieveByRank(5, 1); $this->assertNull($t, 'retrieveByRank() returns null for an unknown rank'); $t3 = SortableTable12Query::retrieveByRank(3, 1); $this->assertEquals(3, $t3->getRank(), 'retrieveByRank() returns the object with the required rank in the required suite'); $this->assertEquals('row3', $t3->getTitle(), 'retrieveByRank() returns the object with the required rank in the required suite'); $t6 = SortableTable12Query::retrieveByRank(2, 2); $this->assertEquals(2, $t6->getRank(), 'retrieveByRank() returns the object with the required rank in the required suite'); $this->assertEquals('row6', $t6->getTitle(), 'retrieveByRank() returns the object with the required rank in the required suite'); }
public function testRemoveFromList() { $t2 = SortableTable12Query::retrieveByRank(2, 1); $res = $t2->removeFromList(); $this->assertTrue($res instanceof Table12, 'removeFromList() returns the current object'); $this->assertNull($res->getRank(), 'removeFromList() resets the object\'s rank'); SortableTable12TableMap::clearInstancePool(); $expected = array(1 => 'row1', 2 => 'row2', 3 => 'row3', 4 => 'row4'); $this->assertEquals($expected, $this->getFixturesArrayWithScope(1), 'removeFromList() does not change the list until the object is saved'); $t2->save(); SortableTable12TableMap::clearInstancePool(); $expected = array(1 => 'row1', 2 => 'row3', 3 => 'row4'); $this->assertEquals($expected, $this->getFixturesArrayWithScope(1), 'removeFromList() changes the list once the object is saved'); $expected = array(1 => 'row5', 2 => 'row6'); $this->assertEquals($expected, $this->getFixturesArrayWithScope(2), 'removeFromList() leaves other suites unchanged'); }
/** * @expectedException Propel\Runtime\Exception\PropelException */ public function testRemoveFromListNoScope() { $t2 = SortableTable12Query::retrieveByRank(2); $t2->removeFromList(); }