public function testParameters()
 {
     $table11 = Table11Peer::getTableMap();
     $this->assertEquals(count($table11->getColumns()), 3, 'Sortable adds one columns by default');
     $this->assertTrue(method_exists('Table11', 'getRank'), 'Sortable adds a rank column by default');
     $table12 = Table12Peer::getTableMap();
     $this->assertEquals(count($table12->getColumns()), 4, 'Sortable does not add a column when it already exists');
     $this->assertTrue(method_exists('Table12', 'getPosition'), 'Sortable allows customization of rank_column name');
 }
 protected function getFixturesArray()
 {
     $c = new Criteria();
     $c->addAscendingOrderByColumn(Table11Peer::RANK_COL);
     $ts = Table11Peer::doSelect($c);
     $ret = array();
     foreach ($ts as $t) {
         $ret[$t->getRank()] = $t->getTitle();
     }
     return $ret;
 }
 public function testPreDeleteFkScope()
 {
     $this->populateFkScopeTable();
     $t = Table11Peer::retrieveByRank(2);
     $t->delete();
     $expected = array(1 => 'row7', 2 => 'row8', 3 => 'row9', 4 => 'row4', 5 => 'row5', 6 => 'row6');
     $this->assertEquals($expected, $this->getFixturesArrayWithFkScope(), 'delete() moves related objects to the end of null scope');
     $s = Table11Peer::retrieveByRank(1);
     $expected = array(1 => 'row1', 2 => 'row2', 3 => 'row3');
     $this->assertEquals($expected, $this->getFixturesArrayWithFkScope($s->getId()), 'delete() leaves other suites unchanged');
 }
 public function testDoSelectOrderByRank()
 {
     $objects = Table11Peer::doSelectOrderByRank();
     $oldRank = 0;
     while ($object = array_shift($objects)) {
         $this->assertTrue($object->getRank() > $oldRank);
         $oldRank = $object->getRank();
     }
     $objects = Table11Peer::doSelectOrderByRank(null, Criteria::DESC);
     $oldRank = 10;
     while ($object = array_shift($objects)) {
         $this->assertTrue($object->getRank() < $oldRank);
         $oldRank = $object->getRank();
     }
 }
 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');
 }