From c75e5711cf41e170ae73da3fc5663be6fbe271db Mon Sep 17 00:00:00 2001 From: Katelyn Gigante Date: Thu, 2 Nov 2023 04:11:53 +1100 Subject: [PATCH] Fix tests --- gatherling/models/Event.php | 5 ++++- tests/EventsTest.php | 4 ++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/gatherling/models/Event.php b/gatherling/models/Event.php index 18210dcfc..04218e894 100644 --- a/gatherling/models/Event.php +++ b/gatherling/models/Event.php @@ -680,7 +680,7 @@ public function getEntries() * * @return Entry[] */ - public function getRegisteredEntries($deleteinvalid = false) + public function getRegisteredEntries($deleteinvalid = false, $skip_invalid = false) { $players = $this->getPlayers(); @@ -692,6 +692,9 @@ public function getRegisteredEntries($deleteinvalid = false) $entry->removeEntry($player); continue; } + if ($skip_invalid) { + continue; + } } $entries[] = $entry; } diff --git a/tests/EventsTest.php b/tests/EventsTest.php index b3c947f0e..3f23acc6f 100644 --- a/tests/EventsTest.php +++ b/tests/EventsTest.php @@ -112,7 +112,7 @@ public function testRegistration($event) // 8 players have expressed interest in the event. $this->assertEquals(10, count($event->getEntries())); // No players have filled out decklists. - $this->assertEquals(0, count($event->getRegisteredEntries())); + $this->assertEquals(0, count($event->getRegisteredEntries(false, true))); $deck = insertDeck('testplayer0', $event, '60 Plains', ''); $this->assertEmpty($deck->errors, json_encode($deck->errors)); @@ -131,7 +131,7 @@ public function testRegistration($event) $deck = insertDeck('testplayer7', $event, "55 Mountain\n5 Seven Dwarves", '5 Seven Dwarves'); $this->assertNotEmpty($deck->errors, json_encode($deck->errors), 'Too Many Dwarves'); // 5 Valid decks (0, 1, 2, and 4, 5), 3 invalid deck (3, 6, 7), and 3 not submitted decks. - $this->assertEquals(5, count($event->getRegisteredEntries())); + $this->assertEquals(5, count($event->getRegisteredEntries(false, true))); return $event; }