GraphAware\Neo4j\OGM\Tests\Integration\RelationshipIntegrationTest::testHydratedNonCollectionRelationshipsManaged PHP Method

testHydratedNonCollectionRelationshipsManaged() public method

    public function testHydratedNonCollectionRelationshipsManaged()
    {
        $this->clearDb();
        $tw1 = new Tweeto('tw1');
        $tw2 = new Tweeto('tw2');
        $tw3 = new Tweeto('tw3');
        $tw1->setFollows($tw2);
        $this->em->persist($tw1);
        $this->em->persist($tw3);
        $this->em->flush();
        $this->em->clear();
        $this->assertGraphExist('(t1:Tweeto {name:"tw1"})-[:FOLLOWS]->(t2:Tweeto {name:"tw2"})');
        $tweetoRep = $this->em->getRepository(Tweeto::class);
        /** @var Tweeto $tw1 */
        $tw1 = $tweetoRep->findOneBy('name', 'tw1');
        /** @var Tweeto $tw3 */
        $tw3 = $tweetoRep->findOneBy('name', 'tw3');
        $tw1->setFollows($tw3);
        $this->em->flush();
        $this->em->clear();
        $this->assertGraphNotExist('(t1:Tweeto {name:"tw1"})-[:FOLLOWS]->(t2:Tweeto {name:"tw2"})');
        $this->assertGraphExist('(t1:Tweeto {name:"tw1"})-[:FOLLOWS]->(t3:Tweeto {name:"tw3"})');
    }