1
0
mirror of synced 2025-01-18 06:21:40 +03:00

Added a failing test case on PersistentCollection::matching() when collection is not initialized and there are NEW entities in the collection

This commit is contained in:
Stefano Rodriguez 2012-09-07 10:42:40 +02:00
parent ab990cfba6
commit 4b3ecfe674

View File

@ -173,6 +173,30 @@ class OneToManyBidirectionalAssociationTest extends \Doctrine\Tests\OrmFunctiona
$this->assertInstanceOf('Doctrine\Common\Collections\Collection', $results);
$this->assertEquals(2, count($results));
}
public function testMatchingBis()
{
$this->_createFixture();
$product = $this->_em->find('Doctrine\Tests\Models\ECommerce\ECommerceProduct', $this->product->getId());
$features = $product->getFeatures();
$thirdFeature = new ECommerceFeature();
$thirdFeature->setDescription('Third feature');
$product->addFeature($thirdFeature);
$results = $features->matching(new Criteria(
Criteria::expr()->eq('description', 'Third feature')
));
$this->assertInstanceOf('Doctrine\Common\Collections\Collection', $results);
$this->assertEquals(1, count($results));
$results = $features->matching(new Criteria());
$this->assertInstanceOf('Doctrine\Common\Collections\Collection', $results);
$this->assertEquals(3, count($results));
}
private function _createFixture()
{