Skip to content

Commit

Permalink
chore(deps): update phpunit to 10.4.2
Browse files Browse the repository at this point in the history
  • Loading branch information
BacLuc committed Dec 2, 2023
1 parent ee6a3ce commit 81b2e5a
Show file tree
Hide file tree
Showing 29 changed files with 403 additions and 503 deletions.
3 changes: 1 addition & 2 deletions api/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,5 @@
###< lexik/jwt-authentication-bundle ###

###> phpunit/phpunit ###
/phpunit.xml
.phpunit.result.cache
.phpunit.cache
###< phpunit/phpunit ###
4 changes: 2 additions & 2 deletions api/composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -53,9 +53,9 @@
"justinrainbow/json-schema": "5.2.13",
"php-coveralls/php-coveralls": "2.7.0",
"phpstan/phpstan": "1.10.46",
"phpunit/phpunit": "9.6.13",
"phpunit/phpunit": "10.4.2",
"rector/rector": "0.18.10",
"spatie/phpunit-snapshot-assertions": "4.2.16",
"spatie/phpunit-snapshot-assertions": "5.1.3",
"symfony/browser-kit": "6.4.0",
"symfony/css-selector": "6.4.0",
"symfony/debug-bundle": "6.4.0",
Expand Down
550 changes: 255 additions & 295 deletions api/composer.lock

Large diffs are not rendered by default.

46 changes: 22 additions & 24 deletions api/phpunit.nodocker.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,22 +2,25 @@

<!-- https://phpunit.readthedocs.io/en/latest/configuration.html -->
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="vendor/phpunit/phpunit/phpunit.xsd"
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/10.4/phpunit.xsd"
backupGlobals="false"
colors="true"
bootstrap="tests/bootstrap.php"
cacheDirectory=".phpunit.cache"
>
<php>
<ini name="error_reporting" value="-1" />
<server name="APP_ENV" value="test" force="true" />
<server name="SHELL_VERBOSITY" value="-1" />
<server name="SYMFONY_PHPUNIT_REMOVE" value="" />
<server name="SYMFONY_PHPUNIT_VERSION" value="9.5.10" />
<env name="SYMFONY_DEPRECATIONS_HELPER" value="quiet[]=indirect&amp;max[total]=999999"/>
<!-- if "Other deprecation notices" ever gets annoying:
<env name="SYMFONY_DEPRECATIONS_HELPER" value="quiet[]=indirect&amp;quiet[]=other&amp;max[total]=999999"/> -->
<ini name="display_errors" value="1"/>
<ini name="error_reporting" value="-1"/>
<server name="APP_ENV" value="test" force="true"/>
<server name="SHELL_VERBOSITY" value="-1"/>
<server name="SYMFONY_PHPUNIT_REMOVE" value=""/>
<server name="SYMFONY_PHPUNIT_VERSION" value="10.4.2"/>
<env name="DATABASE_URL" value="postgresql://ecamp3:ecamp3@localhost:5432/ecamp3dev?serverVersion=15%26charset=utf8" force="true" />
<env name="TEST_DATABASE_URL" value="postgresql://ecamp3:ecamp3@localhost:5432/ecamp3dev?serverVersion=15%26charset=utf8" force="true" />
<env name="SYMFONY_DEPRECATIONS_HELPER" value="quiet[]=indirect&amp;max[total]=999999"/>
<!-- if "Other deprecation notices" ever gets annoying:
<env name="SYMFONY_DEPRECATIONS_HELPER"
value="quiet[]=indirect&amp;quiet[]=other&amp;max[total]=999999"/> -->
</php>

<testsuites>
Expand All @@ -26,25 +29,20 @@
</testsuite>
</testsuites>

<listeners>
<listener class="Symfony\Bridge\PhpUnit\SymfonyTestsListener" />
</listeners>

<coverage processUncoveredFiles="true">
<include>
<directory suffix=".php">src</directory>
</include>

<coverage>
<report>
<clover outputFile="build/logs/clover.xml"/>
</report>

</coverage>

