diff --git a/.gitignore b/.gitignore
index 0faeeee..c8bce73 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,5 +1,6 @@
/.deptrac.cache
/.php-cs-fixer.cache
+/.phpunit.cache/
/.phpunit.result.cache
/composer.lock
/node_modules/
diff --git a/composer.json b/composer.json
index d95c1bb..40fd56c 100644
--- a/composer.json
+++ b/composer.json
@@ -24,7 +24,7 @@
"ibexa/test-core": "~6.0.x-dev",
"phpstan/phpstan": "^2.0",
"phpstan/phpstan-phpunit": "^2.0",
- "phpunit/phpunit": "^9.0",
+ "phpunit/phpunit": "^11.5",
"symfony/phpunit-bridge": "^7.4"
},
"autoload": {
diff --git a/phpstan-baseline.neon b/phpstan-baseline.neon
index 7764992..04d1664 100644
--- a/phpstan-baseline.neon
+++ b/phpstan-baseline.neon
@@ -7,7 +7,7 @@ parameters:
path: src/contracts/Gateway/DoctrineOneToManyRelationship.php
-
- message: '#^PHPDoc tag @var with type Exception is not subtype of native type PHPUnit\\Framework\\MockObject\\MockObject\.$#'
+ message: '#^PHPDoc tag @var with type Exception is not subtype of native type PHPUnit\\Framework\\MockObject\\Stub\.$#'
identifier: varTag.nativeType
count: 1
path: tests/bundle/Gateway/ExpressionVisitorTest.php
diff --git a/phpunit.integration.xml b/phpunit.integration.xml
index fdb7a32..3f3c22f 100644
--- a/phpunit.integration.xml
+++ b/phpunit.integration.xml
@@ -1,10 +1,9 @@
+ cacheDirectory=".phpunit.cache">
@@ -17,9 +16,7 @@
-
+
+
-
-
-
diff --git a/phpunit.xml.dist b/phpunit.xml.dist
index e3b0842..9b9370a 100644
--- a/phpunit.xml.dist
+++ b/phpunit.xml.dist
@@ -1,12 +1,16 @@
-
+
+
+
+
+
tests/bundle
diff --git a/tests/bundle/Gateway/DoctrineSchemaMetadataTest.php b/tests/bundle/Gateway/DoctrineSchemaMetadataTest.php
index 6b8e210..549fe4f 100644
--- a/tests/bundle/Gateway/DoctrineSchemaMetadataTest.php
+++ b/tests/bundle/Gateway/DoctrineSchemaMetadataTest.php
@@ -21,7 +21,7 @@ final class DoctrineSchemaMetadataTest extends TestCase
protected function setUp(): void
{
$this->metadata = new DoctrineSchemaMetadata(
- $this->createMock(Connection::class),
+ $this->createStub(Connection::class),
'stdClass',
'std_class_table',
[
diff --git a/tests/bundle/Gateway/ExpressionVisitorTest.php b/tests/bundle/Gateway/ExpressionVisitorTest.php
index af71cba..16a3ee5 100644
--- a/tests/bundle/Gateway/ExpressionVisitorTest.php
+++ b/tests/bundle/Gateway/ExpressionVisitorTest.php
@@ -25,6 +25,7 @@
use Ibexa\CorePersistence\Gateway\ExpressionVisitor;
use Ibexa\CorePersistence\Gateway\Parameter;
use Ibexa\CorePersistence\Gateway\RelationshipTypeStrategyRegistry;
+use PHPUnit\Framework\Attributes\DataProvider;
use PHPUnit\Framework\Constraint\IsIdentical;
use PHPUnit\Framework\TestCase;
@@ -155,7 +156,7 @@ public function testFieldNotFound(): void
public function testFieldFromMissingRelationship(): void
{
/** @var \Exception $exception */
- $exception = $this->createMock(RuntimeMappingExceptionInterface::class);
+ $exception = $this->createStub(RuntimeMappingExceptionInterface::class);
$this->schemaMetadata
->expects(self::once())
->method('getRelationshipByForeignProperty')
@@ -236,10 +237,9 @@ public function testFieldFromSubSelectRelationship(): void
}
/**
- * @dataProvider provideForFieldFromInheritedRelationship
- *
* @phpstan-param array<\Ibexa\CorePersistence\Gateway\Parameter> $parameters
*/
+ #[DataProvider('provideForFieldFromInheritedRelationship')]
public function testFieldFromInheritedRelationship(
Comparison $comparison,
string $expectedResult,
@@ -455,7 +455,7 @@ private function createRelationshipSchemaMetadata(string $tableName = 'relations
/**
* @param \Ibexa\Contracts\CorePersistence\Gateway\DoctrineSchemaMetadataInterface&\PHPUnit\Framework\MockObject\MockObject $metadata
- * @param array $fields
+ * @param list $fields
*/
private function configureFieldInMetadata(DoctrineSchemaMetadataInterface $metadata, array $fields): void
{
diff --git a/tests/integration/Gateway/ExpressionVisitorTest.php b/tests/integration/Gateway/ExpressionVisitorTest.php
index 6649d2f..089c04d 100644
--- a/tests/integration/Gateway/ExpressionVisitorTest.php
+++ b/tests/integration/Gateway/ExpressionVisitorTest.php
@@ -15,6 +15,7 @@
use Ibexa\Contracts\Test\Core\IbexaKernelTestCase;
use Ibexa\CorePersistence\Gateway\ExpressionVisitor;
use Ibexa\CorePersistence\Gateway\RelationshipTypeStrategyRegistry;
+use PHPUnit\Framework\Attributes\DataProvider;
final class ExpressionVisitorTest extends IbexaKernelTestCase
{
@@ -40,7 +41,8 @@ protected function setUp(): void
$registry,
'article',
'article',
- new RelationshipTypeStrategyRegistry()
+ new RelationshipTypeStrategyRegistry(),
+ $connection
);
}
@@ -60,9 +62,7 @@ public function testInvalidField(): void
$this->expressionVisitor->dispatch(new Comparison('non_existent_field', '=', 'bar'));
}
- /**
- * @dataProvider provideForTraversingRelationships
- */
+ #[DataProvider('provideForTraversingRelationships')]
public function testTraversingRelationships(Comparison $expr, string $expectedResult): void
{
// Note: This assumes relationship tables are joined before being used.
diff --git a/tests/lib/Gateway/DoInsertIdentifierTest.php b/tests/lib/Gateway/DoInsertIdentifierTest.php
index c82fa76..dda851c 100644
--- a/tests/lib/Gateway/DoInsertIdentifierTest.php
+++ b/tests/lib/Gateway/DoInsertIdentifierTest.php
@@ -10,14 +10,14 @@
use Doctrine\DBAL\Connection;
use Doctrine\DBAL\Platforms\AbstractPlatform;
+use Ibexa\Contracts\CorePersistence\Gateway\AbstractDoctrineDatabase;
use Ibexa\Contracts\CorePersistence\Gateway\DoctrineSchemaMetadataRegistryInterface;
use Ibexa\Tests\CorePersistence\Stub\IdentifierProbeGateway;
use LogicException;
+use PHPUnit\Framework\Attributes\CoversClass;
use PHPUnit\Framework\TestCase;
-/**
- * @covers \Ibexa\Contracts\CorePersistence\Gateway\AbstractDoctrineDatabase
- */
+#[CoversClass(AbstractDoctrineDatabase::class)]
final class DoInsertIdentifierTest extends TestCase
{
/** @var \Doctrine\DBAL\Connection&\PHPUnit\Framework\MockObject\MockObject */
@@ -71,7 +71,7 @@ private function createGateway(array $identifierColumns): IdentifierProbeGateway
{
return new IdentifierProbeGateway(
$this->connection,
- $this->createMock(DoctrineSchemaMetadataRegistryInterface::class),
+ $this->createStub(DoctrineSchemaMetadataRegistryInterface::class),
$identifierColumns,
);
}
diff --git a/tests/lib/Gateway/JoinedRelationshipTypeStrategyTest.php b/tests/lib/Gateway/JoinedRelationshipTypeStrategyTest.php
index 998662a..7d62013 100644
--- a/tests/lib/Gateway/JoinedRelationshipTypeStrategyTest.php
+++ b/tests/lib/Gateway/JoinedRelationshipTypeStrategyTest.php
@@ -11,10 +11,9 @@
use Doctrine\DBAL\Query\QueryBuilder;
use Ibexa\Contracts\CorePersistence\Gateway\DoctrineRelationship;
use Ibexa\CorePersistence\Gateway\JoinedRelationshipTypeStrategy;
+use PHPUnit\Framework\Attributes\CoversClass;
-/**
- * @covers \Ibexa\CorePersistence\Gateway\JoinedRelationshipTypeStrategy
- */
+#[CoversClass(JoinedRelationshipTypeStrategy::class)]
final class JoinedRelationshipTypeStrategyTest extends BaseRelationshipTypeStrategyTestCase
{
private JoinedRelationshipTypeStrategy $strategy;
diff --git a/tests/lib/Gateway/RelationshipTypeStrategyRegistryTest.php b/tests/lib/Gateway/RelationshipTypeStrategyRegistryTest.php
index 1ac91da..41d9424 100644
--- a/tests/lib/Gateway/RelationshipTypeStrategyRegistryTest.php
+++ b/tests/lib/Gateway/RelationshipTypeStrategyRegistryTest.php
@@ -13,11 +13,10 @@
use Ibexa\Contracts\CorePersistence\Exception\RuntimeMappingException;
use Ibexa\CorePersistence\Gateway\RelationshipTypeStrategyRegistry;
use Ibexa\Tests\CorePersistence\Stub\InvalidDoctrineRelationship;
+use PHPUnit\Framework\Attributes\CoversClass;
use PHPUnit\Framework\TestCase;
-/**
- * @covers \Ibexa\CorePersistence\Gateway\RelationshipTypeStrategyRegistry
- */
+#[CoversClass(RelationshipTypeStrategyRegistry::class)]
final class RelationshipTypeStrategyRegistryTest extends TestCase
{
private RelationshipTypeStrategyRegistry $registry;
@@ -33,7 +32,7 @@ public function testHandleRelationshipTypeThrowsRuntimeMappingException(): void
$this->expectExceptionMessage('Unhandled relationship metadata. Expected one of "Ibexa\Contracts\CorePersistence\Gateway\DoctrineRelationship", "Ibexa\Contracts\CorePersistence\Gateway\DoctrineOneToManyRelationship". Received "Ibexa\Tests\CorePersistence\Stub\InvalidDoctrineRelationship"');
$this->registry->handleRelationshipType(
- new QueryBuilder($this->createMock(Connection::class)),
+ new QueryBuilder($this->createStub(Connection::class)),
new InvalidDoctrineRelationship(),
'root_table_alias',
'from_table',
@@ -48,7 +47,7 @@ public function testHandleRelationshipTypeQueryThrowsRuntimeMappingException():
$this->registry->handleRelationshipTypeQuery(
new InvalidDoctrineRelationship(),
- $this->createMock(QueryBuilder::class),
+ $this->createStub(QueryBuilder::class),
'related_class_id_column',
'related_class_id_column_0'
);
diff --git a/tests/lib/Gateway/SubSelectRelationshipTypeStrategyTest.php b/tests/lib/Gateway/SubSelectRelationshipTypeStrategyTest.php
index 073fd05..3e50411 100644
--- a/tests/lib/Gateway/SubSelectRelationshipTypeStrategyTest.php
+++ b/tests/lib/Gateway/SubSelectRelationshipTypeStrategyTest.php
@@ -12,10 +12,9 @@
use Ibexa\Contracts\CorePersistence\Gateway\DoctrineRelationship;
use Ibexa\CorePersistence\Gateway\SubSelectRelationshipTypeStrategy;
use LogicException;
+use PHPUnit\Framework\Attributes\CoversClass;
-/**
- * @covers \Ibexa\CorePersistence\Gateway\SubSelectRelationshipTypeStrategy
- */
+#[CoversClass(SubSelectRelationshipTypeStrategy::class)]
final class SubSelectRelationshipTypeStrategyTest extends BaseRelationshipTypeStrategyTestCase
{
private SubSelectRelationshipTypeStrategy $strategy;