From afed6d1a8c27ee209799a032fefb589d5ce6a634 Mon Sep 17 00:00:00 2001 From: samuelgfeller Date: Thu, 15 Aug 2024 18:57:38 +0200 Subject: [PATCH] Replaced assertEqualsCanonicalizing for new phpunit version --- README.md | 4 ++-- .../Client/ClientCreateDropdownOptionsTest.php | 15 +++++++++++---- 2 files changed, 13 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index 121e0a00..c30d8b76 100644 --- a/README.md +++ b/README.md @@ -105,7 +105,7 @@ full-sized project. This is what I try to provide here. This project isn't just a skeleton, it contains a lot of opinionated practical examples on how to -implement features that are often needed in real-world applications. +implement features that are often necessary in real-world applications. That includes authorization, integration testing, localization, validation, error handling, database migrations, mailing, console commands, request throttling, @@ -114,7 +114,7 @@ explanations in the documentation. But it's not just about the features. Equally important -is the [architecture](https://samuel-gfeller.ch/docs/Architecture) +are the [architecture](https://samuel-gfeller.ch/docs/Architecture) and how the components interact with each other, following modern principles such as the [Single Responsibility Principle](https://samuel-gfeller.ch/docs/Single-Responsibility-Principle-(SRP)) and diff --git a/tests/Integration/Client/ClientCreateDropdownOptionsTest.php b/tests/Integration/Client/ClientCreateDropdownOptionsTest.php index 91ff5895..6fcb7fed 100644 --- a/tests/Integration/Client/ClientCreateDropdownOptionsTest.php +++ b/tests/Integration/Client/ClientCreateDropdownOptionsTest.php @@ -35,10 +35,10 @@ class ClientCreateDropdownOptionsTest extends TestCase * @param array $otherUserRow another user (that appears in dropdown) attributes containing the user_role_id * @param array $expectedUserNames * - *@throws NotFoundExceptionInterface + * @return void * @throws ContainerExceptionInterface * - * @return void + * @throws NotFoundExceptionInterface */ #[DataProviderExternal(\App\Test\Provider\Client\ClientCreateProvider::class, 'clientCreationDropdownOptionsCases')] public function testClientCreateAssignedUserDropdownOptionsAuthorization( @@ -65,7 +65,14 @@ public function testClientCreateAssignedUserDropdownOptionsAuthorization( self::assertSame(StatusCodeInterface::STATUS_OK, $response->getStatusCode()); $responseJson = $this->getJsonData($response); - // Assert equals without taking into account user id as it is not known in data provider - self::assertEqualsCanonicalizing($expectedUserNames, $responseJson['users']); + + // Sort both arrays and remove keys + $expectedValues = array_values($expectedUserNames); + $responseValues = array_values($responseJson['users']); + + sort($expectedValues); + sort($responseValues); + + self::assertEquals($expectedValues, $responseValues); } }