Ejemplo n.º 1
0
 public function testPopulateRelationOneToManyWithEmptyCollection()
 {
     $author = new Author();
     $author->setLastName('I who never wrote');
     $author->save($this->con);
     AuthorPeer::clearInstancePool();
     BookPeer::clearInstancePool();
     $coll = new ObjectCollection();
     $coll->setFormatter(new ObjectFormatter(new ModelCriteria(null, 'Propel\\Tests\\Bookstore\\Author')));
     $coll[] = $author;
     $books = $coll->populateRelation('Book', null, $this->con);
     $this->assertEquals(0, $books->count());
     $count = $this->con->getQueryCount();
     $this->assertEquals(0, $author->countBooks());
     $this->assertEquals($count, $this->con->getQueryCount());
 }
 /**
  * @expectedException \Propel\Runtime\Exception\RuntimeException
  * @expectedExceptionMessage Propel\Runtime\Collection\ObjectCollection::populateRelation needs instance pooling to be enabled prior to populating the collection
  */
 public function testPopulateRelationWhenInstancePoolingIsDisabled()
 {
     $coll = new ObjectCollection();
     Propel::disableInstancePooling();
     $coll->populateRelation('Book');
 }