<!-- Run `composer require symfony/panther` before enabling this extension -->
<!--
<extensions>
<extension class="Symfony\Component\Panther\ServerExtension" />
</extensions>
-->
<extensions>
<extension class="Symfony\Component\Panther\ServerExtension" />
</extensions>
-->
<source>
<include>
<directory suffix=".php">src</directory>
</include>
</source>
</phpunit>
63 changes: 29 additions & 34 deletions api/phpunit.xml.dist
Original file line number Diff line number Diff line change
Expand Up @@ -2,50 +2,45 @@

<!-- https://phpunit.readthedocs.io/en/latest/configuration.html -->
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="vendor/phpunit/phpunit/phpunit.xsd"
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/10.4/phpunit.xsd"
backupGlobals="false"
colors="true"
bootstrap="tests/bootstrap.php"
convertDeprecationsToExceptions="false"
cacheDirectory=".phpunit.cache"
>
<php>
<ini name="display_errors" value="1" />
<ini name="error_reporting" value="-1" />
<server name="APP_ENV" value="test" force="true" />
<server name="SHELL_VERBOSITY" value="-1" />
<server name="SYMFONY_PHPUNIT_REMOVE" value="" />
<server name="SYMFONY_PHPUNIT_VERSION" value="9.6.13" />
<env name="SYMFONY_DEPRECATIONS_HELPER" value="quiet[]=indirect&amp;max[total]=999999" />
<!-- if "Other deprecation notices" ever gets annoying:
<php>
<ini name="display_errors" value="1"/>
<ini name="error_reporting" value="-1"/>
<server name="APP_ENV" value="test" force="true"/>
<server name="SHELL_VERBOSITY" value="-1"/>
<server name="SYMFONY_PHPUNIT_REMOVE" value=""/>
<server name="SYMFONY_PHPUNIT_VERSION" value="10.4.2"/>
<env name="SYMFONY_DEPRECATIONS_HELPER" value="quiet[]=indirect&amp;max[total]=999999"/>
<!-- if "Other deprecation notices" ever gets annoying:
<env name="SYMFONY_DEPRECATIONS_HELPER"
value="quiet[]=indirect&amp;quiet[]=other&amp;max[total]=999999"/> -->
</php>
</php>

<testsuites>
<testsuite name="Project Test Suite">
<directory>tests</directory>
</testsuite>
</testsuites>
<testsuites>
<testsuite name="Project Test Suite">
<directory>tests</directory>
</testsuite>
</testsuites>

<listeners>
<listener class="Symfony\Bridge\PhpUnit\SymfonyTestsListener" />
</listeners>

<coverage processUncoveredFiles="true">
<include>
<directory suffix=".php">src</directory>
</include>

<report>
<clover outputFile="build/logs/clover.xml" />
</report>

</coverage>

<!-- Run `composer require symfony/panther` before enabling this extension -->
<!--
<coverage>
<report>
<clover outputFile="build/logs/clover.xml"/>
</report>
</coverage>
<!-- Run `composer require symfony/panther` before enabling this extension -->
<!--
<extensions>
<extension class="Symfony\Component\Panther\ServerExtension" />
</extensions>
-->
<source>
<include>
<directory suffix=".php">src</directory>
</include>
</source>
</phpunit>
3 changes: 0 additions & 3 deletions api/symfony.lock
Original file line number Diff line number Diff line change
Expand Up @@ -449,9 +449,6 @@
"sebastian/recursion-context": {
"version": "4.0.4"
},
"sebastian/resource-operations": {
"version": "3.0.3"
},
"sebastian/type": {
"version": "2.3.4"
},
Expand Down
13 changes: 4 additions & 9 deletions api/tests/Api/CampCollaborations/UpdateCampCollaborationTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
use App\Entity\CampCollaboration;
use App\Entity\User;
use App\Tests\Api\ECampApiTestCase;
use PHPUnit\Framework\Attributes\DataProvider;

/**
* @internal
Expand Down Expand Up @@ -264,9 +265,7 @@ public function testPatchStatusFromInactiveToInvitedSendsInviteEmail() {
$this->assertEmailCount(1);
}

/**
* @dataProvider usersWhichCanEditCampCollaborations
*/
#[DataProvider('usersWhichCanEditCampCollaborations')]
public function testRejectsPatchStatusFromEstablishedToInactiveIfNoManagerWouldBeInCamp(string $userFixtureName) {
$campCollaboration = static::$fixtures['campCollaboration1camp2manager'];

Expand Down Expand Up @@ -295,9 +294,7 @@ public function testRejectsPatchStatusFromEstablishedToInactiveIfNoManagerWouldB
]);
}

