public function testGetIteratorAllowsTraversingQueryObjectsWithSimpleArrayFormatter() { BookstoreDataPopulator::depopulate(); BookstoreDataPopulator::populate(); $c = new ModelCriteria('bookstore', 'Propel\\Tests\\Bookstore\\Book'); $c->select('Id'); $nbResults = 0; foreach ($c as $book) { $nbResults++; } $this->assertEquals(4, $nbResults); }
public function testFormatterWithSelect() { $c = new ModelCriteria('bookstore', 'Propel\\Tests\\Bookstore\\Book'); $c->keepQuery(false); // just for this test's purpose $c->setFormatter(ModelCriteria::FORMAT_ON_DEMAND); $c->select(array('Id', 'Title')); $rows = $c->find($this->con); $this->assertTrue($c->getFormatter() instanceof \Propel\Runtime\Formatter\OnDemandFormatter, 'The formatter is preserved'); }