@@ 110-136 (lines=27) @@ | ||
107 | * @uses \Tfboe\FmLib\Entity\Helpers\NameEntity::getName |
|
108 | * @uses \Tfboe\FmLib\Entity\Helpers\NameEntity::setName |
|
109 | */ |
|
110 | public function testTournamentAndParent() |
|
111 | { |
|
112 | $competition = $this->competition(); |
|
113 | $tournament = $this->createMock(TournamentInterface::class); |
|
114 | $competitions = new ArrayCollection(); |
|
115 | $tournament->method('getCompetitions')->willReturn($competitions); |
|
116 | $competition->setName('test competition'); |
|
117 | ||
118 | /** @var TournamentInterface $tournament */ |
|
119 | $competition->setTournament($tournament); |
|
120 | self::assertEquals($tournament, $competition->getTournament()); |
|
121 | self::assertEquals($competition->getTournament(), $competition->getParent()); |
|
122 | self::assertEquals(1, $competition->getTournament()->getCompetitions()->count()); |
|
123 | self::assertEquals($competition, $competition->getTournament()->getCompetitions()[$competition->getName()]); |
|
124 | ||
125 | $tournament2 = $this->createMock(TournamentInterface::class); |
|
126 | $competitions2 = new ArrayCollection(); |
|
127 | $tournament2->method('getCompetitions')->willReturn($competitions2); |
|
128 | /** @var TournamentInterface $tournament2 */ |
|
129 | $competition->setTournament($tournament2); |
|
130 | ||
131 | self::assertEquals($tournament2, $competition->getTournament()); |
|
132 | self::assertEquals($competition->getTournament(), $competition->getParent()); |
|
133 | self::assertEquals(1, $competition->getTournament()->getCompetitions()->count()); |
|
134 | self::assertEquals(0, $tournament->getCompetitions()->count()); |
|
135 | self::assertEquals($competition, $competition->getTournament()->getCompetitions()[$competition->getName()]); |
|
136 | } |
|
137 | //</editor-fold desc="Public Methods"> |
|
138 | ||
139 | //<editor-fold desc="Private Methods"> |
@@ 86-112 (lines=27) @@ | ||
83 | * @uses \Tfboe\FmLib\Entity\Traits\Game::getGameNumber |
|
84 | * @uses \Tfboe\FmLib\Entity\Traits\Game::setGameNumber |
|
85 | */ |
|
86 | public function testMatchAndParent() |
|
87 | { |
|
88 | $game = $this->game(); |
|
89 | $match = $this->createMock(MatchInterface::class); |
|
90 | $games = new ArrayCollection(); |
|
91 | $match->method('getGames')->willReturn($games); |
|
92 | $game->setGameNumber(1); |
|
93 | ||
94 | /** @var MatchInterface $match */ |
|
95 | $game->setMatch($match); |
|
96 | self::assertEquals($match, $game->getMatch()); |
|
97 | self::assertEquals(1, $game->getMatch()->getGames()->count()); |
|
98 | self::assertEquals($game, $game->getMatch()->getGames()[$game->getGameNumber()]); |
|
99 | self::assertEquals($game->getMatch(), $game->getParent()); |
|
100 | ||
101 | $match2 = $this->createMock(MatchInterface::class); |
|
102 | $games2 = new ArrayCollection(); |
|
103 | $match2->method('getGames')->willReturn($games2); |
|
104 | ||
105 | /** @var MatchInterface $match2 */ |
|
106 | $game->setMatch($match2); |
|
107 | self::assertEquals($match2, $game->getMatch()); |
|
108 | self::assertEquals(1, $game->getMatch()->getGames()->count()); |
|
109 | self::assertEquals(0, $match->getGames()->count()); |
|
110 | self::assertEquals($game, $game->getMatch()->getGames()[$game->getGameNumber()]); |
|
111 | self::assertEquals($game->getMatch(), $game->getParent()); |
|
112 | } |
|
113 | ||
114 | /** |
|
115 | * @covers \Tfboe\FmLib\Entity\Traits\Game::getPlayersA |