Doctrine\Tests\ODM\CouchDB\Functional\ManyToManyAssociationTest::testPersistKeys PHP Method

testPersistKeys() public method

public testPersistKeys ( )
    public function testPersistKeys()
    {
        $node = new CmsNode();
        foreach ($this->groupIds as $groupId) {
            $node->references[$groupId] = $this->dm->find('Doctrine\\Tests\\Models\\CMS\\CmsGroup', $groupId);
        }
        $this->dm->persist($node);
        $this->dm->flush();
        $this->dm->clear();
        $node = $this->dm->find('Doctrine\\Tests\\Models\\CMS\\CmsNode', $node->id);
        $this->assertEquals(2, count($node->references));
        foreach ($this->groupIds as $groupId) {
            $this->assertTrue(isset($node->references[$groupId]), "References array should be indexed by group id, but key does not exist");
            $this->assertInstanceOf('Doctrine\\Tests\\Models\\CMS\\CmsGroup', $node->references[$groupId]);
        }
    }