Doctrine\Tests\ODM\CouchDB\Functional\ManyToOneAssociationTest::testSwitchAssociation PHP Метод

testSwitchAssociation() публичный Метод

    public function testSwitchAssociation()
    {
        $article = $this->dm->find('Doctrine\\Tests\\Models\\CMS\\CmsArticle', $this->articleId);
        $otherUser = $this->dm->find('Doctrine\\Tests\\Models\\CMS\\CmsUser', $this->userIds[1]);
        $article->setAuthor($otherUser);
        $this->dm->flush();
        $this->dm->clear();
        $article = $this->dm->find('Doctrine\\Tests\\Models\\CMS\\CmsArticle', $this->articleId);
        $this->assertInstanceOf('Doctrine\\Tests\\Models\\CMS\\CmsUser', $article->user);
        $this->assertEquals('lsmith', $article->user->getUsername());
    }