Skip to content
Merged
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
11 changes: 10 additions & 1 deletion webapp/tests/Unit/Controller/API/ConfigControllerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,13 @@ public function testConfigCheckerNotAllowedForUnprivilegedUsers(): void
*/
public function testConfigCheckerWorksForAdmin(): void
{
// In the test setup, the config check returns some errors so expected result is 260.
// Force an error independent of the PHP settings: the PHP settings check
// reports an error when max_file_uploads <= sourcefiles_limit.
$sourcefilesLimit = (string)max(1, (int)ini_get('max_file_uploads'));
$this->withChangedConfiguration('sourcefiles_limit', $sourcefilesLimit,
static fn(array $errors) => static::assertEmpty($errors));

// The config check returns at least one error, so the expected result is 260.
$response = $this->verifyApiJsonResponse('GET', $this->endpoint .'/check', 260, 'admin');

$sections = ['System', 'Configuration', 'Contests', 'Problems and languages', 'Teams', 'Identifiers'];
Expand All @@ -172,6 +178,9 @@ public function testConfigCheckerWorksForAdmin(): void
static::assertArrayHasKey('result', $response['System']['php_version']);
static::assertEquals('O', $response['System']['php_version']['result']);

static::assertArrayHasKey('php_settings', $response['System']);
static::assertEquals('E', $response['System']['php_settings']['result']);

static::assertArrayHasKey('languages', $response['Problems and languages']);
static::assertArrayHasKey('caption', $response['Problems and languages']['languages']);
static::assertEquals('Languages validation', $response['Problems and languages']['languages']['caption']);
Expand Down
Loading