public function testGetMaxRank()
 {
     $this->assertEquals(4, Table12Peer::getMaxRank(1), 'getMaxRank() returns the maximum rank of the suite');
     $this->assertEquals(2, Table12Peer::getMaxRank(2), 'getMaxRank() returns the maximum rank of the suite');
     $t4 = Table12Peer::retrieveByRank(4, 1);
     $t4->delete();
     $this->assertEquals(3, Table12Peer::getMaxRank(1), 'getMaxRank() returns the maximum rank');
     Table12Peer::doDeleteAll();
     $this->assertNull(Table12Peer::getMaxRank(1), 'getMaxRank() returns null for empty tables');
 }
 public function testPreInsert()
 {
     Table12Peer::doDeleteAll();
     $t1 = new Table12();
     $t1->setScopeValue(1);
     $t1->save();
     $this->assertEquals($t1->getRank(), 1, 'Sortable inserts new line in first position if no row present');
     $t2 = new Table12();
     $t2->setScopeValue(1);
     $t2->save();
     $this->assertEquals($t2->getRank(), 2, 'Sortable inserts new line in last position');
     $t2 = new Table12();
     $t2->setScopeValue(2);
     $t2->save();
     $this->assertEquals($t2->getRank(), 1, 'Sortable inserts new line in last position');
 }
コード例 #3
0
 protected function populateTable12()
 {
     /* List used for tests
     		 scope=1   scope=2
     		 row1      row5
     		 row2      row6
     		 row3
     		 row4
     		*/
     Table12Peer::doDeleteAll();
     $t1 = new Table12();
     $t1->setRank(1);
     $t1->setScopeValue(1);
     $t1->setTitle('row1');
     $t1->save();
     $t2 = new Table12();
     $t2->setRank(4);
     $t2->setScopeValue(1);
     $t2->setTitle('row4');
     $t2->save();
     $t3 = new Table12();
     $t3->setRank(2);
     $t3->setScopeValue(1);
     $t3->setTitle('row2');
     $t3->save();
     $t4 = new Table12();
     $t4->setRank(1);
     $t4->setScopeValue(2);
     $t4->setTitle('row5');
     $t4->save();
     $t5 = new Table12();
     $t5->setRank(3);
     $t5->setScopeValue(1);
     $t5->setTitle('row3');
     $t5->save();
     $t6 = new Table12();
     $t6->setRank(2);
     $t6->setScopeValue(2);
     $t6->setTitle('row6');
     $t6->save();
 }