Doctrine\Tests\ODM\CouchDB\Functional\EmbedManyTest::testAssocCreate PHP Method

testAssocCreate() public method

public testAssocCreate ( )
    public function testAssocCreate()
    {
        $newOne = new Embedder();
        $newOne->id = '2';
        $embedded1 = new Embedded();
        $embedded1->name = 'newly embedded 1';
        $embedded2 = new Embedded();
        $embedded2->name = 'newly embedded 2';
        $newOne->embeds['one'] = $embedded1;
        $newOne->embeds['two'] = $embedded2;
        $this->dm->persist($newOne);
        $this->dm->flush();
        $this->dm->clear();
        $newOne = null;
        $this->assertNull($newOne);
        $newOne = $this->dm->find($this->type, 2);
        $this->assertNotNull($newOne);
        $this->assertEquals(2, count($newOne->embeds));
        $this->assertEquals('newly embedded 1', $newOne->embeds['one']->name);
        $this->assertEquals('newly embedded 2', $newOne->embeds['two']->name);
    }