public function testGetMaxRank() { $this->assertEquals(4, Table11Peer::getMaxRank(), 'getMaxRank() returns the maximum rank'); $t4 = Table11Peer::retrieveByRank(4); $t4->delete(); $this->assertEquals(3, Table11Peer::getMaxRank(), 'getMaxRank() returns the maximum rank'); Table11Peer::doDeleteAll(); $this->assertNull(Table11Peer::getMaxRank(), 'getMaxRank() returns null for empty tables'); }
public function testPreInsert() { Table11Peer::doDeleteAll(); $t1 = new Table11(); $t1->save(); $this->assertEquals($t1->getRank(), 1, 'Sortable inserts new line in first position if no row present'); $t2 = new Table11(); $t2->setTitle('row2'); $t2->save(); $this->assertEquals($t2->getRank(), 2, 'Sortable inserts new line in last position'); }
protected function populateTable11() { Table11Peer::doDeleteAll(); $t1 = new Table11(); $t1->setRank(1); $t1->setTitle('row1'); $t1->save(); $t2 = new Table11(); $t2->setRank(4); $t2->setTitle('row4'); $t2->save(); $t3 = new Table11(); $t3->setRank(2); $t3->setTitle('row2'); $t3->save(); $t4 = new Table11(); $t4->setRank(3); $t4->setTitle('row3'); $t4->save(); }