/**
  * @group order-re-end
  */
 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());
 }
 /**
  * @group joran
  */
 public function testTeamPlayerUseCase()
 {
     $this->clearDb();
     $team = new Team('The Mavericks');
     $player = new Player('joran');
     $time = time();
     $player->addToTeam($team, $time);
     $this->em->persist($player);
     $this->em->flush();
     $this->assertGraphExist('(n:Player {name:"joran"})-[:PLAYS_IN_TEAM {since:' . $time . '}]->(t:Team {name:"The Mavericks"})');
     $this->em->clear();
     $this->clearDb();
     $this->client->run('CREATE (n:Player {name:"joran"}), (t:Team {name:"The Mavericks"})');
     /** @var Player $p1 */
     $p1 = $this->em->getRepository(Player::class)->findOneBy('name', 'joran');
     $this->assertInstanceOf(Player::class, $p1);
     /** @var Team $t1 */
     $t1 = $this->em->getRepository(Team::class)->findOneBy('name', 'The Mavericks');
     $this->assertInstanceOf(Team::class, $t1);
     $p1->addToTeam($t1);
     $this->em->persist($p1);
     $this->em->flush();
     $this->assertGraphExist('(n:Player {name:"joran"})-[:PLAYS_IN_TEAM]->(t:Team {name:"The Mavericks"})');
 }