public function testFilterByPrimaryKeysCompositeKey() { BookstoreDataPopulator::depopulate(); BookstoreDataPopulator::populate(); // save all books to make sure related objects are also saved - BookstoreDataPopulator keeps some unsaved $c = new ModelCriteria('bookstore', 'Book'); $books = $c->find(); foreach ($books as $book) { $book->save(); } BookPeer::clearInstancePool(); // retrieve the test data $c = new ModelCriteria('bookstore', 'BookListRel'); $bookListRelTest = $c->find(); $search = array(); foreach ($bookListRelTest as $obj) { $search[] = $obj->getPrimaryKey(); } $q = new BookListRelQuery(); $q->filterByPrimaryKeys($search); $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->addAnd($cton1); $q1->addOr($cton0); } $this->assertEquals($q1, $q, 'filterByPrimaryKeys() translates to a series of Criteria::EQUAL in the PK columns'); $q = new BookListRelQuery(); $q->filterByPrimaryKeys(array()); $q1 = BookListRelQuery::create(); $q1->add(null, '1<>1', Criteria::CUSTOM); $this->assertEquals($q1, $q, 'filterByPrimaryKeys() translates to an always failing test on empty arrays'); }