Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions webapp/tests/Unit/BaseTestCase.php
Original file line number Diff line number Diff line change
Expand Up @@ -318,4 +318,13 @@ protected function setupShadowMode(bool $shadowMode): void
$dj = self::getContainer()->get(DOMJudgeService::class);
$config->saveChanges(['shadow_mode'=>$shadowMode], $eventLog, $dj, treatMissingBooleansAsFalse: false);
}

protected function checkStatusAndFollowRedirect(): Crawler
{
static::assertLessThan(
400, $this->client->getInternalResponse()->getStatusCode(),
$this->client->getInternalResponse()->getContent()
);
return $this->client->followRedirect();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ public function testClarificationRequestComposeForm(): void
'jury_clarification[message]' => 'This is a clarification',
]);

$this->client->followRedirect();
$this->checkStatusAndFollowRedirect();

self::assertSelectorTextContains('div.col-sm strong', 'All');
self::assertSelectorTextContains('span.clarification-subject',
Expand Down
6 changes: 2 additions & 4 deletions webapp/tests/Unit/Controller/Jury/JuryControllerTestCase.php
Original file line number Diff line number Diff line change
Expand Up @@ -299,10 +299,8 @@ public function testCheckAddEntityAdmin(array $element, array $expected): void
$this->logIn();
$this->verifyPageResponse('GET', static::$baseUrl, 200);
if (static::$add !== '') {
$response = $this->helperSubmitFields($element);
static::assertLessThan(400, $this->client->getInternalResponse()->getStatusCode(),
$this->client->getInternalResponse()->getContent());
$this->client->followRedirect();
$this->helperSubmitFields($element);
$this->checkStatusAndFollowRedirect();
foreach ($element as $key => $value) {
if (!is_array($value) && !in_array($key, static::$overviewSingleNotShown)) {
self::assertSelectorExists('body:contains("' . $value . '")');
Expand Down
2 changes: 1 addition & 1 deletion webapp/tests/Unit/Controller/Jury/TeamControllerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ public function testAddWithoutUserThenEdit(): void
$this->logIn();
$this->verifyPageResponse('GET', static::$baseUrl, 200);
$this->helperSubmitFields($teamToAdd);
$viewPage = $this->client->followRedirect()->getUri();
$viewPage = $this->checkStatusAndFollowRedirect()->getUri();
$editPage = $viewPage . static::$edit;
$this->verifyPageResponse('GET', $editPage, 200);
$formFields = [
Expand Down
2 changes: 1 addition & 1 deletion webapp/tests/Unit/Controller/Team/MiscControllerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ public function testChangeContest(bool $withReferrer): void
// $this->client->request('GET', '/team/change-contest/' . $contest->getCid());
// }
//
// $this->client->followRedirect();
// $this->client->checkStatusAndFollowRedirect();
//
// // Check that we are still on the scoreboard.
// if ($withReferrer) {
Expand Down
Loading