/**
* @dataProvider usersWhichCanEditCampCollaborations
*/
#[DataProvider('usersWhichCanEditCampCollaborations')]
public function testRejectsPatchRoleToMemberIfNoManagerWouldBeInCamp(string $userFixtureName) {
$campCollaboration = static::$fixtures['campCollaboration1camp2manager'];

Expand Down Expand Up @@ -326,9 +323,7 @@ public function testRejectsPatchRoleToMemberIfNoManagerWouldBeInCamp(string $use
]);
}

/**
* @dataProvider usersWhichCanEditCampCollaborations
*/
#[DataProvider('usersWhichCanEditCampCollaborations')]
public function testRejectsPatchRoleToGuestIfNoManagerWouldBeInCamp(string $userFixtureName) {
$campCollaboration = static::$fixtures['campCollaboration1camp2manager'];

Expand Down
42 changes: 21 additions & 21 deletions api/tests/Api/ContentNodes/CreateContentNodeTestCase.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,11 @@
namespace App\Tests\Api\ContentNodes;

use App\Entity\ContentNode;
use App\Entity\ContentNode\ColumnLayout;
use App\Entity\ContentType;
use App\Tests\Api\ECampApiTestCase;
use App\Tests\Constraints\CompatibleHalResponse;
use PHPUnit\Framework\Attributes\DataProvider;
use Symfony\Contracts\HttpClient\Exception\ClientExceptionInterface;
use Symfony\Contracts\HttpClient\Exception\DecodingExceptionInterface;
use Symfony\Contracts\HttpClient\Exception\RedirectionExceptionInterface;
Expand Down Expand Up @@ -89,9 +91,7 @@ public function testCreateIsAllowedForManager() {
$this->assertJsonContains($this->getExampleReadPayload($newContentNode), true);
}

/**
* @dataProvider getContentNodesWhichCannotHaveChildren
*/
#[DataProvider('getContentNodesWhichCannotHaveChildren')]
public function testCreateRejectsParentsWhichDontSupportChildren(string $idOfParentFixture) {
$this->defaultParent = static::$fixtures[$idOfParentFixture];

Expand All @@ -110,7 +110,7 @@ public function testCreateRejectsParentsWhichDontSupportChildren(string $idOfPar
public function testCreateValidatesIncompatibleContentType() {
// given
/** @var ContentType $contentType */
$contentType = static::$fixtures[ContentNode\ColumnLayout::class === $this->entityClass ? 'contentTypeSafetyConcept' : 'contentTypeColumnLayout'];
$contentType = static::$fixtures[ColumnLayout::class === $this->entityClass ? 'contentTypeSafetyConcept' : 'contentTypeColumnLayout'];

// when
$this->create($this->getExampleWritePayload(['contentType' => $this->getIriFor($contentType)]));
Expand Down Expand Up @@ -254,6 +254,23 @@ public function testCreateResponseStructureMatchesReadResponseStructure() {
assertThat($createArray, CompatibleHalResponse::isHalCompatibleWith($getItemResponse->toArray()));
}

public static function getContentNodesWhichCannotHaveChildren(): array {
return [
ContentNode\MaterialNode::class => [
'materialNode1',
],
ContentNode\MultiSelect::class => [
'multiSelect1',
],
ContentNode\SingleText::class => [
'singleText1',
],
ContentNode\StoryBoard::class => [
'storyboard1',
],
];
}

protected function getExampleWritePayload($attributes = [], $except = []) {
return parent::getExampleWritePayload(
array_merge([
Expand Down Expand Up @@ -297,21 +314,4 @@ protected function getExampleReadPayload(ContentNode $self, array $attributes =
],
];
}

private static function getContentNodesWhichCannotHaveChildren(): array {
return [
ContentNode\MaterialNode::class => [
'materialNode1',
],
ContentNode\MultiSelect::class => [
'multiSelect1',
],
ContentNode\SingleText::class => [
'singleText1',
],
ContentNode\StoryBoard::class => [
'storyboard1',
],
];
}
}
7 changes: 3 additions & 4 deletions api/tests/Api/ContentNodes/UpdateContentNodeTestCase.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
use App\Entity\ContentNode;
use App\Entity\ContentNode\ColumnLayout;
use App\Tests\Api\ECampApiTestCase;
use PHPUnit\Framework\Attributes\DataProvider;

/**
* Base UPDATE (patch) test case to be used for various ContentNode types.
Expand Down Expand Up @@ -57,9 +58,7 @@ public function testPatchIsAllowedForManager() {
$this->assertResponseStatusCodeSame(200);
}

/**
* @dataProvider getContentNodesWhichCannotHaveChildren
*/
#[DataProvider('getContentNodesWhichCannotHaveChildren')]
public function testPatchRejectsParentsWhichDontSupportChildren(string $idOfParentFixture) {
$parentIri = static::getIriFor($idOfParentFixture);

Expand Down Expand Up @@ -169,7 +168,7 @@ public function testPatchCleansTextOfInstanceName() {
]);
}

private static function getContentNodesWhichCannotHaveChildren(): array {
public static function getContentNodesWhichCannotHaveChildren(): array {
return [
ContentNode\MaterialNode::class => [
'materialNode1',
Expand Down
4 changes: 2 additions & 2 deletions api/tests/Api/Invitations/AcceptInvitationTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
use App\DTO\Invitation;
use App\Entity\CampCollaboration;
use App\Tests\Api\ECampApiTestCase;
use PHPUnit\Framework\Attributes\DataProvider;
use Symfony\Contracts\HttpClient\Exception\ClientExceptionInterface;
use Symfony\Contracts\HttpClient\Exception\DecodingExceptionInterface;
use Symfony\Contracts\HttpClient\Exception\RedirectionExceptionInterface;
Expand Down Expand Up @@ -157,13 +158,12 @@ public function testAcceptInvitationFailsWhenUserAlreadyInCampAndUserIsAttachedT
}

/**
* @dataProvider invalidMethods
*
* @throws ClientExceptionInterface
* @throws RedirectionExceptionInterface
* @throws ServerExceptionInterface
* @throws TransportExceptionInterface
*/
#[DataProvider('invalidMethods')]
public function testInvalidRequestWhenWrongMethod(string $method) {
/** @var CampCollaboration $campCollaboration */
$campCollaboration = static::$fixtures['campCollaboration2invitedCampUnrelated'];
Expand Down
4 changes: 2 additions & 2 deletions api/tests/Api/Invitations/RejectInvitationTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
use App\DTO\Invitation;
use App\Entity\CampCollaboration;
use App\Tests\Api\ECampApiTestCase;
use PHPUnit\Framework\Attributes\DataProvider;
use Symfony\Contracts\HttpClient\Exception\ClientExceptionInterface;
use Symfony\Contracts\HttpClient\Exception\DecodingExceptionInterface;
use Symfony\Contracts\HttpClient\Exception\RedirectionExceptionInterface;
Expand Down Expand Up @@ -162,13 +163,12 @@ public function testRejectInvitationSucceedsWhenUserAlreadyInCamp() {
}

/**
* @dataProvider invalidMethods
*
* @throws ClientExceptionInterface
* @throws RedirectionExceptionInterface
* @throws ServerExceptionInterface
* @throws TransportExceptionInterface
*/
#[DataProvider('invalidMethods')]
public function testInvalidRequestWhenWrongMethod(string $method) {
/** @var CampCollaboration $campCollaboration */
$campCollaboration = static::$fixtures['campCollaboration2invitedCampUnrelated'];
Expand Down
5 changes: 2 additions & 3 deletions api/tests/Api/Profiles/UpdateProfileTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

use App\Entity\Profile;
use App\Tests\Api\ECampApiTestCase;
use PHPUnit\Framework\Attributes\DataProvider;

/**
* @internal
Expand Down Expand Up @@ -240,9 +241,7 @@ public function testPatchProfileDoesNotAllowPatchingUser() {
]);
}

/**
* @dataProvider notWriteableProfileProperties
*/
#[DataProvider('notWriteableProfileProperties')]
public function testNotWriteableProperties(string $property) {
$user = static::$fixtures['profile1manager'];
static::createClientWithCredentials()->request(
Expand Down
Loading

0 comments on commit 81b2e5a

Please sign in to comment.