diff --git a/tests/Persistence/Mapping/DriverChainTest.php b/tests/Persistence/Mapping/DriverChainTest.php index c752b1fb..dcd60316 100644 --- a/tests/Persistence/Mapping/DriverChainTest.php +++ b/tests/Persistence/Mapping/DriverChainTest.php @@ -147,6 +147,24 @@ public function testDefaultDriverGetAllClassNames(): void self::assertSame(['Doctrine\Tests\Models\Company\Foo', 'Other\Class'], $classNames); } + + public function testMatchingNamespace(): void + { + // Expose the protected method as public + $mdc = new class extends MappingDriverChain { + public static function isMatchingNamespace(string $className, string $namespace): bool + { + return parent::isMatchingNamespace($className, $namespace); + } + }; + + $className = DriverChainEntity::class; + + self::assertTrue($mdc::isMatchingNamespace($className, 'Doctrine\Tests\Persistence\Mapping\\')); + self::assertTrue($mdc::isMatchingNamespace($className, 'Doctrine\Tests\Persistence\Mapping')); + self::assertFalse($mdc::isMatchingNamespace($className, 'Doctrine\Tests\Persistence\Map')); + self::assertFalse($mdc::isMatchingNamespace($className, 'Doctrine\Tests\Persistence')); + } } class DriverChainEntity