diff --git a/webapp/tests/E2E/Controller/ControllerRolesTraversalTest.php b/webapp/tests/E2E/Controller/ControllerRolesTraversalTest.php index efaf72d0cc..77d6a850bf 100644 --- a/webapp/tests/E2E/Controller/ControllerRolesTraversalTest.php +++ b/webapp/tests/E2E/Controller/ControllerRolesTraversalTest.php @@ -53,7 +53,7 @@ protected function roleCombinations(array $start_roles, array $possible_roles): foreach ($possible_roles as $element) { foreach ($results as $combination) { - $results[] = array_merge([$element], $combination); + $results[] = [$element, ...$combination]; } } return $results; @@ -137,7 +137,7 @@ protected function getAllPages(array $urlsToCheck, string $skip): array continue; } if (!$this->urlExcluded($url, $skip)) { - $urlsToCheck = array_unique(array_merge($urlsToCheck, $this->crawlPageGetLinks($url, 200, $skip))); + $urlsToCheck = array_unique([...$urlsToCheck, ...$this->crawlPageGetLinks($url, 200, $skip)]); } $done[] = $url; } diff --git a/webapp/tests/Unit/Controller/API/AccountBaseTestCase.php b/webapp/tests/Unit/Controller/API/AccountBaseTestCase.php index c6cdd327a5..2ac0b9b28a 100644 --- a/webapp/tests/Unit/Controller/API/AccountBaseTestCase.php +++ b/webapp/tests/Unit/Controller/API/AccountBaseTestCase.php @@ -57,7 +57,7 @@ public function helperVerifyApiUsers(string $myURL, array $objectsBeforeTest, ar self::assertEquals(1, count($newItems)); } $listKey = array_keys($newItems)[0]; - $newUserPostData = array_merge($newUserPostData, (array)$overwritten); + $newUserPostData = [...$newUserPostData, ...(array)$overwritten]; foreach ($newUserPostData as $key => $expectedValue) { if ($key !== 'password') { // For security we don't output the password in the API diff --git a/webapp/tests/Unit/Controller/API/BaseTestCase.php b/webapp/tests/Unit/Controller/API/BaseTestCase.php index 78645c07ae..49c4636648 100644 --- a/webapp/tests/Unit/Controller/API/BaseTestCase.php +++ b/webapp/tests/Unit/Controller/API/BaseTestCase.php @@ -295,7 +295,7 @@ public function testListWithAbsentIds(): void fn($id) => $this->resolveReference($id), array_keys($this->expectedObjects) ); - $ids = array_merge($expectedObjectIds, $this->expectedAbsent); + $ids = [...$expectedObjectIds, ...$this->expectedAbsent]; $url = $this->helperGetEndpointURL($apiEndpoint); $response = $this->verifyApiJsonResponse('GET', $url . "?" . http_build_query(['ids' => $ids]), 404, $this->apiUser); static::assertEquals('One or more objects not found', $response['message']); diff --git a/webapp/tests/Unit/Controller/Jury/JuryControllerTestCase.php b/webapp/tests/Unit/Controller/Jury/JuryControllerTestCase.php index 57f8007ba5..3d58e4690e 100644 --- a/webapp/tests/Unit/Controller/Jury/JuryControllerTestCase.php +++ b/webapp/tests/Unit/Controller/Jury/JuryControllerTestCase.php @@ -456,7 +456,7 @@ public function provideAddCorrectEntities(): Generator { $entities = static::$addEntities; if (!$this->dataSourceIsLocal()) { - $entities = array_merge($entities, static::$addEntitiesNonLocal); + $entities = [...$entities, ...static::$addEntitiesNonLocal]; } foreach ($entities as $element) { [$combinedValues, $element] = $this->helperProvideMergeAddEntity($element); @@ -469,7 +469,7 @@ public function provideAddFailureEntities(): Generator { $entities = static::$addEntitiesFailure; if (!$this->dataSourceIsLocal()) { - $entities = array_merge($entities, static::$addEntitiesFailureNonLocal); + $entities = [...$entities, ...static::$addEntitiesFailureNonLocal]; } foreach ($entities as $message => $elementList) { foreach ($elementList as $element) { diff --git a/webapp/tests/Unit/Controller/Jury/JuryMiscControllerTest.php b/webapp/tests/Unit/Controller/Jury/JuryMiscControllerTest.php index 84263877ab..60096447c8 100644 --- a/webapp/tests/Unit/Controller/Jury/JuryMiscControllerTest.php +++ b/webapp/tests/Unit/Controller/Jury/JuryMiscControllerTest.php @@ -115,7 +115,7 @@ public function testBalloonScoreboard(array $fixtures, bool $public, string $con $this->verifyPageResponse('HEAD', '/public/problems/'.$id.'/text', $statusCode); } $this->verifyPageResponse('GET', '/public/problems', 200); - if (in_array($contestStage, array_merge(['preStart'], $nonActiveStages)) || !$public) { + if (in_array($contestStage, ['preStart', ...$nonActiveStages]) || !$public) { self::assertSelectorExists('body:contains("No problem texts available at this point.")'); } else { self::assertSelectorNotExists('body:contains("No problem texts available at this point.")'); diff --git a/webapp/tests/Unit/Controller/PublicControllerTest.php b/webapp/tests/Unit/Controller/PublicControllerTest.php index 91e60b86ab..c76e7e6859 100644 --- a/webapp/tests/Unit/Controller/PublicControllerTest.php +++ b/webapp/tests/Unit/Controller/PublicControllerTest.php @@ -220,7 +220,7 @@ public function selfRegisterProvider(): Generator yield[['username'=>'newinstsamecountry', 'name'=>'CompetingDutchTeam', 'teamName'=>'SupperT3@m','affiliation'=>'new','affiliationName'=>'Vrije Universiteit', 'affiliationShortName'=>'vu','affiliationCountry'=>'NLD'],'demo', $fixtures, $category]; if (count($fixtures)===1) { - yield[['username'=>'reusevaluesofexistinguser', 'name'=>'selfregistered user for example team','email'=>'electronic@mail.tld','teamName'=>'EasyEnough','affiliation'=>'none'],'demo', array_merge($fixtures, [SelfRegisteredUserFixture::class]),'']; + yield[['username'=>'reusevaluesofexistinguser', 'name'=>'selfregistered user for example team','email'=>'electronic@mail.tld','teamName'=>'EasyEnough','affiliation'=>'none'],'demo', [...$fixtures, SelfRegisteredUserFixture::class],'']; } } } diff --git a/webapp/tests/Unit/Service/ImportExportServiceTest.php b/webapp/tests/Unit/Service/ImportExportServiceTest.php index be1a9554e4..eb95cbd88c 100644 --- a/webapp/tests/Unit/Service/ImportExportServiceTest.php +++ b/webapp/tests/Unit/Service/ImportExportServiceTest.php @@ -542,27 +542,24 @@ protected function testImportAccounts(int $importCount, ?string $message, bool $ ], ]; if ($forTsv) { - $expectedUsers = array_merge($expectedUsers, [ - [ - 'roles' => ['team'], - 'name' => 'Team 2 user a', - 'username' => 'team02a', - 'password' => 'password3', - 'ip' => '5.6.7.8', - 'team' => [ - 'id' => 2, - ], + $expectedUsers = [...$expectedUsers, [ + 'roles' => ['team'], + 'name' => 'Team 2 user a', + 'username' => 'team02a', + 'password' => 'password3', + 'ip' => '5.6.7.8', + 'team' => [ + 'id' => 2, ], - [ - 'roles' => ['team'], - 'name' => 'Team 2 user b', - 'username' => 'team02b', - 'password' => 'password4', - 'team' => [ - 'id' => 2, - ], + ], [ + 'roles' => ['team'], + 'name' => 'Team 2 user b', + 'username' => 'team02b', + 'password' => 'password4', + 'team' => [ + 'id' => 2, ], - ]); + ]]; } $unexpectedUsers = ['analyst1', 'analyst2'];