Skip to content

Commit

Permalink
Replaced assertEqualsCanonicalizing for new phpunit version
Browse files Browse the repository at this point in the history
  • Loading branch information
samuelgfeller committed Aug 15, 2024
1 parent a98f961 commit afed6d1
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 6 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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
Expand Down
15 changes: 11 additions & 4 deletions tests/Integration/Client/ClientCreateDropdownOptionsTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand All @@ -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);
}
}

0 comments on commit afed6d1

Please sign in to comment.