GraphAware\Neo4j\OGM\Tests\Integration\OrderByIntegrationTest::testOrderByOnRelationshipEntitiesBoundedNodes PHP Method

testOrderByOnRelationshipEntitiesBoundedNodes() public method

    public function testOrderByOnRelationshipEntitiesBoundedNodes()
    {
        $this->clearDb();
        $player1 = new Player('PlayerAA');
        $player2 = new Player('PlayerBC');
        $player3 = new Player('PlayerAB');
        $player4 = new Player('PlayerAD');
        $player5 = new Player('PlayerBA');
        $team = new Team('RedBull');
        $player1->addToTeam($team);
        $player2->addToTeam($team);
        $player3->addToTeam($team);
        $player4->addToTeam($team);
        $player5->addToTeam($team);
        $this->em->persist($team);
        $this->em->flush();
        $this->em->clear();
        /** @var Team $team */
        $team = $this->em->getRepository(Team::class)->findOneBy('name', 'RedBull');
        $this->assertCount(5, $team->getMemberships());
        $this->assertEquals('PlayerAA', $team->getMemberships()[0]->getPlayer()->getName());
        $this->assertEquals('PlayerAB', $team->getMemberships()[1]->getPlayer()->getName());
        $this->assertEquals('PlayerBC', $team->getMemberships()[4]->getPlayer()->getName());
    }