Skip to content

Commit 743ea16

Browse files
committed
OXDEV-9641 Update to phpunit 12
1 parent 85cc072 commit 743ea16

42 files changed

Lines changed: 102 additions & 24 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

CHANGELOG-v13.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,3 +9,4 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
99
### Changed
1010
- Update module to work with OXID eShop 7.5
1111
- Minimum PHP version is now 8.3, tested up to PHP 8.5
12+
- Upgraded PHPUnit from 11 to 12

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
"myclabs/php-enum": "^1.8"
1717
},
1818
"require-dev": {
19-
"phpunit/phpunit": "^11.4",
19+
"phpunit/phpunit": "^12.0",
2020
"ext-xdebug": "*",
2121
"oxid-esales/oxideshop-ce": "dev-b-7.5.x",
2222
"phpstan/phpstan": "^1.10",

tests/Integration/Infrastructure/RefreshTokenRepositoryTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -195,8 +195,8 @@ private function checkRefreshTokenWithIdExists(string $oxid): bool
195195
public function addToken(
196196
string $oxid,
197197
string $expires,
198-
string $userId = null,
199-
string $token = null,
198+
?string $userId = null,
199+
?string $token = null,
200200
): void {
201201
$insertTokensQuery = "insert into `oegraphqlrefreshtoken` (OXID, OXUSERID, TOKEN, EXPIRES_AT)
202202
values (:oxid, :oxuserid, :token, :expires)";

tests/Integration/Infrastructure/RepositoryTest.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,11 @@
1414
use OxidEsales\GraphQL\Base\DataType\Pagination\Pagination;
1515
use OxidEsales\GraphQL\Base\DataType\Sorting\Sorting as BaseSorting;
1616
use OxidEsales\GraphQL\Base\Infrastructure\Repository;
17+
use PHPUnit\Framework\Attributes\AllowMockObjectsWithoutExpectations;
1718
use PHPUnit\Framework\Attributes\CoversClass;
1819
use PHPUnit\Framework\TestCase;
1920

21+
#[AllowMockObjectsWithoutExpectations]
2022
#[CoversClass(\OxidEsales\GraphQL\Base\Infrastructure\Repository::class)]
2123
final class RepositoryTest extends TestCase
2224
{

tests/Integration/Infrastructure/TokenTest.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,9 @@
2121
use OxidEsales\GraphQL\Base\Infrastructure\Token as TokenInfrastructure;
2222
use OxidEsales\GraphQL\Base\Service\Token;
2323
use OxidEsales\GraphQL\Base\Service\Token as TokenService;
24+
use PHPUnit\Framework\Attributes\AllowMockObjectsWithoutExpectations;
2425

26+
#[AllowMockObjectsWithoutExpectations]
2527
class TokenTest extends IntegrationTestCase
2628
{
2729
private const TEST_TOKEN_ID = '_my_test_token';

tests/Integration/TestCase.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,10 +27,12 @@
2727
use OxidEsales\GraphQL\Base\Service\Authorization;
2828
use OxidEsales\GraphQL\Base\Service\ModuleConfiguration;
2929
use OxidEsales\GraphQL\Base\Service\Token;
30+
use PHPUnit\Framework\Attributes\AllowMockObjectsWithoutExpectations;
3031
use Psr\Log\LoggerInterface;
3132
use ReflectionClass;
3233
use Symfony\Component\DependencyInjection\ContainerBuilder;
3334

35+
#[AllowMockObjectsWithoutExpectations]
3436
abstract class TestCase extends IntegrationTestCase
3537
{
3638
protected static $queryResult;

tests/Unit/BaseTestCase.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,11 @@
2424
use OxidEsales\GraphQL\Base\Service\Token;
2525
use OxidEsales\GraphQL\Base\Service\Token as TokenService;
2626
use OxidEsales\GraphQL\Base\Service\TokenValidator;
27+
use PHPUnit\Framework\Attributes\AllowMockObjectsWithoutExpectations;
2728
use PHPUnit\Framework\TestCase;
2829
use Symfony\Component\EventDispatcher\EventDispatcherInterface;
2930

31+
#[AllowMockObjectsWithoutExpectations]
3032
abstract class BaseTestCase extends TestCase
3133
{
3234
protected function getModuleConfigurationMock(string $lifetime = '+8 hours'): ModuleConfiguration

tests/Unit/Controller/LoginTest.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,11 @@
1919
use OxidEsales\GraphQL\Base\Service\LoginServiceInterface;
2020
use OxidEsales\GraphQL\Base\Service\Token as TokenService;
2121
use OxidEsales\GraphQL\Base\Tests\Unit\BaseTestCase;
22+
use PHPUnit\Framework\Attributes\AllowMockObjectsWithoutExpectations;
2223
use PHPUnit\Framework\MockObject\MockObject;
2324
use Symfony\Component\EventDispatcher\EventDispatcher;
2425

26+
#[AllowMockObjectsWithoutExpectations]
2527
class LoginTest extends BaseTestCase
2628
{
2729
/** @var Legacy|MockObject */

tests/Unit/Controller/TokenTest.php

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,11 @@
2323
use OxidEsales\GraphQL\Base\Service\Token as TokenService;
2424
use OxidEsales\GraphQL\Base\Service\TokenAdministration as TokenAdministration;
2525
use OxidEsales\GraphQL\Base\Tests\Unit\BaseTestCase;
26+
use PHPUnit\Framework\Attributes\AllowMockObjectsWithoutExpectations;
2627
use TheCodingMachine\GraphQLite\Types\ID;
2728

2829
//todo: tests do not do any assertions, fix it.
30+
#[AllowMockObjectsWithoutExpectations]
2931
class TokenTest extends BaseTestCase
3032
{
3133
public function testTokensQueryWithDefaultFilters(): void
@@ -123,11 +125,11 @@ public function testRefreshGivesStringValueOfNewToken(): void
123125
}
124126

125127
private function getTokenController(
126-
TokenAdministration $tokenAdministration = null,
127-
Authentication $authentication = null,
128-
Authorization $authorization = null,
129-
TokenService $tokenService = null,
130-
RefreshTokenServiceInterface $refreshTokenService = null,
128+
?TokenAdministration $tokenAdministration = null,
129+
?Authentication $authentication = null,
130+
?Authorization $authorization = null,
131+
?TokenService $tokenService = null,
132+
?RefreshTokenServiceInterface $refreshTokenService = null,
131133
): TokenController {
132134
return new TokenController(
133135
tokenAdministration: $tokenAdministration ?? $this->createStub(TokenAdministration::class),

tests/Unit/DataType/DataTypeTestCase.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,10 @@
1111

1212
use Doctrine\DBAL\Connection;
1313
use Doctrine\DBAL\Query\QueryBuilder;
14+
use PHPUnit\Framework\Attributes\AllowMockObjectsWithoutExpectations;
1415
use PHPUnit\Framework\TestCase;
1516

17+
#[AllowMockObjectsWithoutExpectations]
1618
abstract class DataTypeTestCase extends TestCase
1719
{
1820
protected function createQueryBuilderMock(): QueryBuilder

0 commit comments

Comments
 (0)