Run phpcr-odm tests in CI

* add necessary dependencies to run the phpcr-odm tests in github actions
* fix inteface implementation of phpcr purger
This commit is contained in:
David Buchmann
2025-11-08 15:42:22 +01:00
parent d6629c6d4e
commit 5375eabe3b
5 changed files with 11 additions and 110 deletions

View File

@@ -29,6 +29,8 @@
"doctrine/dbal": "^3.5 || ^4",
"doctrine/mongodb-odm": "^1.3.0 || ^2.0.0",
"doctrine/orm": "^2.14 || ^3",
"doctrine/phpcr-odm": "^1.8 || ^2.0",
"jackalope/jackalope-fs": "*",
"fig/log-test": "^1",
"phpstan/phpstan": "2.1.31",
"phpunit/phpunit": "10.5.45 || 12.4.0",

View File

@@ -12,42 +12,6 @@ parameters:
count: 1
path: src/Event/Listener/ORMReferenceListener.php
-
message: '#^Call to method transactional\(\) on an unknown class Doctrine\\ODM\\PHPCR\\DocumentManagerInterface\.$#'
identifier: class.notFound
count: 1
path: src/Executor/PHPCRExecutor.php
-
message: '#^Method Doctrine\\Common\\DataFixtures\\Executor\\PHPCRExecutor\:\:getObjectManager\(\) has invalid return type Doctrine\\ODM\\PHPCR\\DocumentManagerInterface\.$#'
identifier: class.notFound
count: 1
path: src/Executor/PHPCRExecutor.php
-
message: '#^Parameter \#1 \$dm of method Doctrine\\Common\\DataFixtures\\Purger\\PHPCRPurger\:\:setDocumentManager\(\) expects Doctrine\\ODM\\PHPCR\\DocumentManager, Doctrine\\ODM\\PHPCR\\DocumentManagerInterface given\.$#'
identifier: argument.type
count: 1
path: src/Executor/PHPCRExecutor.php
-
message: '#^Parameter \#1 \$manager of method Doctrine\\Common\\DataFixtures\\Executor\\AbstractExecutor\:\:__construct\(\) expects Doctrine\\Persistence\\ObjectManager, Doctrine\\ODM\\PHPCR\\DocumentManagerInterface given\.$#'
identifier: argument.type
count: 1
path: src/Executor/PHPCRExecutor.php
-
message: '#^Parameter \$dm of method Doctrine\\Common\\DataFixtures\\Executor\\PHPCRExecutor\:\:__construct\(\) has invalid type Doctrine\\ODM\\PHPCR\\DocumentManagerInterface\.$#'
identifier: class.notFound
count: 2
path: src/Executor/PHPCRExecutor.php
-
message: '#^Property Doctrine\\Common\\DataFixtures\\Executor\\PHPCRExecutor\:\:\$dm has unknown class Doctrine\\ODM\\PHPCR\\DocumentManagerInterface as its type\.$#'
identifier: class.notFound
count: 2
path: src/Executor/PHPCRExecutor.php
-
message: '#^Call to an undefined method Doctrine\\Common\\DataFixtures\\FixtureInterface\:\:getDependencies\(\)\.$#'
identifier: method.notFound
@@ -144,54 +108,6 @@ parameters:
count: 1
path: src/Purger/ORMPurger.php
-
message: '#^Call to method getPhpcrSession\(\) on an unknown class Doctrine\\ODM\\PHPCR\\DocumentManagerInterface\.$#'
identifier: class.notFound
count: 1
path: src/Purger/PHPCRPurger.php
-
message: '#^Call to static method purgeWorkspace\(\) on an unknown class PHPCR\\Util\\NodeHelper\.$#'
identifier: class.notFound
count: 1
path: src/Purger/PHPCRPurger.php
-
message: '#^Method Doctrine\\Common\\DataFixtures\\Purger\\PHPCRPurger\:\:getObjectManager\(\) has invalid return type Doctrine\\ODM\\PHPCR\\DocumentManagerInterface\.$#'
identifier: class.notFound
count: 1
path: src/Purger/PHPCRPurger.php
-
message: '#^Parameter \$dm of method Doctrine\\Common\\DataFixtures\\Purger\\PHPCRPurger\:\:__construct\(\) has invalid type Doctrine\\ODM\\PHPCR\\DocumentManagerInterface\.$#'
identifier: class.notFound
count: 1
path: src/Purger/PHPCRPurger.php
-
message: '#^Parameter \$dm of method Doctrine\\Common\\DataFixtures\\Purger\\PHPCRPurger\:\:setDocumentManager\(\) has invalid type Doctrine\\ODM\\PHPCR\\DocumentManager\.$#'
identifier: class.notFound
count: 1
path: src/Purger/PHPCRPurger.php
-
message: '#^Property Doctrine\\Common\\DataFixtures\\Purger\\PHPCRPurger\:\:\$dm \(Doctrine\\ODM\\PHPCR\\DocumentManagerInterface\|null\) does not accept Doctrine\\ODM\\PHPCR\\DocumentManager\.$#'
identifier: assign.propertyType
count: 1
path: src/Purger/PHPCRPurger.php
-
message: '#^Property Doctrine\\Common\\DataFixtures\\Purger\\PHPCRPurger\:\:\$dm has unknown class Doctrine\\ODM\\PHPCR\\DocumentManagerInterface as its type\.$#'
identifier: class.notFound
count: 1
path: src/Purger/PHPCRPurger.php
-
message: '#^Parameter \$dm of method Doctrine\\Common\\DataFixtures\\Purger\\PHPCRPurgerInterface\:\:setDocumentManager\(\) has invalid type Doctrine\\Common\\DataFixtures\\Purger\\DocumentManager\.$#'
identifier: class.notFound
count: 1
path: src/Purger/PHPCRPurgerInterface.php
-
message: '#^Access to an undefined property Doctrine\\Persistence\\Mapping\\ClassMetadata\<T of object\>\:\:\$name\.$#'
identifier: property.notFound
@@ -222,12 +138,6 @@ parameters:
count: 1
path: src/ReferenceRepository.php
-
message: '#^Class Doctrine\\ODM\\PHPCR\\DocumentManager not found\.$#'
identifier: class.notFound
count: 2
path: src/ReferenceRepository.php
-
message: '#^Parameter \#1 \$className of method Doctrine\\Persistence\\ObjectManager\:\:getClassMetadata\(\) expects class\-string\<object\>, string given\.$#'
identifier: argument.type
@@ -282,18 +192,6 @@ parameters:
count: 1
path: tests/Common/DataFixtures/DependentFixtureTest.php
-
message: '#^Parameter \#1 \$dm of class Doctrine\\Common\\DataFixtures\\Executor\\PHPCRExecutor constructor expects Doctrine\\ODM\\PHPCR\\DocumentManagerInterface, Doctrine\\Tests\\Mock\\PHPCRDocumentManager&PHPUnit\\Framework\\MockObject\\MockObject given\.$#'
identifier: argument.type
count: 5
path: tests/Common/DataFixtures/Executor/PHPCRExecutorTest.php
-
message: '#^Parameter \#2 \$purger of class Doctrine\\Common\\DataFixtures\\Executor\\PHPCRExecutor constructor expects Doctrine\\Common\\DataFixtures\\Purger\\PHPCRPurger\|null, Doctrine\\Common\\DataFixtures\\Purger\\PHPCRPurgerInterface&PHPUnit\\Framework\\MockObject\\MockObject given\.$#'
identifier: argument.type
count: 3
path: tests/Common/DataFixtures/Executor/PHPCRExecutorTest.php
-
message: '#^Call to function method_exists\(\) with ''Doctrine\\\\ORM\\\\ORMSetup'' and ''createAttributeMeta…'' will always evaluate to true\.$#'
identifier: function.alreadyNarrowedType

