1
0
Fork 0
mirror of synced 2025-04-01 20:36:14 +03:00

Added test to verify DDC-635 is not a problem

This commit is contained in:
Benjamin Eberlei 2010-07-04 16:19:28 +02:00
parent c45bd0edec
commit 26d8b4dafd

View file

@ -172,6 +172,35 @@ class ManyToManyBasicAssociationTest extends \Doctrine\Tests\OrmFunctionalTestCa
);
}
public function testRetrieveManyToManyAndAddMore()
{
$user = $this->addCmsUserGblancoWithGroups(2);
$group = new CmsGroup();
$group->name = 'Developers_Fresh';
$this->_em->persist($group);
$this->_em->flush();
$this->_em->clear();
/* @var $freshUser CmsUser */
$freshUser = $this->_em->find('Doctrine\Tests\Models\CMS\CmsUser', $user->getId());
$freshUser->addGroup($group);
$this->assertFalse($freshUser->groups->isInitialized(), "CmsUser::groups Collection has to be uninitialized for this test.");
$this->_em->flush();
$this->assertFalse($freshUser->groups->isInitialized(), "CmsUser::groups Collection has to be uninitialized for this test.");
$this->assertEquals(3, count($freshUser->getGroups()));
$this->assertEquals(3, count($freshUser->getGroups()->getSnapshot()), "Snapshot of CmsUser::groups should contain 3 entries.");
$this->_em->clear();
$freshUser = $this->_em->find('Doctrine\Tests\Models\CMS\CmsUser', $user->getId());
$this->assertEquals(3, count($freshUser->getGroups()));
}
/**
* @param int $groupCount
* @return CmsUser