Skip to content

Commit

Permalink
Added a failing test case on PersistentCollection::matching() when co…
Browse files Browse the repository at this point in the history
…llection is not initialized and there are NEW entities in the collection
  • Loading branch information
Stefano Rodriguez committed Sep 7, 2012
1 parent ab990cf commit 4b3ecfe
Showing 1 changed file with 24 additions and 0 deletions.
Expand Up @@ -173,6 +173,30 @@ public function testMatching()
$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()
{
Expand Down

0 comments on commit 4b3ecfe

Please sign in to comment.