View File

@@ -4,7 +4,7 @@ declare(strict_types=1);
namespace Doctrine\Common\DataFixtures\Executor;
use Doctrine\Common\DataFixtures\Purger\PHPCRPurger;
use Doctrine\Common\DataFixtures\Purger\PHPCRPurgerInterface;
use Doctrine\ODM\PHPCR\DocumentManagerInterface;
use function method_exists;
@@ -16,9 +16,9 @@ final class PHPCRExecutor extends AbstractExecutor
{
/**
* @param DocumentManagerInterface $dm manager instance used for persisting the fixtures
* @param PHPCRPurger|null $purger to remove the current data if append is false
* @param PHPCRPurgerInterface|null $purger to remove the current data if append is false
*/
public function __construct(private DocumentManagerInterface $dm, PHPCRPurger|null $purger = null)
public function __construct(private DocumentManagerInterface $dm, PHPCRPurgerInterface|null $purger = null)
{
parent::__construct($dm);

View File

@@ -4,20 +4,19 @@ declare(strict_types=1);
namespace Doctrine\Common\DataFixtures\Purger;
use Doctrine\ODM\PHPCR\DocumentManager;
use Doctrine\ODM\PHPCR\DocumentManagerInterface;
use PHPCR\Util\NodeHelper;
/**
* Class responsible for purging databases of data before reloading data fixtures.
*/
final class PHPCRPurger implements PurgerInterface
final class PHPCRPurger implements PHPCRPurgerInterface
{
public function __construct(private DocumentManagerInterface|null $dm = null)
{
}
public function setDocumentManager(DocumentManager $dm): void
public function setDocumentManager(DocumentManagerInterface $dm): void
{
$this->dm = $dm;
}

View File

@@ -4,10 +4,12 @@ declare(strict_types=1);
namespace Doctrine\Common\DataFixtures\Purger;
use Doctrine\ODM\PHPCR\DocumentManagerInterface;
interface PHPCRPurgerInterface extends PurgerInterface
{
/**
* Set the DocumentManager instance this purger instance should use.
*/
public function setDocumentManager(DocumentManager $dm): void;
public function setDocumentManager(DocumentManagerInterface $dm): void;
}