Permalink
Browse files

[Sortable] Fix tests (constant removed from peer)

  • Loading branch information...
1 parent da95168 commit e6a52e1df92a2db8fc7549fc6a00d0dfb9d36b60 @jaugustin jaugustin committed Jan 12, 2013
@@ -15,14 +15,18 @@
use Propel\Tests\Bookstore\Behavior\ConcreteArticle;
use Propel\Tests\Bookstore\Behavior\ConcreteArticleQuery;
use Propel\Tests\Bookstore\Behavior\ConcreteArticlePeer;
+use Propel\Tests\Bookstore\Behavior\Map\ConcreteArticleTableMap;
use Propel\Tests\Bookstore\Behavior\ConcreteAuthorPeer;
+use Propel\Tests\Bookstore\Behavior\Map\ConcreteAuthorTableMap;
use Propel\Tests\Bookstore\Behavior\ConcreteCategory;
use Propel\Tests\Bookstore\Behavior\ConcreteCategoryQuery;
use Propel\Tests\Bookstore\Behavior\ConcreteContent;
use Propel\Tests\Bookstore\Behavior\ConcreteContentQuery;
use Propel\Tests\Bookstore\Behavior\ConcreteContentPeer;
+use Propel\Tests\Bookstore\Behavior\Map\ConcreteContentTableMap;
use Propel\Tests\Bookstore\Behavior\ConcreteQuizz;
use Propel\Tests\Bookstore\Behavior\ConcreteQuizzPeer;
+use Propel\Tests\Bookstore\Behavior\Map\ConcreteQuizzTableMap;
use Propel\Tests\Bookstore\Behavior\ConcreteQuizzQuery;
use Propel\Runtime\Exception\PropelException;
@@ -107,7 +111,7 @@ public function testModifyTableCopyDataRemovesAutoIncrement()
$content = new ConcreteContent();
$content->save();
$c = new Criteria;
- $c->add(ConcreteArticlePeer::ID, $content->getId());
+ $c->add(ConcreteArticleTableMap::ID, $content->getId());
try {
ConcreteArticlePeer::doInsert($c);
$this->assertTrue(true, 'modifyTable() removed autoIncrement from copied Primary keys');
@@ -122,7 +126,7 @@ public function testModifyTableNoCopyDataKeepsAutoIncrement()
$content = new ConcreteContent();
$content->save();
$c = new Criteria;
- $c->add(ConcreteQuizzPeer::ID, $content->getId());
+ $c->add(ConcreteQuizzTableMap::ID, $content->getId());
ConcreteQuizzPeer::doInsert($c);
}
@@ -12,6 +12,7 @@
use Propel\Tests\Helpers\Bookstore\BookstoreTestBase;
use Propel\Tests\Bookstore\Behavior\Table3Peer;
+use Propel\Tests\Bookstore\Behavior\Map\Table3TableMap;
use Propel\Runtime\Propel;
use Propel\Runtime\ActiveQuery\Criteria;
@@ -37,7 +38,7 @@ public function testStaticMethods()
public function testPreSelect()
{
- $con = Propel::getServiceContainer()->getReadConnection(Table3Peer::DATABASE_NAME);
+ $con = Propel::getServiceContainer()->getReadConnection(Table3TableMap::DATABASE_NAME);
$con->preSelect = 0;
Table3Peer::doSelect(new Criteria, $con);
$this->assertNotEquals($con->preSelect, 0, 'preSelect hook is called in doSelect()');
@@ -59,7 +60,7 @@ public function testPreSelect()
public function testPeerFilter()
{
- Table3Peer::TABLE_NAME;
+ Table3TableMap::TABLE_NAME;
$this->assertTrue(class_exists('Propel\Tests\Bookstore\Behavior\Base\testPeerFilter'),
'peerFilter hook allows complete manipulation of the generated script'
);
@@ -10,6 +10,9 @@
namespace Propel\Tests\Generator\Behavior\Sortable;
+use Propel\Runtime\ActiveQuery\Criteria;
+use SortableTable11 as Table11;
+
/**
* Tests for SortableBehavior class
*
@@ -43,7 +46,7 @@ public function testPreDelete()
$t3->delete();
$this->assertEquals($max - 1, \SortableTable11Peer::getMaxRank(), 'Sortable rearrange subsequent rows on delete');
$c = new Criteria();
- $c->add(\SortableTable11Peer::TITLE, 'row4');
+ $c->add(\Map\SortableTable11TableMap::TITLE, 'row4');
$t4 = \SortableTable11Peer::doSelectOne($c);
$this->assertEquals(3, $t4->getRank(), 'Sortable rearrange subsequent rows on delete');
}
@@ -11,6 +11,7 @@
namespace Propel\Tests\Generator\Behavior\Sortable;
use Propel\Runtime\ActiveQuery\Criteria;
+use SortableTable12 as Table12;
/**
* Tests for SortableBehavior class
@@ -50,7 +51,7 @@ public function testPreDelete()
$t3->delete();
$this->assertEquals($max - 1, \SortableTable12Peer::getMaxRank(1), 'Sortable rearrange subsequent rows on delete');
$c = new Criteria();
- $c->add(\SortableTable12Peer::TITLE, 'row4');
+ $c->add(\Map\SortableTable12TableMap::TITLE, 'row4');
$t4 = \SortableTable12Peer::doSelectOne($c);
$this->assertEquals(3, $t4->getRank(), 'Sortable rearrange subsequent rows on delete');
$expected = array(1 => 'row5', 2 => 'row6');
@@ -28,7 +28,7 @@ public function setUp()
public function testStaticAttributes()
{
- $this->assertEquals(\SortableTable11Peer::RANK_COL, 'table11.SORTABLE_RANK');
+ $this->assertEquals('sortable_table11.SORTABLE_RANK', \Map\SortableTable11TableMap::RANK_COL);
}
public function testGetMaxRank()
@@ -28,8 +28,8 @@ public function setUp()
public function testStaticAttributes()
{
- $this->assertEquals(\SortableTable12Peer::RANK_COL, 'table12.POSITION');
- $this->assertEquals(\SortableTable12Peer::SCOPE_COL, 'table12.MY_SCOPE_COLUMN');
+ $this->assertEquals('sortable_table12.POSITION', \Map\SortableTable12TableMap::RANK_COL);
+ $this->assertEquals('sortable_table12.MY_SCOPE_COLUMN', \Map\SortableTable12TableMap::SCOPE_COL);
}
public function testGetMaxRank()
@@ -57,7 +57,7 @@ public function testRetrieveByRank()
public function testReorder()
{
$c = new Criteria();
- $c->add(\SortableTable12Peer::SCOPE_COL, 1);
+ $c->add(\Map\SortableTable12TableMap::SCOPE_COL, 1);
$objects = \SortableTable12Peer::doSelectOrderByRank($c);
$ids = array();
foreach ($objects as $object) {
@@ -75,15 +75,15 @@ public function testReorder()
public function testDoSelectOrderByRank()
{
$c = new Criteria();
- $c->add(\SortableTable12Peer::SCOPE_COL, 1);
+ $c->add(\Map\SortableTable12TableMap::SCOPE_COL, 1);
$objects = \SortableTable12Peer::doSelectOrderByRank($c);
$oldRank = 0;
while ($object = array_shift($objects)) {
$this->assertTrue($object->getRank() > $oldRank);
$oldRank = $object->getRank();
}
$c = new Criteria();
- $c->add(\SortableTable12Peer::SCOPE_COL, 1);
+ $c->add(\Map\SortableTable12TableMap::SCOPE_COL, 1);
$objects = \SortableTable12Peer::doSelectOrderByRank($c, Criteria::DESC);
$oldRank = 10;
while ($object = array_shift($objects)) {
@@ -10,6 +10,8 @@
namespace Propel\Tests\Generator\Behavior\Sortable;
+use SortableTable11 as Table11;
+
use Propel\Runtime\ActiveQuery\Criteria;
use Propel\Runtime\Collection\ObjectCollection;
@@ -40,15 +42,15 @@ public function testOrderByRank()
$this->assertTrue(\SortableTable11Query::create()->orderByRank() instanceof \SortableTable11Query, 'orderByRank() returns the current query object');
// default order
$query = \SortableTable11Query::create()->orderByRank();
- $expectedQuery = \SortableTable11Query::create()->addAscendingOrderByColumn(\SortableTable11Peer::SORTABLE_RANK);
+ $expectedQuery = \SortableTable11Query::create()->addAscendingOrderByColumn(\Map\SortableTable11TableMap::SORTABLE_RANK);
$this->assertEquals($expectedQuery, $query, 'orderByRank() orders the query by rank asc');
// asc order
$query = \SortableTable11Query::create()->orderByRank(Criteria::ASC);
- $expectedQuery = \SortableTable11Query::create()->addAscendingOrderByColumn(\SortableTable11Peer::SORTABLE_RANK);
+ $expectedQuery = \SortableTable11Query::create()->addAscendingOrderByColumn(\Map\SortableTable11TableMap::SORTABLE_RANK);
$this->assertEquals($expectedQuery, $query, 'orderByRank() orders the query by rank, using the argument as sort direction');
// desc order
$query = \SortableTable11Query::create()->orderByRank(Criteria::DESC);
- $expectedQuery = \SortableTable11Query::create()->addDescendingOrderByColumn(\SortableTable11Peer::SORTABLE_RANK);
+ $expectedQuery = \SortableTable11Query::create()->addDescendingOrderByColumn(\Map\SortableTable11TableMap::SORTABLE_RANK);
$this->assertEquals($expectedQuery, $query, 'orderByRank() orders the query by rank, using the argument as sort direction');
}
@@ -37,11 +37,11 @@ public function testInList()
row4
*/
$query = \SortableTable12Query::create()->inList(1);
- $expectedQuery = \SortableTable12Query::create()->add(\SortableTable12Peer::MY_SCOPE_COLUMN, 1, Criteria::EQUAL);
+ $expectedQuery = \SortableTable12Query::create()->add(\Map\SortableTable12TableMap::MY_SCOPE_COLUMN, 1, Criteria::EQUAL);
$this->assertEquals($expectedQuery, $query, 'inList() filters the query by scope');
$this->assertEquals(4, $query->count(), 'inList() filters the query by scope');
$query = \SortableTable12Query::create()->inList(2);
- $expectedQuery = \SortableTable12Query::create()->add(\SortableTable12Peer::MY_SCOPE_COLUMN, 2, Criteria::EQUAL);
+ $expectedQuery = \SortableTable12Query::create()->add(\Map\SortableTable12TableMap::MY_SCOPE_COLUMN, 2, Criteria::EQUAL);
$this->assertEquals($expectedQuery, $query, 'inList() filters the query by scope');
$this->assertEquals(2, $query->count(), 'inList() filters the query by scope');
}
@@ -66,15 +66,15 @@ public function testOrderByRank()
$this->assertTrue(\SortableTable12Query::create()->orderByRank() instanceof \SortableTable12Query, 'orderByRank() returns the current query object');
// default order
$query = \SortableTable12Query::create()->orderByRank();
- $expectedQuery = \SortableTable12Query::create()->addAscendingOrderByColumn(\SortableTable12Peer::POSITION);
+ $expectedQuery = \SortableTable12Query::create()->addAscendingOrderByColumn(\Map\SortableTable12TableMap::POSITION);
$this->assertEquals($expectedQuery, $query, 'orderByRank() orders the query by rank asc');
// asc order
$query = \SortableTable12Query::create()->orderByRank(Criteria::ASC);
- $expectedQuery = \SortableTable12Query::create()->addAscendingOrderByColumn(\SortableTable12Peer::POSITION);
+ $expectedQuery = \SortableTable12Query::create()->addAscendingOrderByColumn(\Map\SortableTable12TableMap::POSITION);
$this->assertEquals($expectedQuery, $query, 'orderByRank() orders the query by rank, using the argument as sort direction');
// desc order
$query = \SortableTable12Query::create()->orderByRank(Criteria::DESC);
- $expectedQuery = \SortableTable12Query::create()->addDescendingOrderByColumn(\SortableTable12Peer::POSITION);
+ $expectedQuery = \SortableTable12Query::create()->addDescendingOrderByColumn(\Map\SortableTable12TableMap::POSITION);
$this->assertEquals($expectedQuery, $query, 'orderByRank() orders the query by rank, using the argument as sort direction');
}
@@ -10,6 +10,8 @@
namespace Propel\Tests\Generator\Behavior\Sortable;
+use Propel\Runtime\ActiveQuery\Criteria;
+
use Propel\Generator\Util\QuickBuilder;
use Propel\Tests\TestCase as BaseTestCase;
@@ -123,7 +125,7 @@ protected function populateTable12()
protected function getFixturesArray()
{
$c = new Criteria();
- $c->addAscendingOrderByColumn(\SortableTable11Peer::RANK_COL);
+ $c->addAscendingOrderByColumn(\Map\SortableTable11TableMap::RANK_COL);
$ts = \SortableTable11Peer::doSelect($c);
$ret = array();
foreach ($ts as $t) {
@@ -138,10 +140,10 @@ protected function getFixturesArrayWithScope($scope = null)
$c = new Criteria();
if ($scope !== null) {
- $c->add(\SortableTable12Peer::SCOPE_COL, $scope);
+ $c->add(\Map\SortableTable12TableMap::SCOPE_COL, $scope);
}
- $c->addAscendingOrderByColumn(\SortableTable12Peer::RANK_COL);
+ $c->addAscendingOrderByColumn(\Map\SortableTable12TableMap::RANK_COL);
$ts = \SortableTable12Peer::doSelect($c);
$ret = array();

0 comments on commit e6a52e1

Please sign in to comment.