Browse files

[Tests] continue fixing tests broken with columns contant removed fro…

…m Peer
  • Loading branch information...
1 parent a862a15 commit bf673671b82aac68f8d879ec336d5aa096b25c12 @jaugustin jaugustin committed Jan 12, 2013
View
19 tests/Propel/Tests/Generator/Builder/Om/GeneratedObjectTest.php
@@ -38,6 +38,7 @@
use Propel\Tests\Bookstore\PublisherPeer;
use Propel\Tests\Bookstore\Review;
use Propel\Tests\Bookstore\ReviewPeer;
+use Propel\Tests\Bookstore\Map\ReviewTableMap;
use Propel\Tests\Bookstore\BookstoreEmployee;
use Propel\Tests\Bookstore\BookstoreEmployeePeer;
use Propel\Tests\Bookstore\Map\BookstoreEmployeeTableMap;
@@ -663,12 +664,12 @@ public function testCountRefFk()
// Now set different criteria and expect different results
$c = new Criteria();
- $c->add(ReviewPeer::RECOMMENDED, false);
+ $c->add(ReviewTableMap::RECOMMENDED, false);
$this->assertEquals(floor($num/2), $book->countReviews($c), "Expected " . floor($num/2) . " results from countReviews(recomm=false)");
// Change Criteria, run again -- expect different.
$c = new Criteria();
- $c->add(ReviewPeer::RECOMMENDED, true);
+ $c->add(ReviewTableMap::RECOMMENDED, true);
$this->assertEquals(ceil($num/2), count($book->getReviews($c)), "Expected " . ceil($num/2) . " results from getReviews(recomm=true)");
$this->assertEquals($num, $book->countReviews(), "Expected countReviews to return $num with new empty Criteria");
@@ -735,15 +736,15 @@ public function testToArrayKeyType()
$arr1 = $b->toArray(TableMap::TYPE_COLNAME);
$expectedKeys = array(
- BookPeer::ID,
- BookPeer::TITLE,
- BookPeer::ISBN,
- BookPeer::PRICE,
- BookPeer::PUBLISHER_ID,
- BookPeer::AUTHOR_ID
+ BookTableMap::ID,
+ BookTableMap::TITLE,
+ BookTableMap::ISBN,
+ BookTableMap::PRICE,
+ BookTableMap::PUBLISHER_ID,
+ BookTableMap::AUTHOR_ID
);
$this->assertEquals($expectedKeys, array_keys($arr1), 'toArray() accepts a $keyType parameter to change the result keys');
- $this->assertEquals('Don Juan', $arr1[BookPeer::TITLE], 'toArray() returns an associative array representation of the object');
+ $this->assertEquals('Don Juan', $arr1[BookTableMap::TITLE], 'toArray() returns an associative array representation of the object');
}
public function testToArrayKeyTypePreDefined()
View
27 tests/Propel/Tests/Generator/Builder/Om/GeneratedObjectWithFixturesTest.php
@@ -23,6 +23,11 @@
use Propel\Tests\Bookstore\BookstoreEmployee;
use Propel\Tests\Bookstore\BookstoreEmployeeAccount;
use Propel\Tests\Bookstore\BookstoreEmployeePeer;
+use Propel\Tests\Bookstore\Map\AuthorTableMap;
+use Propel\Tests\Bookstore\Map\BookTableMap;
+use Propel\Tests\Bookstore\Map\BookstoreTableMap;
+use Propel\Tests\Bookstore\Map\BookstoreEmployeeTableMap;
+use Propel\Tests\Bookstore\Map\MediaTableMap;
use Propel\Tests\Bookstore\MediaPeer;
use Propel\Tests\Bookstore\Publisher;
use Propel\Tests\Bookstore\PublisherPeer;
@@ -78,7 +83,7 @@ public function testReloadDeep()
// arbitrary, different author
$c = new Criteria();
- $c->add(AuthorPeer::ID, $b->getAuthorId(), Criteria::NOT_EQUAL);
+ $c->add(AuthorTableMap::ID, $b->getAuthorId(), Criteria::NOT_EQUAL);
$a = AuthorPeer::doSelectOne($c);
$origAuthor = $b->getAuthor();
@@ -260,7 +265,7 @@ public function testCopyInto_Deep()
// Test a "normal" object
$c = new Criteria();
- $c->add(BookPeer::TITLE, 'Harry%', Criteria::LIKE);
+ $c->add(BookTableMap::TITLE, 'Harry%', Criteria::LIKE);
$book = BookPeer::doSelectOne($c);
$reviews = $book->getReviews();
@@ -292,25 +297,25 @@ public function testToArrayLazyLoad()
BookstoreDataPopulator::populate();
$c = new Criteria();
- $c->add(MediaPeer::COVER_IMAGE, null, Criteria::NOT_EQUAL);
- $c->add(MediaPeer::EXCERPT, null, Criteria::NOT_EQUAL);
+ $c->add(MediaTableMap::COVER_IMAGE, null, Criteria::NOT_EQUAL);
+ $c->add(MediaTableMap::EXCERPT, null, Criteria::NOT_EQUAL);
$m = MediaPeer::doSelectOne($c);
if ($m === null) {
$this->fail("Test requires at least one media row w/ cover_image and excerpt NOT NULL");
}
$arr1 = $m->toArray(TableMap::TYPE_COLNAME);
- $this->assertNotNull($arr1[MediaPeer::COVER_IMAGE]);
- $this->assertInternalType('resource', $arr1[MediaPeer::COVER_IMAGE]);
+ $this->assertNotNull($arr1[MediaTableMap::COVER_IMAGE]);
+ $this->assertInternalType('resource', $arr1[MediaTableMap::COVER_IMAGE]);
$arr2 = $m->toArray(TableMap::TYPE_COLNAME, false);
- $this->assertNull($arr2[MediaPeer::COVER_IMAGE]);
- $this->assertNull($arr2[MediaPeer::EXCERPT]);
+ $this->assertNull($arr2[MediaTableMap::COVER_IMAGE]);
+ $this->assertNull($arr2[MediaTableMap::EXCERPT]);
$diffKeys = array_keys(array_diff($arr1, $arr2));
- $expectedDiff = array(MediaPeer::COVER_IMAGE, MediaPeer::EXCERPT);
+ $expectedDiff = array(MediaTableMap::COVER_IMAGE, MediaTableMap::EXCERPT);
$this->assertEquals($expectedDiff, $diffKeys);
}
@@ -323,7 +328,7 @@ public function testToArrayIncludesForeignObjects()
PublisherPeer::clearInstancePool();
$c = new Criteria();
- $c->add(BookPeer::TITLE, 'Don Juan');
+ $c->add(BookTableMap::TITLE, 'Don Juan');
$books = BookPeer::doSelectJoinAuthor($c);
$book = $books[0];
@@ -341,7 +346,7 @@ public function testToArrayIncludesForeignObjects()
$this->assertEquals('George', $arr1['Author']['FirstName'], 'toArray() can return sub arrays for hydrated related objects');
$c = new Criteria();
- $c->add(BookPeer::TITLE, 'Don Juan');
+ $c->add(BookTableMap::TITLE, 'Don Juan');
$books = BookPeer::doSelectJoinAll($c);
$book = $books[0];
View
27 tests/Propel/Tests/Generator/Builder/Om/GeneratedPeerDoDeleteTest.php
@@ -14,6 +14,7 @@
use Propel\Tests\Helpers\Bookstore\BookstoreDataPopulator;
use Propel\Tests\Bookstore\AuthorPeer;
+use Propel\Tests\Bookstore\Map\AuthorTableMap;
use Propel\Tests\Bookstore\Book;
use Propel\Tests\Bookstore\BookPeer;
use Propel\Tests\Bookstore\Map\BookTableMap;
@@ -24,13 +25,15 @@
use Propel\Tests\Bookstore\Bookstore;
use Propel\Tests\Bookstore\BookstoreContest;
use Propel\Tests\Bookstore\BookstoreContestPeer;
+use Propel\Tests\Bookstore\Map\BookstoreContestTableMap;
use Propel\Tests\Bookstore\BookstoreContestEntry;
use Propel\Tests\Bookstore\Customer;
use Propel\Tests\Bookstore\Contest;
use Propel\Tests\Bookstore\BookstoreContestEntryPeer;
use Propel\Tests\Bookstore\MediaPeer;
use Propel\Tests\Bookstore\Publisher;
use Propel\Tests\Bookstore\PublisherPeer;
+use Propel\Tests\Bookstore\Map\PublisherTableMap;
use Propel\Tests\Bookstore\ReviewPeer;
use Propel\Tests\Bookstore\ReaderFavorite;
use Propel\Tests\Bookstore\ReaderFavoritePeer;
@@ -66,17 +69,17 @@ protected function setUp()
public function testDoDelete_MultiTable()
{
$selc = new Criteria();
- $selc->add(BookPeer::TITLE, "Harry Potter and the Order of the Phoenix");
+ $selc->add(BookTableMap::TITLE, "Harry Potter and the Order of the Phoenix");
$hp = BookPeer::doSelectOne($selc);
// print "Attempting to delete [multi-table] by found pk: ";
$c = new Criteria();
- $c->add(BookPeer::ID, $hp->getId());
+ $c->add(BookTableMap::ID, $hp->getId());
// The only way for multi-delete to work currently
// is to specify the author_id and publisher_id (i.e. the fkeys
// have to be in the criteria).
- $c->add(AuthorPeer::ID, $hp->getAuthorId());
- $c->add(PublisherPeer::ID, $hp->getPublisherId());
+ $c->add(AuthorTableMap::ID, $hp->getAuthorId());
+ $c->add(PublisherTableMap::ID, $hp->getPublisherId());
$c->setSingleRecord(true);
BookPeer::doDelete($c);
@@ -95,9 +98,9 @@ public function testDoDelete_ComplexCriteria()
{
//print "Attempting to delete books by complex criteria: ";
$c = new Criteria();
- $cn = $c->getNewCriterion(BookPeer::ISBN, "043935806X");
- $cn->addOr($c->getNewCriterion(BookPeer::ISBN, "0380977427"));
- $cn->addOr($c->getNewCriterion(BookPeer::ISBN, "0140422161"));
+ $cn = $c->getNewCriterion(BookTableMap::ISBN, "043935806X");
+ $cn->addOr($c->getNewCriterion(BookTableMap::ISBN, "0380977427"));
+ $cn->addOr($c->getNewCriterion(BookTableMap::ISBN, "0140422161"));
$c->add($cn);
BookPeer::doDelete($c);
@@ -320,7 +323,7 @@ public function testDoDeleteAll_Cascade()
public function testDoDeleteAll_SetNull()
{
$c = new Criteria();
- $c->add(BookPeer::AUTHOR_ID, null, Criteria::NOT_EQUAL);
+ $c->add(BookTableMap::AUTHOR_ID, null, Criteria::NOT_EQUAL);
// 1) make sure there are some books with valid authors
$this->assertTrue(count(BookPeer::doSelect($c)) > 0, "Expect some book.author_id columns that are not NULL.");
@@ -401,11 +404,11 @@ public function testDoInsert_Criteria()
$name = "A Sample Publisher - " . time();
$values = new Criteria();
- $values->add(PublisherPeer::NAME, $name);
+ $values->add(PublisherTableMap::NAME, $name);
PublisherPeer::doInsert($values);
$c = new Criteria();
- $c->add(PublisherPeer::NAME, $name);
+ $c->add(PublisherTableMap::NAME, $name);
$matches = PublisherPeer::doSelect($c);
$this->assertEquals(1, count($matches), "Expect there to be exactly 1 publisher just-inserted.");
@@ -425,7 +428,7 @@ public function testDoInsert_Obj()
PublisherPeer::doInsert($values);
$c = new Criteria();
- $c->add(PublisherPeer::NAME, $name);
+ $c->add(PublisherTableMap::NAME, $name);
$matches = PublisherPeer::doSelect($c);
$this->assertEquals(1, count($matches), "Expect there to be exactly 1 publisher just-inserted.");
@@ -510,7 +513,7 @@ public function testDoCountJoin()
public function testDoCountJoinWithOrderBy()
{
$c = new Criteria(BookTableMap::DATABASE_NAME);
- $c->addAscendingOrderByColumn(BookPeer::ID);
+ $c->addAscendingOrderByColumn(BookTableMap::ID);
// None of these should not throw an exception!
BookPeer::doCountJoinAll($c);
View
29 tests/Propel/Tests/Generator/Builder/Om/GeneratedPeerDoSelectTest.php
@@ -23,6 +23,7 @@
use Propel\Tests\Bookstore\Bookstore;
use Propel\Tests\Bookstore\BookstoreEmployee;
use Propel\Tests\Bookstore\BookstoreEmployeePeer;
+use Propel\Tests\Bookstore\Map\BookstoreEmployeeTableMap;
use Propel\Tests\Bookstore\BookstoreEmployeeAccount;
use Propel\Tests\Bookstore\BookstoreEmployeeAccountPeer;
use Propel\Tests\Bookstore\Map\BookstoreEmployeeAccountTableMap;
@@ -32,8 +33,10 @@
use Propel\Tests\Bookstore\BookReader;
use Propel\Tests\Bookstore\BookstoreContest;
use Propel\Tests\Bookstore\BookstoreContestPeer;
+use Propel\Tests\Bookstore\Map\BookstoreContestTableMap;
use Propel\Tests\Bookstore\BookstoreContestEntry;
use Propel\Tests\Bookstore\BookstoreContestEntryPeer;
+use Propel\Tests\Bookstore\Map\BookstoreContestEntryTableMap;
use Propel\Tests\Bookstore\Contest;
use Propel\Tests\Bookstore\Customer;
use Propel\Tests\Bookstore\ReaderFavorite;
@@ -71,18 +74,18 @@ public function testDoSelect()
$book1 = $books[0];
$c = new Criteria();
- $c->add(BookPeer::ID, $book1->getId());
+ $c->add(BookTableMap::ID, $book1->getId());
$res = BookPeer::doSelect($c);
$this->assertEquals(array($book1), $res, 'doSelect() accepts a Criteria object with a condition');
$c = new Criteria();
- $c->add(BookPeer::ID, $book1->getId());
- $c->add(BookPeer::TITLE, $book1->getTitle());
+ $c->add(BookTableMap::ID, $book1->getId());
+ $c->add(BookTableMap::TITLE, $book1->getTitle());
$res = BookPeer::doSelect($c);
$this->assertEquals(array($book1), $res, 'doSelect() accepts a Criteria object with several condition');
$c = new Criteria();
- $c->add(BookPeer::ID, 'foo');
+ $c->add(BookTableMap::ID, 'foo');
$res = BookPeer::doSelect($c);
$this->assertEquals(array(), $res, 'doSelect() accepts an incorrect Criteria');
}
@@ -164,8 +167,8 @@ public function testDoSelectJoin_NullFk()
AuthorPeer::clearInstancePool();
$c = new Criteria();
- $c->add(BookPeer::ISBN, 'NULLFK-%', Criteria::LIKE);
- $c->addAscendingOrderByColumn(BookPeer::ISBN);
+ $c->add(BookTableMap::ISBN, 'NULLFK-%', Criteria::LIKE);
+ $c->addAscendingOrderByColumn(BookTableMap::ISBN);
$matches = BookPeer::doSelectJoinAuthor($c);
$this->assertEquals(2, count($matches), "Expected 2 matches back from new books; got back " . count($matches));
@@ -191,12 +194,12 @@ public function testDoSelectOne()
$book1 = $books[0];
$c = new Criteria();
- $c->add(BookPeer::ID, $book1->getId());
+ $c->add(BookTableMap::ID, $book1->getId());
$res = BookPeer::doSelectOne($c);
$this->assertEquals($book1, $res, 'doSelectOne() returns a single object');
$c = new Criteria();
- $c->add(BookPeer::ID, 'foo');
+ $c->add(BookTableMap::ID, 'foo');
$res = BookPeer::doSelectOne($c);
$this->assertNull($res, 'doSelectOne() returns null if the Criteria matches no record');
}
@@ -283,8 +286,8 @@ public function testInheritance()
// 1) test the pooled instances'
$c = new Criteria();
- $c->add(BookstoreEmployeePeer::ID, array($managerId, $empId, $cashierId), Criteria::IN);
- $c->addAscendingOrderByColumn(BookstoreEmployeePeer::ID);
+ $c->add(BookstoreEmployeeTableMap::ID, array($managerId, $empId, $cashierId), Criteria::IN);
+ $c->addAscendingOrderByColumn(BookstoreEmployeeTableMap::ID);
$objects = BookstoreEmployeePeer::doSelect($c);
@@ -371,8 +374,8 @@ public function testMultiColFk()
$rf1->save();
$c = new Criteria(ReaderFavoriteTableMap::DATABASE_NAME);
- $c->add(ReaderFavoritePeer::BOOK_ID, $b1->getId());
- $c->add(ReaderFavoritePeer::READER_ID, $r1->getId());
+ $c->add(ReaderFavoriteTableMap::BOOK_ID, $b1->getId());
+ $c->add(ReaderFavoriteTableMap::READER_ID, $r1->getId());
$results = ReaderFavoritePeer::doSelectJoinBookOpinion($c);
$this->assertEquals(1, count($results), "Expected 1 result");
@@ -456,7 +459,7 @@ public function testMultiColJoin()
*/
$c = new Criteria();
- $c->addJoin(array(BookstoreContestEntryPeer::BOOKSTORE_ID, BookstoreContestEntryPeer::CONTEST_ID), array(BookstoreContestPeer::BOOKSTORE_ID, BookstoreContestPeer::CONTEST_ID) );
+ $c->addJoin(array(BookstoreContestEntryTableMap::BOOKSTORE_ID, BookstoreContestEntryTableMap::CONTEST_ID), array(BookstoreContestTableMap::BOOKSTORE_ID, BookstoreContestTableMap::CONTEST_ID) );
$results = BookstoreContestEntryPeer::doSelect($c);
$this->assertEquals(2, count($results) );
View
18 tests/Propel/Tests/Generator/Builder/Om/GeneratedPeerEnumColumnTypeTest.php
@@ -39,13 +39,13 @@ public function setUp()
public function valueSetConstantProvider()
{
return array(
- array('\ComplexColumnTypeEntity103Peer::BAR_FOO', 'foo'),
- array('\ComplexColumnTypeEntity103Peer::BAR_BAR', 'bar'),
- array('\ComplexColumnTypeEntity103Peer::BAR_BAZ', 'baz'),
- array('\ComplexColumnTypeEntity103Peer::BAR_1', '1'),
- array('\ComplexColumnTypeEntity103Peer::BAR_4', '4'),
- array('\ComplexColumnTypeEntity103Peer::BAR__', '('),
- array('\ComplexColumnTypeEntity103Peer::BAR_FOO_BAR', 'foo bar'),
+ array('\ComplexColumnTypeEntity103TableMap::BAR_FOO', 'foo'),
+ array('\ComplexColumnTypeEntity103TableMap::BAR_BAR', 'bar'),
+ array('\ComplexColumnTypeEntity103TableMap::BAR_BAZ', 'baz'),
+ array('\ComplexColumnTypeEntity103TableMap::BAR_1', '1'),
+ array('\ComplexColumnTypeEntity103TableMap::BAR_4', '4'),
+ array('\ComplexColumnTypeEntity103TableMap::BAR__', '('),
+ array('\ComplexColumnTypeEntity103TableMap::BAR_FOO_BAR', 'foo bar'),
);
}
@@ -60,13 +60,13 @@ public function testValueSetConstants($constantName, $value)
public function testGetValueSets()
{
- $expected = array(\ComplexColumnTypeEntity103Peer::BAR => array('foo', 'bar', 'baz', '1', '4', '(', 'foo bar'));
+ $expected = array(\ComplexColumnTypeEntity103TableMap::BAR => array('foo', 'bar', 'baz', '1', '4', '(', 'foo bar'));
$this->assertEquals($expected, \ComplexColumnTypeEntity103Peer::getValueSets());
}
public function testGetValueSet()
{
$expected = array('foo', 'bar', 'baz', '1', '4', '(', 'foo bar');
- $this->assertEquals($expected, \ComplexColumnTypeEntity103Peer::getValueSet(\ComplexColumnTypeEntity103Peer::BAR));
+ $this->assertEquals($expected, \ComplexColumnTypeEntity103Peer::getValueSet(\ComplexColumnTypeEntity103TableMap::BAR));
}
}
View
30 tests/Propel/Tests/Generator/Builder/Om/GeneratedPeerTest.php
@@ -18,6 +18,12 @@
use Propel\Tests\Bookstore\MediaPeer;
use Propel\Tests\Bookstore\PublisherPeer;
+use Propel\Tests\Bookstore\Map\AuthorTableMap;
+use Propel\Tests\Bookstore\Map\BookTableMap;
+use Propel\Tests\Bookstore\Map\EssayTableMap;
+use Propel\Tests\Bookstore\Map\MediaTableMap;
+use Propel\Tests\Bookstore\Map\PublisherTableMap;
+
use Propel\Runtime\ActiveQuery\Criteria;
/**
@@ -38,23 +44,23 @@ class GeneratedPeerTest extends BookstoreTestBase
{
public function testAlias()
{
- $this->assertEquals('foo.ID', BookPeer::alias('foo', BookPeer::ID), 'alias() returns a column name using the table alias');
- $this->assertEquals('book.ID', BookPeer::alias('book', BookPeer::ID), 'alias() returns a column name using the table alias');
- $this->assertEquals('foo.COVER_IMAGE', MediaPeer::alias('foo', MediaPeer::COVER_IMAGE), 'alias() also works for lazy-loaded columns');
- $this->assertEquals('foo.SUBTITLE', EssayPeer::alias('foo', EssayPeer::SUBTITLE), 'alias() also works for columns with custom phpName');
+ $this->assertEquals('foo.ID', BookPeer::alias('foo', BookTableMap::ID), 'alias() returns a column name using the table alias');
+ $this->assertEquals('book.ID', BookPeer::alias('book', BookTableMap::ID), 'alias() returns a column name using the table alias');
+ $this->assertEquals('foo.COVER_IMAGE', MediaPeer::alias('foo', MediaTableMap::COVER_IMAGE), 'alias() also works for lazy-loaded columns');
+ $this->assertEquals('foo.SUBTITLE', EssayPeer::alias('foo', EssayTableMap::SUBTITLE), 'alias() also works for columns with custom phpName');
}
public function testAddSelectColumns()
{
$c = new Criteria();
BookPeer::addSelectColumns($c);
$expected = array(
- BookPeer::ID,
- BookPeer::TITLE,
- BookPeer::ISBN,
- BookPeer::PRICE,
- BookPeer::PUBLISHER_ID,
- BookPeer::AUTHOR_ID
+ BookTableMap::ID,
+ BookTableMap::TITLE,
+ BookTableMap::ISBN,
+ BookTableMap::PRICE,
+ BookTableMap::PUBLISHER_ID,
+ BookTableMap::AUTHOR_ID
);
$this->assertEquals($expected, $c->getSelectColumns(), 'addSelectColumns() adds the columns of the model to the criteria');
}
@@ -64,8 +70,8 @@ public function testAddSelectColumnsLazyLoad()
$c = new Criteria();
MediaPeer::addSelectColumns($c);
$expected = array(
- MediaPeer::ID,
- MediaPeer::BOOK_ID
+ MediaTableMap::ID,
+ MediaTableMap::BOOK_ID
);
$this->assertEquals($expected, $c->getSelectColumns(), 'addSelectColumns() does not add lazy loaded columns');
}
View
134 tests/Propel/Tests/Generator/Builder/Om/QueryBuilderTest.php
@@ -26,20 +26,26 @@
use Propel\Tests\Bookstore\Map\BookTableMap;
use Propel\Tests\Bookstore\BookstoreEmployeeAccountPeer;
use Propel\Tests\Bookstore\BookstoreEmployeeAccountQuery;
+use Propel\Tests\Bookstore\Map\BookstoreEmployeeAccountTableMap;
use Propel\Tests\Bookstore\BookClubListQuery;
use Propel\Tests\Bookstore\BookOpinionQuery;
use Propel\Tests\Bookstore\BookListRelPeer;
use Propel\Tests\Bookstore\BookListRelQuery;
+use Propel\Tests\Bookstore\Map\BookListRelTableMap;
use Propel\Tests\Bookstore\BookSummaryQuery;
use Propel\Tests\Bookstore\EssayQuery;
use Propel\Tests\Bookstore\ReviewPeer;
use Propel\Tests\Bookstore\ReviewQuery;
+use Propel\Tests\Bookstore\Map\ReviewTableMap;
use Propel\Tests\Bookstore\ReaderFavoriteQuery;
use Propel\Tests\Bookstore\PublisherPeer;
+use Propel\Tests\Bookstore\Map\PublisherTableMap;
use Propel\Tests\Bookstore\RecordLabelPeer;
use Propel\Tests\Bookstore\RecordLabelQuery;
+use Propel\Tests\Bookstore\Map\RecordLabelTableMap;
use Propel\Tests\Bookstore\ReleasePoolPeer;
use Propel\Tests\Bookstore\ReleasePoolQuery;
+use Propel\Tests\Bookstore\Map\ReleasePoolTableMap;
use Propel\Tests\Helpers\Bookstore\BookstoreTestBase;
use Propel\Tests\Helpers\Bookstore\BookstoreDataPopulator;
@@ -345,7 +351,7 @@ public function testFilterBy()
public function testFilterByPrimaryKeySimpleKey()
{
$q = BookQuery::create()->filterByPrimaryKey(12);
- $q1 = BookQuery::create()->add(BookPeer::ID, 12, Criteria::EQUAL);
+ $q1 = BookQuery::create()->add(BookTableMap::ID, 12, Criteria::EQUAL);
$this->assertEquals($q1, $q, 'filterByPrimaryKey() translates to a Criteria::EQUAL in the PK column');
$q = BookQuery::create()->setModelAlias('b', true)->filterByPrimaryKey(12);
@@ -376,15 +382,15 @@ public function testFilterByPrimaryKeyCompositeKey()
$q->filterByPrimaryKey($pk);
$q1 = BookListRelQuery::create()
- ->add(BookListRelPeer::BOOK_ID, $pk[0], Criteria::EQUAL)
- ->add(BookListRelPeer::BOOK_CLUB_LIST_ID, $pk[1], Criteria::EQUAL);
+ ->add(BookListRelTableMap::BOOK_ID, $pk[0], Criteria::EQUAL)
+ ->add(BookListRelTableMap::BOOK_CLUB_LIST_ID, $pk[1], Criteria::EQUAL);
$this->assertEquals($q1, $q, 'filterByPrimaryKey() translates to a Criteria::EQUAL in the PK columns');
}
public function testFilterByPrimaryKeysSimpleKey()
{
$q = BookQuery::create()->filterByPrimaryKeys(array(10, 11, 12));
- $q1 = BookQuery::create()->add(BookPeer::ID, array(10, 11, 12), Criteria::IN);
+ $q1 = BookQuery::create()->add(BookTableMap::ID, array(10, 11, 12), Criteria::IN);
$this->assertEquals($q1, $q, 'filterByPrimaryKeys() translates to a Criteria::IN on the PK column');
$q = BookQuery::create()->setModelAlias('b', true)->filterByPrimaryKeys(array(10, 11, 12));
@@ -419,8 +425,8 @@ public function testFilterByPrimaryKeysCompositeKey()
$q1 = BookListRelQuery::create();
foreach ($search as $key) {
- $cton0 = $q1->getNewCriterion(BookListRelPeer::BOOK_ID, $key[0], Criteria::EQUAL);
- $cton1 = $q1->getNewCriterion(BookListRelPeer::BOOK_CLUB_LIST_ID, $key[1], Criteria::EQUAL);
+ $cton0 = $q1->getNewCriterion(BookListRelTableMap::BOOK_ID, $key[0], Criteria::EQUAL);
+ $cton1 = $q1->getNewCriterion(BookListRelTableMap::BOOK_CLUB_LIST_ID, $key[1], Criteria::EQUAL);
$cton0->addAnd($cton1);
$q1->addOr($cton0);
}
@@ -438,179 +444,179 @@ public function testFilterByPrimaryKeysCompositeKey()
public function testFilterByIntegerPk()
{
$q = BookQuery::create()->filterById(12);
- $q1 = BookQuery::create()->add(BookPeer::ID, 12, Criteria::EQUAL);
+ $q1 = BookQuery::create()->add(BookTableMap::ID, 12, Criteria::EQUAL);
$this->assertEquals($q1, $q, 'filterByPkColumn() translates to a Criteria::EQUAL by default');
$q = BookQuery::create()->filterById(12, Criteria::NOT_EQUAL);
- $q1 = BookQuery::create()->add(BookPeer::ID, 12, Criteria::NOT_EQUAL);
+ $q1 = BookQuery::create()->add(BookTableMap::ID, 12, Criteria::NOT_EQUAL);
$this->assertEquals($q1, $q, 'filterByPkColumn() accepts an optional comparison operator');
$q = BookQuery::create()->setModelAlias('b', true)->filterById(12);
$q1 = BookQuery::create()->setModelAlias('b', true)->add('b.ID', 12, Criteria::EQUAL);
$this->assertEquals($q1, $q, 'filterByPkColumn() uses true table alias if set');
$q = BookQuery::create()->filterById(array(10, 11, 12));
- $q1 = BookQuery::create()->add(BookPeer::ID, array(10, 11, 12), Criteria::IN);
+ $q1 = BookQuery::create()->add(BookTableMap::ID, array(10, 11, 12), Criteria::IN);
$this->assertEquals($q1, $q, 'filterByPkColumn() translates to a Criteria::IN when passed a simple array key');
$q = BookQuery::create()->filterById(array(10, 11, 12), Criteria::NOT_IN);
- $q1 = BookQuery::create()->add(BookPeer::ID, array(10, 11, 12), Criteria::NOT_IN);
+ $q1 = BookQuery::create()->add(BookTableMap::ID, array(10, 11, 12), Criteria::NOT_IN);
$this->assertEquals($q1, $q, 'filterByPkColumn() accepts a comparison when passed a simple array key');
}
public function testFilterByNumber()
{
$q = BookQuery::create()->filterByPrice(12);
- $q1 = BookQuery::create()->add(BookPeer::PRICE, 12, Criteria::EQUAL);
+ $q1 = BookQuery::create()->add(BookTableMap::PRICE, 12, Criteria::EQUAL);
$this->assertEquals($q1, $q, 'filterByNumColumn() translates to a Criteria::EQUAL by default');
$q = BookQuery::create()->filterByPrice(12, Criteria::NOT_EQUAL);
- $q1 = BookQuery::create()->add(BookPeer::PRICE, 12, Criteria::NOT_EQUAL);
+ $q1 = BookQuery::create()->add(BookTableMap::PRICE, 12, Criteria::NOT_EQUAL);
$this->assertEquals($q1, $q, 'filterByNumColumn() accepts an optional comparison operator');
$q = BookQuery::create()->setModelAlias('b', true)->filterByPrice(12);
$q1 = BookQuery::create()->setModelAlias('b', true)->add('b.PRICE', 12, Criteria::EQUAL);
$this->assertEquals($q1, $q, 'filterByNumColumn() uses true table alias if set');
$q = BookQuery::create()->filterByPrice(array(10, 11, 12));
- $q1 = BookQuery::create()->add(BookPeer::PRICE, array(10, 11, 12), Criteria::IN);
+ $q1 = BookQuery::create()->add(BookTableMap::PRICE, array(10, 11, 12), Criteria::IN);
$this->assertEquals($q1, $q, 'filterByNumColumn() translates to a Criteria::IN when passed a simple array key');
$q = BookQuery::create()->filterByPrice(array(10, 11, 12), Criteria::NOT_IN);
- $q1 = BookQuery::create()->add(BookPeer::PRICE, array(10, 11, 12), Criteria::NOT_IN);
+ $q1 = BookQuery::create()->add(BookTableMap::PRICE, array(10, 11, 12), Criteria::NOT_IN);
$this->assertEquals($q1, $q, 'filterByNumColumn() accepts a comparison when passed a simple array key');
$q = BookQuery::create()->filterByPrice(array('min' => 10));
- $q1 = BookQuery::create()->add(BookPeer::PRICE, 10, Criteria::GREATER_EQUAL);
+ $q1 = BookQuery::create()->add(BookTableMap::PRICE, 10, Criteria::GREATER_EQUAL);
$this->assertEquals($q1, $q, 'filterByNumColumn() translates to a Criteria::GREATER_EQUAL when passed a \'min\' key');
$q = BookQuery::create()->filterByPrice(array('max' => 12));
- $q1 = BookQuery::create()->add(BookPeer::PRICE, 12, Criteria::LESS_EQUAL);
+ $q1 = BookQuery::create()->add(BookTableMap::PRICE, 12, Criteria::LESS_EQUAL);
$this->assertEquals($q1, $q, 'filterByNumColumn() translates to a Criteria::LESS_EQUAL when passed a \'max\' key');
$q = BookQuery::create()->filterByPrice(array('min' => 10, 'max' => 12));
$q1 = BookQuery::create()
- ->add(BookPeer::PRICE, 10, Criteria::GREATER_EQUAL)
- ->addAnd(BookPeer::PRICE, 12, Criteria::LESS_EQUAL);
+ ->add(BookTableMap::PRICE, 10, Criteria::GREATER_EQUAL)
+ ->addAnd(BookTableMap::PRICE, 12, Criteria::LESS_EQUAL);
$this->assertEquals($q1, $q, 'filterByNumColumn() translates to a between when passed both a \'min\' and a \'max\' key');
}
public function testFilterByTimestamp()
{
$q = BookstoreEmployeeAccountQuery::create()->filterByCreated(12);
- $q1 = BookstoreEmployeeAccountQuery::create()->add(BookstoreEmployeeAccountPeer::CREATED, 12, Criteria::EQUAL);
+ $q1 = BookstoreEmployeeAccountQuery::create()->add(BookstoreEmployeeAccountTableMap::CREATED, 12, Criteria::EQUAL);
$this->assertEquals($q1, $q, 'filterByDateColumn() translates to a Criteria::EQUAL by default');
$q = BookstoreEmployeeAccountQuery::create()->filterByCreated(12, Criteria::NOT_EQUAL);
- $q1 = BookstoreEmployeeAccountQuery::create()->add(BookstoreEmployeeAccountPeer::CREATED, 12, Criteria::NOT_EQUAL);
+ $q1 = BookstoreEmployeeAccountQuery::create()->add(BookstoreEmployeeAccountTableMap::CREATED, 12, Criteria::NOT_EQUAL);
$this->assertEquals($q1, $q, 'filterByDateColumn() accepts an optional comparison operator');
$q = BookstoreEmployeeAccountQuery::create()->setModelAlias('b', true)->filterByCreated(12);
$q1 = BookstoreEmployeeAccountQuery::create()->setModelAlias('b', true)->add('b.CREATED', 12, Criteria::EQUAL);
$this->assertEquals($q1, $q, 'filterByDateColumn() uses true table alias if set');
$q = BookstoreEmployeeAccountQuery::create()->filterByCreated(array('min' => 10));
- $q1 = BookstoreEmployeeAccountQuery::create()->add(BookstoreEmployeeAccountPeer::CREATED, 10, Criteria::GREATER_EQUAL);
+ $q1 = BookstoreEmployeeAccountQuery::create()->add(BookstoreEmployeeAccountTableMap::CREATED, 10, Criteria::GREATER_EQUAL);
$this->assertEquals($q1, $q, 'filterByDateColumn() translates to a Criteria::GREATER_EQUAL when passed a \'min\' key');
$q = BookstoreEmployeeAccountQuery::create()->filterByCreated(array('max' => 12));
- $q1 = BookstoreEmployeeAccountQuery::create()->add(BookstoreEmployeeAccountPeer::CREATED, 12, Criteria::LESS_EQUAL);
+ $q1 = BookstoreEmployeeAccountQuery::create()->add(BookstoreEmployeeAccountTableMap::CREATED, 12, Criteria::LESS_EQUAL);
$this->assertEquals($q1, $q, 'filterByDateColumn() translates to a Criteria::LESS_EQUAL when passed a \'max\' key');
$q = BookstoreEmployeeAccountQuery::create()->filterByCreated(array('min' => 10, 'max' => 12));
$q1 = BookstoreEmployeeAccountQuery::create()
- ->add(BookstoreEmployeeAccountPeer::CREATED, 10, Criteria::GREATER_EQUAL)
- ->addAnd(BookstoreEmployeeAccountPeer::CREATED, 12, Criteria::LESS_EQUAL);
+ ->add(BookstoreEmployeeAccountTableMap::CREATED, 10, Criteria::GREATER_EQUAL)
+ ->addAnd(BookstoreEmployeeAccountTableMap::CREATED, 12, Criteria::LESS_EQUAL);
$this->assertEquals($q1, $q, 'filterByDateColumn() translates to a between when passed both a \'min\' and a \'max\' key');
}
public function testFilterByString()
{
$q = BookQuery::create()->filterByTitle('foo');
- $q1 = BookQuery::create()->add(BookPeer::TITLE, 'foo', Criteria::EQUAL);
+ $q1 = BookQuery::create()->add(BookTableMap::TITLE, 'foo', Criteria::EQUAL);
$this->assertEquals($q1, $q, 'filterByStringColumn() translates to a Criteria::EQUAL by default');
$q = BookQuery::create()->filterByTitle('foo', Criteria::NOT_EQUAL);
- $q1 = BookQuery::create()->add(BookPeer::TITLE, 'foo', Criteria::NOT_EQUAL);
+ $q1 = BookQuery::create()->add(BookTableMap::TITLE, 'foo', Criteria::NOT_EQUAL);
$this->assertEquals($q1, $q, 'filterByStringColumn() accepts an optional comparison operator');
$q = BookQuery::create()->setModelAlias('b', true)->filterByTitle('foo');
$q1 = BookQuery::create()->setModelAlias('b', true)->add('b.TITLE', 'foo', Criteria::EQUAL);
$this->assertEquals($q1, $q, 'filterByStringColumn() uses true table alias if set');
$q = BookQuery::create()->filterByTitle(array('foo', 'bar'));
- $q1 = BookQuery::create()->add(BookPeer::TITLE, array('foo', 'bar'), Criteria::IN);
+ $q1 = BookQuery::create()->add(BookTableMap::TITLE, array('foo', 'bar'), Criteria::IN);
$this->assertEquals($q1, $q, 'filterByStringColumn() translates to a Criteria::IN when passed an array');
$q = BookQuery::create()->filterByTitle(array('foo', 'bar'), Criteria::NOT_IN);
- $q1 = BookQuery::create()->add(BookPeer::TITLE, array('foo', 'bar'), Criteria::NOT_IN);
+ $q1 = BookQuery::create()->add(BookTableMap::TITLE, array('foo', 'bar'), Criteria::NOT_IN);
$this->assertEquals($q1, $q, 'filterByStringColumn() accepts a comparison when passed an array');
$q = BookQuery::create()->filterByTitle('foo%');
- $q1 = BookQuery::create()->add(BookPeer::TITLE, 'foo%', Criteria::LIKE);
+ $q1 = BookQuery::create()->add(BookTableMap::TITLE, 'foo%', Criteria::LIKE);
$this->assertEquals($q1, $q, 'filterByStringColumn() translates to a Criteria::LIKE when passed a string with a % wildcard');
$q = BookQuery::create()->filterByTitle('foo%', Criteria::NOT_LIKE);
- $q1 = BookQuery::create()->add(BookPeer::TITLE, 'foo%', Criteria::NOT_LIKE);
+ $q1 = BookQuery::create()->add(BookTableMap::TITLE, 'foo%', Criteria::NOT_LIKE);
$this->assertEquals($q1, $q, 'filterByStringColumn() accepts a comparison when passed a string with a % wildcard');
$q = BookQuery::create()->filterByTitle('foo%', Criteria::EQUAL);
- $q1 = BookQuery::create()->add(BookPeer::TITLE, 'foo%', Criteria::EQUAL);
+ $q1 = BookQuery::create()->add(BookTableMap::TITLE, 'foo%', Criteria::EQUAL);
$this->assertEquals($q1, $q, 'filterByStringColumn() accepts a comparison when passed a string with a % wildcard');
$q = BookQuery::create()->filterByTitle('*foo');
- $q1 = BookQuery::create()->add(BookPeer::TITLE, '%foo', Criteria::LIKE);
+ $q1 = BookQuery::create()->add(BookTableMap::TITLE, '%foo', Criteria::LIKE);
$this->assertEquals($q1, $q, 'filterByStringColumn() translates to a Criteria::LIKE when passed a string with a * wildcard, and turns * into %');
$q = BookQuery::create()->filterByTitle('*f%o*o%');
- $q1 = BookQuery::create()->add(BookPeer::TITLE, '%f%o%o%', Criteria::LIKE);
+ $q1 = BookQuery::create()->add(BookTableMap::TITLE, '%f%o%o%', Criteria::LIKE);
$this->assertEquals($q1, $q, 'filterByStringColumn() translates to a Criteria::LIKE when passed a string with mixed wildcards, and turns *s into %s');
}
public function testFilterByBoolean()
{
$q = ReviewQuery::create()->filterByRecommended(true);
- $q1 = ReviewQuery::create()->add(ReviewPeer::RECOMMENDED, true, Criteria::EQUAL);
+ $q1 = ReviewQuery::create()->add(ReviewTableMap::RECOMMENDED, true, Criteria::EQUAL);
$this->assertEquals($q1, $q, 'filterByBooleanColumn() translates to a Criteria::EQUAL by default');
$q = ReviewQuery::create()->filterByRecommended(true, Criteria::NOT_EQUAL);
- $q1 = ReviewQuery::create()->add(ReviewPeer::RECOMMENDED, true, Criteria::NOT_EQUAL);
+ $q1 = ReviewQuery::create()->add(ReviewTableMap::RECOMMENDED, true, Criteria::NOT_EQUAL);
$this->assertEquals($q1, $q, 'filterByBooleanColumn() accepts an optional comparison operator');
$q = ReviewQuery::create()->filterByRecommended(false);
- $q1 = ReviewQuery::create()->add(ReviewPeer::RECOMMENDED, false, Criteria::EQUAL);
+ $q1 = ReviewQuery::create()->add(ReviewTableMap::RECOMMENDED, false, Criteria::EQUAL);
$this->assertEquals($q1, $q, 'filterByBooleanColumn() translates to a Criteria::EQUAL by default');
$q = ReviewQuery::create()->setModelAlias('b', true)->filterByRecommended(true);
$q1 = ReviewQuery::create()->setModelAlias('b', true)->add('b.RECOMMENDED', true, Criteria::EQUAL);
$this->assertEquals($q1, $q, 'filterByBooleanColumn() uses true table alias if set');
$q = ReviewQuery::create()->filterByRecommended('true');
- $q1 = ReviewQuery::create()->add(ReviewPeer::RECOMMENDED, true, Criteria::EQUAL);
+ $q1 = ReviewQuery::create()->add(ReviewTableMap::RECOMMENDED, true, Criteria::EQUAL);
$this->assertEquals($q1, $q, 'filterByBooleanColumn() translates to a = true when passed a true string');
$q = ReviewQuery::create()->filterByRecommended('yes');
- $q1 = ReviewQuery::create()->add(ReviewPeer::RECOMMENDED, true, Criteria::EQUAL);
+ $q1 = ReviewQuery::create()->add(ReviewTableMap::RECOMMENDED, true, Criteria::EQUAL);
$this->assertEquals($q1, $q, 'filterByBooleanColumn() translates to a = true when passed a true string');
$q = ReviewQuery::create()->filterByRecommended('1');
- $q1 = ReviewQuery::create()->add(ReviewPeer::RECOMMENDED, true, Criteria::EQUAL);
+ $q1 = ReviewQuery::create()->add(ReviewTableMap::RECOMMENDED, true, Criteria::EQUAL);
$this->assertEquals($q1, $q, 'filterByBooleanColumn() translates to a = true when passed a true string');
$q = ReviewQuery::create()->filterByRecommended('false');
- $q1 = ReviewQuery::create()->add(ReviewPeer::RECOMMENDED, false, Criteria::EQUAL);
+ $q1 = ReviewQuery::create()->add(ReviewTableMap::RECOMMENDED, false, Criteria::EQUAL);
$this->assertEquals($q1, $q, 'filterByBooleanColumn() translates to a = false when passed a false string');
$q = ReviewQuery::create()->filterByRecommended('no');
- $q1 = ReviewQuery::create()->add(ReviewPeer::RECOMMENDED, false, Criteria::EQUAL);
+ $q1 = ReviewQuery::create()->add(ReviewTableMap::RECOMMENDED, false, Criteria::EQUAL);
$this->assertEquals($q1, $q, 'filterByBooleanColumn() translates to a = false when passed a false string');
$q = ReviewQuery::create()->filterByRecommended('0');
- $q1 = ReviewQuery::create()->add(ReviewPeer::RECOMMENDED, false, Criteria::EQUAL);
+ $q1 = ReviewQuery::create()->add(ReviewTableMap::RECOMMENDED, false, Criteria::EQUAL);
$this->assertEquals($q1, $q, 'filterByBooleanColumn() translates to a = false when passed a false string');
$q = ReviewQuery::create()->filterByRecommended('');
- $q1 = ReviewQuery::create()->add(ReviewPeer::RECOMMENDED, false, Criteria::EQUAL);
+ $q1 = ReviewQuery::create()->add(ReviewTableMap::RECOMMENDED, false, Criteria::EQUAL);
$this->assertEquals($q1, $q, 'filterByBooleanColumn() translates to a = false when passed an empty string');
}
@@ -641,11 +647,11 @@ public function testFilterByFkSimpleKey()
$this->assertEquals($testBook, $book, 'Generated query handles filterByFk() methods correctly for simple fkeys');
$q = BookQuery::create()->filterByAuthor($testAuthor);
- $q1 = BookQuery::create()->add(BookPeer::AUTHOR_ID, $testAuthor->getId(), Criteria::EQUAL);
+ $q1 = BookQuery::create()->add(BookTableMap::AUTHOR_ID, $testAuthor->getId(), Criteria::EQUAL);
$this->assertEquals($q1, $q, 'filterByFk() translates to a Criteria::EQUAL by default');
$q = BookQuery::create()->filterByAuthor($testAuthor, Criteria::NOT_EQUAL);
- $q1 = BookQuery::create()->add(BookPeer::AUTHOR_ID, $testAuthor->getId(), Criteria::NOT_EQUAL);
+ $q1 = BookQuery::create()->add(BookTableMap::AUTHOR_ID, $testAuthor->getId(), Criteria::NOT_EQUAL);
$this->assertEquals($q1, $q, 'filterByFk() accepts an optional comparison operator');
}
@@ -683,7 +689,7 @@ public function testFilterByFkObjectCollection()
$q1 = $this->con->getLastExecutedQuery();
$books = BookQuery::create()
- ->add(BookPeer::AUTHOR_ID, $authors->getPrimaryKeys(), Criteria::IN)
+ ->add(BookTableMap::AUTHOR_ID, $authors->getPrimaryKeys(), Criteria::IN)
->find($this->con);
$q2 = $this->con->getLastExecutedQuery();
@@ -716,11 +722,11 @@ public function testFilterByRefFkSimpleKey()
$this->assertEquals($testAuthor, $author, 'Generated query handles filterByRefFk() methods correctly for simple fkeys');
$q = AuthorQuery::create()->filterByBook($testBook);
- $q1 = AuthorQuery::create()->add(AuthorPeer::ID, $testBook->getAuthorId(), Criteria::EQUAL);
+ $q1 = AuthorQuery::create()->add(AuthorTableMap::ID, $testBook->getAuthorId(), Criteria::EQUAL);
$this->assertEquals($q1, $q, 'filterByRefFk() translates to a Criteria::EQUAL by default');
$q = AuthorQuery::create()->filterByBook($testBook, Criteria::NOT_EQUAL);
- $q1 = AuthorQuery::create()->add(AuthorPeer::ID, $testBook->getAuthorId(), Criteria::NOT_EQUAL);
+ $q1 = AuthorQuery::create()->add(AuthorTableMap::ID, $testBook->getAuthorId(), Criteria::NOT_EQUAL);
$this->assertEquals($q1, $q, 'filterByRefFk() accepts an optional comparison operator');
}
@@ -734,14 +740,14 @@ public function testFilterByRelationNameCompositePk()
->find($this->con);
$testRelease = ReleasePoolQuery::create()
- ->addJoin(ReleasePoolPeer::RECORD_LABEL_ID, RecordLabelPeer::ID)
+ ->addJoin(ReleasePoolTableMap::RECORD_LABEL_ID, RecordLabelTableMap::ID)
->filterByRecordLabel($testLabel)
->find($this->con);
$q1 = $this->con->getLastExecutedQuery();
$releasePool = ReleasePoolQuery::create()
- ->addJoin(ReleasePoolPeer::RECORD_LABEL_ID, RecordLabelPeer::ID)
- ->add(ReleasePoolPeer::RECORD_LABEL_ID, $testLabel->toKeyValue('Id', 'Id'), Criteria::IN)
+ ->addJoin(ReleasePoolTableMap::RECORD_LABEL_ID, RecordLabelTableMap::ID)
+ ->add(ReleasePoolTableMap::RECORD_LABEL_ID, $testLabel->toKeyValue('Id', 'Id'), Criteria::IN)
->find($this->con);
$q2 = $this->con->getLastExecutedQuery();
@@ -783,8 +789,8 @@ public function testFilterByRefFkObjectCollection()
$q1 = $this->con->getLastExecutedQuery();
$authors = AuthorQuery::create()
- ->addJoin(AuthorPeer::ID, BookPeer::AUTHOR_ID, Criteria::LEFT_JOIN)
- ->add(BookPeer::ID, $books->getPrimaryKeys(), Criteria::IN)
+ ->addJoin(AuthorTableMap::ID, BookTableMap::AUTHOR_ID, Criteria::LEFT_JOIN)
+ ->add(BookTableMap::ID, $books->getPrimaryKeys(), Criteria::IN)
->find($this->con);
$q2 = $this->con->getLastExecutedQuery();
@@ -895,7 +901,7 @@ public function testUseFkQuerySimple()
->endUse();
$q1 = BookQuery::create()
->join('Book.Author', Criteria::LEFT_JOIN)
- ->add(AuthorPeer::FIRST_NAME, 'Leo', Criteria::EQUAL);
+ ->add(AuthorTableMap::FIRST_NAME, 'Leo', Criteria::EQUAL);
$this->assertTrue($q->equals($q1), 'useFkQuery() translates to a condition on a left join on non-required columns');
$q = BookSummaryQuery::create()
@@ -904,7 +910,7 @@ public function testUseFkQuerySimple()
->endUse();
$q1 = BookSummaryQuery::create()
->join('BookSummary.SummarizedBook', Criteria::INNER_JOIN)
- ->add(BookPeer::TITLE, 'War And Peace', Criteria::EQUAL);
+ ->add(BookTableMap::TITLE, 'War And Peace', Criteria::EQUAL);
$this->assertTrue($q->equals($q1), 'useFkQuery() translates to a condition on an inner join on required columns');
}
@@ -916,7 +922,7 @@ public function testUseFkQueryJoinType()
->endUse();
$q1 = BookQuery::create()
->join('Book.Author', Criteria::LEFT_JOIN)
- ->add(AuthorPeer::FIRST_NAME, 'Leo', Criteria::EQUAL);
+ ->add(AuthorTableMap::FIRST_NAME, 'Leo', Criteria::EQUAL);
$this->assertTrue($q->equals($q1), 'useFkQuery() accepts a join type as second parameter');
}
@@ -947,8 +953,8 @@ public function testUseFkQueryMixed()
->filterByTitle('War And Peace');
$q1 = BookQuery::create()
->join('Book.Author', Criteria::LEFT_JOIN)
- ->add(AuthorPeer::FIRST_NAME, 'Leo', Criteria::EQUAL)
- ->add(BookPeer::TITLE, 'War And Peace', Criteria::EQUAL);
+ ->add(AuthorTableMap::FIRST_NAME, 'Leo', Criteria::EQUAL)
+ ->add(BookTableMap::TITLE, 'War And Peace', Criteria::EQUAL);
$this->assertTrue($q->equals($q1), 'useFkQuery() allows combining conditions on main and related query');
}
@@ -963,8 +969,8 @@ public function testUseFkQueryTwice()
->endUse();
$q1 = BookQuery::create()
->join('Book.Author', Criteria::LEFT_JOIN)
- ->add(AuthorPeer::FIRST_NAME, 'Leo', Criteria::EQUAL)
- ->add(AuthorPeer::LAST_NAME, 'Tolstoi', Criteria::EQUAL);
+ ->add(AuthorTableMap::FIRST_NAME, 'Leo', Criteria::EQUAL)
+ ->add(AuthorTableMap::LAST_NAME, 'Tolstoi', Criteria::EQUAL);
$this->assertTrue($q->equals($q1), 'useFkQuery() called twice on the same relation does not create two joins');
}
@@ -1008,7 +1014,7 @@ public function testUseFkQueryNested()
$q1 = ReviewQuery::create()
->join('Review.Book', Criteria::LEFT_JOIN)
->join('Book.Author', Criteria::LEFT_JOIN)
- ->add(AuthorPeer::FIRST_NAME, 'Leo', Criteria::EQUAL);
+ ->add(AuthorTableMap::FIRST_NAME, 'Leo', Criteria::EQUAL);
// embedded queries create joins that keep a relation to the parent
// as this is not testable, we need to use another testing technique
$params = array();
@@ -1030,9 +1036,9 @@ public function testUseFkQueryTwoRelations()
->endUse();
$q1 = BookQuery::create()
->join('\Propel\Tests\Bookstore\Book.Author', Criteria::LEFT_JOIN)
- ->add(AuthorPeer::FIRST_NAME, 'Leo', Criteria::EQUAL)
+ ->add(AuthorTableMap::FIRST_NAME, 'Leo', Criteria::EQUAL)
->join('\Propel\Tests\Bookstore\Book.Publisher', Criteria::LEFT_JOIN)
- ->add(PublisherPeer::NAME, 'Penguin', Criteria::EQUAL);
+ ->add(PublisherTableMap::NAME, 'Penguin', Criteria::EQUAL);
$this->assertTrue($q->equals($q1), 'useFkQuery() called twice on two relations creates two joins');
}
@@ -1048,7 +1054,7 @@ public function testUseFkQueryNoAliasThenWith()
$q1 = $con->getLastExecutedQuery();
$books = BookQuery::create()
->leftJoinWithAuthor()
- ->add(AuthorPeer::FIRST_NAME, 'Leo', Criteria::EQUAL)
+ ->add(AuthorTableMap::FIRST_NAME, 'Leo', Criteria::EQUAL)
->find($con);
$q2 = $con->getLastExecutedQuery();
$this->assertEquals($q1, $q2, 'with() can be used after a call to useFkQuery() with no alias');
View
2 tests/Propel/Tests/Generator/Model/ColumnTest.php
@@ -729,7 +729,7 @@ public function testGetConstantName()
$this->assertSame('created_at', $column->getPeerName());
$this->assertSame('CREATED_AT', $column->getConstantColumnName());
- $this->assertSame('ArticlePeer::CREATED_AT', $column->getConstantName());
+ $this->assertSame('ArticleTableMap::CREATED_AT', $column->getConstantName());
}
public function testSetDefaultPhpName()

0 comments on commit bf67367

Please sign in to comment.