Beispiel #1
0
 protected function populateTable11()
 {
     SortableTable11TableMap::doDeleteAll();
     $t1 = new SortableTable11();
     $t1->setRank(1);
     $t1->setTitle('row1');
     $t1->save();
     $t2 = new SortableTable11();
     $t2->setRank(4);
     $t2->setTitle('row4');
     $t2->save();
     $t3 = new SortableTable11();
     $t3->setRank(2);
     $t3->setTitle('row2');
     $t3->save();
     $t4 = new SortableTable11();
     $t4->setRank(3);
     $t4->setTitle('row3');
     $t4->save();
 }
 public function testInsertAtTop()
 {
     $t = new Table11();
     $t->setTitle('new');
     $t->insertAtTop();
     $this->assertEquals(1, $t->getRank(), 'insertAtTop() sets the position to 1');
     $this->assertTrue($t->isNew(), 'insertAtTop() doesn\'t save the object');
     $t->save();
     $expected = array(1 => 'new', 2 => 'row1', 3 => 'row2', 4 => 'row3', 5 => 'row4');
     $this->assertEquals($expected, $this->getFixturesArray(), 'insertAtTop() shifts the entire suite');
 }