diff --git a/composer.json b/composer.json index abfa2577..53601b69 100644 --- a/composer.json +++ b/composer.json @@ -24,15 +24,15 @@ }, "require-dev": { "ext-sqlite3": "*", - "doctrine/coding-standard": "^10.0", + "doctrine/coding-standard": "^11.0", "doctrine/dbal": "^2.13 || ^3.0", "doctrine/deprecations": "^1.0", "doctrine/mongodb-odm": "^1.3.0 || ^2.0.0", "doctrine/orm": "^2.12", "phpstan/phpstan": "^1.5", - "phpunit/phpunit": "^8.5 || ^9.5", + "phpunit/phpunit": "^8.5 || ^9.5 || ^10.0", "symfony/cache": "^5.0 || ^6.0", - "vimeo/psalm": "^4.10" + "vimeo/psalm": "^4.10 || ^5.9" }, "suggest": { "alcaeus/mongo-php-adapter": "For using MongoDB ODM 1.3 with PHP 7 (deprecated)", @@ -49,12 +49,12 @@ }, "autoload": { "psr-4": { - "Doctrine\\Common\\DataFixtures\\": "lib/Doctrine/Common/DataFixtures" + "Doctrine\\Common\\DataFixtures\\": "src" } }, "autoload-dev": { "psr-4": { - "Doctrine\\Tests\\": "tests/Doctrine/Tests" + "Doctrine\\Tests\\": "tests" } } } diff --git a/docs/en/how-to/fixture-ordering.rst b/docs/en/how-to/fixture-ordering.rst index 76454d4e..6430bcba 100644 --- a/docs/en/how-to/fixture-ordering.rst +++ b/docs/en/how-to/fixture-ordering.rst @@ -20,6 +20,7 @@ Option 1: Controlling the order manually ---------------------------------------- .. code-block:: php + loadFromFile('/path/to/MyDataFixtures/MyFixture1.php'); @@ -69,12 +72,14 @@ want to load a whole directory of fixtures instead of making one call per fixture. .. code-block:: php + loadFromDirectory('/path/to/MyDataFixtures'); You can get the added fixtures using the ``getFixtures()`` method: .. code-block:: php + getFixtures(); @@ -87,6 +92,7 @@ store you are using. For example, if you are using ORM, you should do the following: .. code-block:: php + execute($loader->getFixtures(), append: true); @@ -114,5 +121,6 @@ want to wrap the purge and the load of every fixture in its own transaction. To do so, you can use ``MultipleTransactionORMExecutor``. .. code-block:: php + ` is satisfied if you extend ``AbstractFixture``. .. code-block:: php + - lib + src tests @@ -30,21 +30,21 @@ - lib/Doctrine/Common/DataFixtures/AbstractFixture.php - lib/Doctrine/Common/DataFixtures/Executor/AbstractExecutor.php + src/AbstractFixture.php + src/Executor/AbstractExecutor.php - lib/Doctrine/Common/DataFixtures/Exception/CircularReferenceException.php + src/Exception/CircularReferenceException.php - lib/Doctrine/Common/DataFixtures/DependentFixtureInterface.php - lib/Doctrine/Common/DataFixtures/FixtureInterface.php - lib/Doctrine/Common/DataFixtures/Purger/ORMPurgerInterface.php - lib/Doctrine/Common/DataFixtures/Purger/PurgerInterface.php - lib/Doctrine/Common/DataFixtures/OrderedFixtureInterface.php - lib/Doctrine/Common/DataFixtures/SharedFixtureInterface.php + src/DependentFixtureInterface.php + src/FixtureInterface.php + src/Purger/ORMPurgerInterface.php + src/Purger/PurgerInterface.php + src/OrderedFixtureInterface.php + src/SharedFixtureInterface.php diff --git a/phpstan-baseline.neon b/phpstan-baseline.neon index b0b443c3..805249c4 100644 --- a/phpstan-baseline.neon +++ b/phpstan-baseline.neon @@ -3,109 +3,109 @@ parameters: - message: "#^Call to method transactional\\(\\) on an unknown class Doctrine\\\\ODM\\\\PHPCR\\\\DocumentManagerInterface\\.$#" count: 1 - path: lib/Doctrine/Common/DataFixtures/Executor/PHPCRExecutor.php + path: src/Executor/PHPCRExecutor.php - message: "#^Method Doctrine\\\\Common\\\\DataFixtures\\\\Executor\\\\PHPCRExecutor\\:\\:getObjectManager\\(\\) has invalid return type Doctrine\\\\ODM\\\\PHPCR\\\\DocumentManagerInterface\\.$#" count: 1 - path: lib/Doctrine/Common/DataFixtures/Executor/PHPCRExecutor.php + path: src/Executor/PHPCRExecutor.php - message: "#^Parameter \\$dm of method Doctrine\\\\Common\\\\DataFixtures\\\\Executor\\\\PHPCRExecutor\\:\\:__construct\\(\\) has invalid type Doctrine\\\\ODM\\\\PHPCR\\\\DocumentManagerInterface\\.$#" count: 2 - path: lib/Doctrine/Common/DataFixtures/Executor/PHPCRExecutor.php + path: src/Executor/PHPCRExecutor.php - message: "#^Property Doctrine\\\\Common\\\\DataFixtures\\\\Executor\\\\PHPCRExecutor\\:\\:\\$dm has unknown class Doctrine\\\\ODM\\\\PHPCR\\\\DocumentManagerInterface as its type\\.$#" count: 1 - path: lib/Doctrine/Common/DataFixtures/Executor/PHPCRExecutor.php + path: src/Executor/PHPCRExecutor.php - message: "#^Call to an undefined method Doctrine\\\\Common\\\\DataFixtures\\\\FixtureInterface\\:\\:getDependencies\\(\\)\\.$#" count: 1 - path: lib/Doctrine/Common/DataFixtures/Loader.php + path: src/Loader.php - message: "#^Call to an undefined method Doctrine\\\\Persistence\\\\ObjectManager\\:\\:getReference\\(\\)\\.$#" count: 2 - path: lib/Doctrine/Common/DataFixtures/ProxyReferenceRepository.php + path: src/ProxyReferenceRepository.php - message: "#^Call to an undefined method Doctrine\\\\Persistence\\\\ObjectManager\\:\\:getUnitOfWork\\(\\)\\.$#" count: 1 - path: lib/Doctrine/Common/DataFixtures/ProxyReferenceRepository.php + path: src/ProxyReferenceRepository.php - message: "#^Call to method getPhpcrSession\\(\\) on an unknown class Doctrine\\\\ODM\\\\PHPCR\\\\DocumentManagerInterface\\.$#" count: 1 - path: lib/Doctrine/Common/DataFixtures/Purger/PHPCRPurger.php + path: src/Purger/PHPCRPurger.php - message: "#^Call to static method purgeWorkspace\\(\\) on an unknown class PHPCR\\\\Util\\\\NodeHelper\\.$#" count: 1 - path: lib/Doctrine/Common/DataFixtures/Purger/PHPCRPurger.php + path: src/Purger/PHPCRPurger.php - message: "#^Method Doctrine\\\\Common\\\\DataFixtures\\\\Purger\\\\PHPCRPurger\\:\\:getObjectManager\\(\\) has invalid return type Doctrine\\\\ODM\\\\PHPCR\\\\DocumentManagerInterface\\.$#" count: 1 - path: lib/Doctrine/Common/DataFixtures/Purger/PHPCRPurger.php + path: src/Purger/PHPCRPurger.php - message: "#^Parameter \\$dm of method Doctrine\\\\Common\\\\DataFixtures\\\\Purger\\\\PHPCRPurger\\:\\:__construct\\(\\) has invalid type Doctrine\\\\ODM\\\\PHPCR\\\\DocumentManagerInterface\\.$#" count: 1 - path: lib/Doctrine/Common/DataFixtures/Purger/PHPCRPurger.php + path: src/Purger/PHPCRPurger.php - message: "#^Parameter \\$dm of method Doctrine\\\\Common\\\\DataFixtures\\\\Purger\\\\PHPCRPurger\\:\\:setDocumentManager\\(\\) has invalid type Doctrine\\\\ODM\\\\PHPCR\\\\DocumentManager\\.$#" count: 1 - path: lib/Doctrine/Common/DataFixtures/Purger/PHPCRPurger.php + 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\\.$#" count: 1 - path: lib/Doctrine/Common/DataFixtures/Purger/PHPCRPurger.php + path: src/Purger/PHPCRPurger.php - message: "#^Property Doctrine\\\\Common\\\\DataFixtures\\\\Purger\\\\PHPCRPurger\\:\\:\\$dm has unknown class Doctrine\\\\ODM\\\\PHPCR\\\\DocumentManagerInterface as its type\\.$#" count: 1 - path: lib/Doctrine/Common/DataFixtures/Purger/PHPCRPurger.php + path: src/Purger/PHPCRPurger.php - message: "#^Access to an undefined property Doctrine\\\\Persistence\\\\Mapping\\\\ClassMetadata\\\\:\\:\\$name\\.$#" count: 1 - path: lib/Doctrine/Common/DataFixtures/ReferenceRepository.php + path: src/ReferenceRepository.php - message: "#^Call to an undefined method Doctrine\\\\Persistence\\\\ObjectManager\\:\\:getReference\\(\\)\\.$#" count: 1 - path: lib/Doctrine/Common/DataFixtures/ReferenceRepository.php + path: src/ReferenceRepository.php - message: "#^Call to an undefined method Doctrine\\\\Persistence\\\\ObjectManager\\:\\:getUnitOfWork\\(\\)\\.$#" count: 2 - path: lib/Doctrine/Common/DataFixtures/ReferenceRepository.php + path: src/ReferenceRepository.php - message: "#^Class Doctrine\\\\ODM\\\\PHPCR\\\\DocumentManager not found\\.$#" count: 2 - path: lib/Doctrine/Common/DataFixtures/ReferenceRepository.php + path: src/ReferenceRepository.php - message: "#^Method Doctrine\\\\Tests\\\\Common\\\\DataFixtures\\\\FixtureWithUnexistentDependency\\:\\:getDependencies\\(\\) should return array\\\\> but returns array\\\\.$#" count: 1 - path: tests/Doctrine/Tests/Common/DataFixtures/DependentFixtureTest.php + path: tests/Common/DataFixtures/DependentFixtureTest.php - message: "#^Call to method expects\\(\\) on an unknown class Doctrine\\\\ODM\\\\PHPCR\\\\DocumentManager\\.$#" count: 5 - path: tests/Doctrine/Tests/Common/DataFixtures/Executor/PHPCRExecutorTest.php + path: tests/Common/DataFixtures/Executor/PHPCRExecutorTest.php - message: "#^Method Doctrine\\\\Tests\\\\Common\\\\DataFixtures\\\\Executor\\\\PHPCRExecutorTest\\:\\:getDocumentManager\\(\\) has invalid return type Doctrine\\\\ODM\\\\PHPCR\\\\DocumentManager\\.$#" count: 1 - path: tests/Doctrine/Tests/Common/DataFixtures/Executor/PHPCRExecutorTest.php + path: tests/Common/DataFixtures/Executor/PHPCRExecutorTest.php - message: "#^Call to an undefined method Doctrine\\\\ODM\\\\MongoDB\\\\DocumentManager\\:\\:getConnection\\(\\)\\.$#" count: 1 - path: tests/Doctrine/Tests/Common/DataFixtures/Purger/MongoDBPurgerTest.php + path: tests/Common/DataFixtures/Purger/MongoDBPurgerTest.php diff --git a/phpstan.neon.dist b/phpstan.neon.dist index cc184272..e2b42229 100644 --- a/phpstan.neon.dist +++ b/phpstan.neon.dist @@ -1,8 +1,8 @@ parameters: - phpVersion: 70100 + phpVersion: 80200 level: 3 paths: - - lib + - src - tests includes: diff --git a/phpunit.xml.dist b/phpunit.xml.dist index 1427ae9c..9374ffb2 100644 --- a/phpunit.xml.dist +++ b/phpunit.xml.dist @@ -8,13 +8,13 @@ > - ./tests/Doctrine/ + ./tests - - - ./lib/Doctrine/ - - + + + ./src + + diff --git a/psalm-baseline.xml b/psalm-baseline.xml index d1dbfaf4..ffd08cbd 100644 --- a/psalm-baseline.xml +++ b/psalm-baseline.xml @@ -1,6 +1,6 @@ - + DocumentManagerInterface @@ -9,7 +9,7 @@ DocumentManagerInterface - + ?DocumentManagerInterface DocumentManager @@ -21,7 +21,7 @@ DocumentManagerInterface|null - + PhpcrDocumentManager PhpcrDocumentManager diff --git a/psalm.xml b/psalm.xml index 478ab28b..13e08cc3 100644 --- a/psalm.xml +++ b/psalm.xml @@ -2,6 +2,8 @@ - + diff --git a/lib/Doctrine/Common/DataFixtures/AbstractFixture.php b/src/AbstractFixture.php similarity index 83% rename from lib/Doctrine/Common/DataFixtures/AbstractFixture.php rename to src/AbstractFixture.php index e47adec7..a7281c1e 100644 --- a/lib/Doctrine/Common/DataFixtures/AbstractFixture.php +++ b/src/AbstractFixture.php @@ -7,6 +7,8 @@ use BadMethodCallException; use Doctrine\Deprecations\Deprecation; +use function assert; + /** * Abstract Fixture class helps to manage references * between fixture classes in order to set relations @@ -17,7 +19,7 @@ abstract class AbstractFixture implements SharedFixtureInterface /** * Fixture reference repository * - * @var ReferenceRepository + * @var ReferenceRepository|null */ protected $referenceRepository; @@ -29,6 +31,13 @@ public function setReferenceRepository(ReferenceRepository $referenceRepository) $this->referenceRepository = $referenceRepository; } + private function getReferenceRepository(): ReferenceRepository + { + assert($this->referenceRepository !== null); + + return $this->referenceRepository; + } + /** * Set the reference entry identified by $name * and referenced to managed $object. If $name @@ -43,7 +52,7 @@ public function setReferenceRepository(ReferenceRepository $referenceRepository) */ public function setReference($name, $object) { - $this->referenceRepository->setReference($name, $object); + $this->getReferenceRepository()->setReference($name, $object); } /** @@ -63,7 +72,7 @@ public function setReference($name, $object) */ public function addReference($name, $object) { - $this->referenceRepository->addReference($name, $object); + $this->getReferenceRepository()->addReference($name, $object); } /** @@ -76,7 +85,7 @@ public function addReference($name, $object) * @psalm-param class-string|null $class * * @return object - * @psalm-return $class is null ? object : T + * @psalm-return ($class is null ? object : T) * * @template T of object */ @@ -91,7 +100,7 @@ public function getReference($name, ?string $class = null) ); } - return $this->referenceRepository->getReference($name, $class); + return $this->getReferenceRepository()->getReference($name, $class); } /** @@ -116,6 +125,6 @@ public function hasReference($name, ?string $class = null) ); } - return $this->referenceRepository->hasReference($name, $class); + return $this->getReferenceRepository()->hasReference($name, $class); } } diff --git a/lib/Doctrine/Common/DataFixtures/DependentFixtureInterface.php b/src/DependentFixtureInterface.php similarity index 100% rename from lib/Doctrine/Common/DataFixtures/DependentFixtureInterface.php rename to src/DependentFixtureInterface.php diff --git a/lib/Doctrine/Common/DataFixtures/Event/Listener/MongoDBReferenceListener.php b/src/Event/Listener/MongoDBReferenceListener.php similarity index 100% rename from lib/Doctrine/Common/DataFixtures/Event/Listener/MongoDBReferenceListener.php rename to src/Event/Listener/MongoDBReferenceListener.php diff --git a/lib/Doctrine/Common/DataFixtures/Event/Listener/ORMReferenceListener.php b/src/Event/Listener/ORMReferenceListener.php similarity index 100% rename from lib/Doctrine/Common/DataFixtures/Event/Listener/ORMReferenceListener.php rename to src/Event/Listener/ORMReferenceListener.php diff --git a/lib/Doctrine/Common/DataFixtures/Exception/CircularReferenceException.php b/src/Exception/CircularReferenceException.php similarity index 100% rename from lib/Doctrine/Common/DataFixtures/Exception/CircularReferenceException.php rename to src/Exception/CircularReferenceException.php diff --git a/lib/Doctrine/Common/DataFixtures/Executor/AbstractExecutor.php b/src/Executor/AbstractExecutor.php similarity index 100% rename from lib/Doctrine/Common/DataFixtures/Executor/AbstractExecutor.php rename to src/Executor/AbstractExecutor.php diff --git a/lib/Doctrine/Common/DataFixtures/Executor/MongoDBExecutor.php b/src/Executor/MongoDBExecutor.php similarity index 99% rename from lib/Doctrine/Common/DataFixtures/Executor/MongoDBExecutor.php rename to src/Executor/MongoDBExecutor.php index c11f83ed..70709b2b 100644 --- a/lib/Doctrine/Common/DataFixtures/Executor/MongoDBExecutor.php +++ b/src/Executor/MongoDBExecutor.php @@ -34,6 +34,7 @@ public function __construct(DocumentManager $dm, ?MongoDBPurger $purger = null) } parent::__construct($dm); + $this->listener = new MongoDBReferenceListener($this->referenceRepository); $dm->getEventManager()->addEventSubscriber($this->listener); } diff --git a/lib/Doctrine/Common/DataFixtures/Executor/MultipleTransactionORMExecutor.php b/src/Executor/MultipleTransactionORMExecutor.php similarity index 100% rename from lib/Doctrine/Common/DataFixtures/Executor/MultipleTransactionORMExecutor.php rename to src/Executor/MultipleTransactionORMExecutor.php diff --git a/lib/Doctrine/Common/DataFixtures/Executor/ORMExecutor.php b/src/Executor/ORMExecutor.php similarity index 100% rename from lib/Doctrine/Common/DataFixtures/Executor/ORMExecutor.php rename to src/Executor/ORMExecutor.php diff --git a/lib/Doctrine/Common/DataFixtures/Executor/ORMExecutorCommon.php b/src/Executor/ORMExecutorCommon.php similarity index 99% rename from lib/Doctrine/Common/DataFixtures/Executor/ORMExecutorCommon.php rename to src/Executor/ORMExecutorCommon.php index 6852845c..d08af6e1 100644 --- a/lib/Doctrine/Common/DataFixtures/Executor/ORMExecutorCommon.php +++ b/src/Executor/ORMExecutorCommon.php @@ -39,6 +39,7 @@ public function __construct(EntityManagerInterface $em, ?ORMPurgerInterface $pur } parent::__construct($em); + $this->listener = new ORMReferenceListener($this->referenceRepository); $em->getEventManager()->addEventSubscriber($this->listener); } diff --git a/lib/Doctrine/Common/DataFixtures/Executor/PHPCRExecutor.php b/src/Executor/PHPCRExecutor.php similarity index 100% rename from lib/Doctrine/Common/DataFixtures/Executor/PHPCRExecutor.php rename to src/Executor/PHPCRExecutor.php diff --git a/lib/Doctrine/Common/DataFixtures/FixtureInterface.php b/src/FixtureInterface.php similarity index 100% rename from lib/Doctrine/Common/DataFixtures/FixtureInterface.php rename to src/FixtureInterface.php diff --git a/lib/Doctrine/Common/DataFixtures/Loader.php b/src/Loader.php similarity index 97% rename from lib/Doctrine/Common/DataFixtures/Loader.php rename to src/Loader.php index 9ae3aa8b..9a5d42da 100644 --- a/lib/Doctrine/Common/DataFixtures/Loader.php +++ b/src/Loader.php @@ -358,14 +358,14 @@ private function orderFixturesByDependencies() $msg .= 'This case would produce a CircularReferenceException.'; throw new CircularReferenceException(sprintf($msg, implode(',', $unsequencedClasses))); - } else { - // We order the classes by sequence - asort($sequenceForClasses); + } - foreach ($sequenceForClasses as $class => $sequence) { - // If fixtures were ordered - $orderedFixtures[] = $this->fixtures[$class]; - } + // We order the classes by sequence + asort($sequenceForClasses); + + foreach ($sequenceForClasses as $class => $sequence) { + // If fixtures were ordered + $orderedFixtures[] = $this->fixtures[$class]; } $this->orderedFixtures = array_merge($this->orderedFixtures, $orderedFixtures); diff --git a/lib/Doctrine/Common/DataFixtures/OrderedFixtureInterface.php b/src/OrderedFixtureInterface.php similarity index 100% rename from lib/Doctrine/Common/DataFixtures/OrderedFixtureInterface.php rename to src/OrderedFixtureInterface.php diff --git a/lib/Doctrine/Common/DataFixtures/ProxyReferenceRepository.php b/src/ProxyReferenceRepository.php similarity index 100% rename from lib/Doctrine/Common/DataFixtures/ProxyReferenceRepository.php rename to src/ProxyReferenceRepository.php diff --git a/lib/Doctrine/Common/DataFixtures/Purger/MongoDBPurger.php b/src/Purger/MongoDBPurger.php similarity index 100% rename from lib/Doctrine/Common/DataFixtures/Purger/MongoDBPurger.php rename to src/Purger/MongoDBPurger.php diff --git a/lib/Doctrine/Common/DataFixtures/Purger/ORMPurger.php b/src/Purger/ORMPurger.php similarity index 100% rename from lib/Doctrine/Common/DataFixtures/Purger/ORMPurger.php rename to src/Purger/ORMPurger.php diff --git a/lib/Doctrine/Common/DataFixtures/Purger/ORMPurgerInterface.php b/src/Purger/ORMPurgerInterface.php similarity index 100% rename from lib/Doctrine/Common/DataFixtures/Purger/ORMPurgerInterface.php rename to src/Purger/ORMPurgerInterface.php diff --git a/lib/Doctrine/Common/DataFixtures/Purger/PHPCRPurger.php b/src/Purger/PHPCRPurger.php similarity index 100% rename from lib/Doctrine/Common/DataFixtures/Purger/PHPCRPurger.php rename to src/Purger/PHPCRPurger.php diff --git a/lib/Doctrine/Common/DataFixtures/Purger/PurgerInterface.php b/src/Purger/PurgerInterface.php similarity index 100% rename from lib/Doctrine/Common/DataFixtures/Purger/PurgerInterface.php rename to src/Purger/PurgerInterface.php diff --git a/lib/Doctrine/Common/DataFixtures/ReferenceRepository.php b/src/ReferenceRepository.php similarity index 99% rename from lib/Doctrine/Common/DataFixtures/ReferenceRepository.php rename to src/ReferenceRepository.php index e0659927..8f8279c1 100644 --- a/lib/Doctrine/Common/DataFixtures/ReferenceRepository.php +++ b/src/ReferenceRepository.php @@ -205,7 +205,7 @@ public function addReference($name, $object) * @psalm-param class-string|null $class * * @return object - * @psalm-return $class is null ? object : T + * @psalm-return ($class is null ? object : T) * * @throws OutOfBoundsException - if repository does not exist. * diff --git a/lib/Doctrine/Common/DataFixtures/SharedFixtureInterface.php b/src/SharedFixtureInterface.php similarity index 100% rename from lib/Doctrine/Common/DataFixtures/SharedFixtureInterface.php rename to src/SharedFixtureInterface.php diff --git a/lib/Doctrine/Common/DataFixtures/Sorter/TopologicalSorter.php b/src/Sorter/TopologicalSorter.php similarity index 100% rename from lib/Doctrine/Common/DataFixtures/Sorter/TopologicalSorter.php rename to src/Sorter/TopologicalSorter.php diff --git a/lib/Doctrine/Common/DataFixtures/Sorter/Vertex.php b/src/Sorter/Vertex.php similarity index 100% rename from lib/Doctrine/Common/DataFixtures/Sorter/Vertex.php rename to src/Sorter/Vertex.php diff --git a/tests/Doctrine/Tests/Common/DataFixtures/BaseTest.php b/tests/Common/DataFixtures/BaseTestCase.php similarity index 96% rename from tests/Doctrine/Tests/Common/DataFixtures/BaseTest.php rename to tests/Common/DataFixtures/BaseTestCase.php index c2b45489..efe7d255 100644 --- a/tests/Doctrine/Tests/Common/DataFixtures/BaseTest.php +++ b/tests/Common/DataFixtures/BaseTestCase.php @@ -11,7 +11,7 @@ /** * Base test class */ -abstract class BaseTest extends TestCase +abstract class BaseTestCase extends TestCase { /** * EntityManager mock object together with diff --git a/tests/Doctrine/Tests/Common/DataFixtures/DependentFixtureTest.php b/tests/Common/DataFixtures/DependentFixtureTest.php similarity index 99% rename from tests/Doctrine/Tests/Common/DataFixtures/DependentFixtureTest.php rename to tests/Common/DataFixtures/DependentFixtureTest.php index 9e95ce3e..044ade99 100644 --- a/tests/Doctrine/Tests/Common/DataFixtures/DependentFixtureTest.php +++ b/tests/Common/DataFixtures/DependentFixtureTest.php @@ -19,7 +19,7 @@ /** * Test Fixture ordering by dependencies. */ -class DependentFixtureTest extends BaseTest +class DependentFixtureTest extends BaseTestCase { public function testOrderFixturesByDependenciesOrderClassesWithASingleParent(): void { diff --git a/tests/Doctrine/Tests/Common/DataFixtures/Executor/ORMExecutorSharedFixtureTest.php b/tests/Common/DataFixtures/Executor/ORMExecutorSharedFixtureTest.php similarity index 98% rename from tests/Doctrine/Tests/Common/DataFixtures/Executor/ORMExecutorSharedFixtureTest.php rename to tests/Common/DataFixtures/Executor/ORMExecutorSharedFixtureTest.php index a27457dd..aefbceac 100644 --- a/tests/Doctrine/Tests/Common/DataFixtures/Executor/ORMExecutorSharedFixtureTest.php +++ b/tests/Common/DataFixtures/Executor/ORMExecutorSharedFixtureTest.php @@ -17,7 +17,7 @@ /** * Test referenced fixture execution */ -class ORMExecutorSharedFixtureTest extends BaseTest +class ORMExecutorSharedFixtureTest extends BaseTestCase { public const TEST_ENTITY_ROLE = Role::class; public const TEST_ENTITY_USER = User::class; diff --git a/tests/Doctrine/Tests/Common/DataFixtures/Executor/ORMExecutorTest.php b/tests/Common/DataFixtures/Executor/ORMExecutorTest.php similarity index 98% rename from tests/Doctrine/Tests/Common/DataFixtures/Executor/ORMExecutorTest.php rename to tests/Common/DataFixtures/Executor/ORMExecutorTest.php index 764c67fb..4b1ed870 100644 --- a/tests/Doctrine/Tests/Common/DataFixtures/Executor/ORMExecutorTest.php +++ b/tests/Common/DataFixtures/Executor/ORMExecutorTest.php @@ -11,13 +11,13 @@ use Doctrine\Common\DataFixtures\Purger\ORMPurger; use Doctrine\Common\EventManager; use Doctrine\ORM\EntityManagerInterface; -use Doctrine\Tests\Common\DataFixtures\BaseTest; +use Doctrine\Tests\Common\DataFixtures\BaseTestCase; use PHPUnit\Framework\MockObject\MockObject; /** * Test Fixture executor. */ -class ORMExecutorTest extends BaseTest +class ORMExecutorTest extends BaseTestCase { public function testExecuteWithNoPurge(): void { diff --git a/tests/Doctrine/Tests/Common/DataFixtures/Executor/PHPCRExecutorTest.php b/tests/Common/DataFixtures/Executor/PHPCRExecutorTest.php similarity index 98% rename from tests/Doctrine/Tests/Common/DataFixtures/Executor/PHPCRExecutorTest.php rename to tests/Common/DataFixtures/Executor/PHPCRExecutorTest.php index 3367a6dd..b9ccde9d 100644 --- a/tests/Doctrine/Tests/Common/DataFixtures/Executor/PHPCRExecutorTest.php +++ b/tests/Common/DataFixtures/Executor/PHPCRExecutorTest.php @@ -8,7 +8,7 @@ use Doctrine\Common\DataFixtures\FixtureInterface; use Doctrine\Common\DataFixtures\Purger\PHPCRPurger; use Doctrine\ODM\PHPCR\DocumentManager; -use Doctrine\Tests\Common\DataFixtures\BaseTest; +use Doctrine\Tests\Common\DataFixtures\BaseTestCase; use Exception; use PHPUnit\Framework\MockObject\MockObject; use Throwable; @@ -20,7 +20,7 @@ * * @covers \Doctrine\Common\DataFixtures\Executor\PHPCRExecutor */ -class PHPCRExecutorTest extends BaseTest +class PHPCRExecutorTest extends BaseTestCase { public function testExecuteSingleFixtureWithNoPurge(): void { diff --git a/tests/Doctrine/Tests/Common/DataFixtures/FixtureTest.php b/tests/Common/DataFixtures/FixtureTest.php similarity index 94% rename from tests/Doctrine/Tests/Common/DataFixtures/FixtureTest.php rename to tests/Common/DataFixtures/FixtureTest.php index a4c4e553..420ac722 100644 --- a/tests/Doctrine/Tests/Common/DataFixtures/FixtureTest.php +++ b/tests/Common/DataFixtures/FixtureTest.php @@ -10,7 +10,7 @@ /** * Test Fixture interface. */ -class FixtureTest extends BaseTest +class FixtureTest extends BaseTestCase { public function testFixtureInterface(): void { diff --git a/tests/Doctrine/Tests/Common/DataFixtures/LoaderTest.php b/tests/Common/DataFixtures/LoaderTest.php similarity index 98% rename from tests/Doctrine/Tests/Common/DataFixtures/LoaderTest.php rename to tests/Common/DataFixtures/LoaderTest.php index 988a3d6f..724bc983 100644 --- a/tests/Doctrine/Tests/Common/DataFixtures/LoaderTest.php +++ b/tests/Common/DataFixtures/LoaderTest.php @@ -13,7 +13,7 @@ /** * Test fixtures loader. */ -class LoaderTest extends BaseTest +class LoaderTest extends BaseTestCase { public function testLoadFromDirectory(): void { diff --git a/tests/Doctrine/Tests/Common/DataFixtures/OrderedFixtureTest.php b/tests/Common/DataFixtures/OrderedFixtureTest.php similarity index 97% rename from tests/Doctrine/Tests/Common/DataFixtures/OrderedFixtureTest.php rename to tests/Common/DataFixtures/OrderedFixtureTest.php index 580155ef..98189110 100644 --- a/tests/Doctrine/Tests/Common/DataFixtures/OrderedFixtureTest.php +++ b/tests/Common/DataFixtures/OrderedFixtureTest.php @@ -12,7 +12,7 @@ /** * Test Fixture ordering. */ -class OrderedFixtureTest extends BaseTest +class OrderedFixtureTest extends BaseTestCase { public function testFixtureOrder(): void { diff --git a/tests/Doctrine/Tests/Common/DataFixtures/ProxyReferenceRepositoryTest.php b/tests/Common/DataFixtures/ProxyReferenceRepositoryTest.php similarity index 99% rename from tests/Doctrine/Tests/Common/DataFixtures/ProxyReferenceRepositoryTest.php rename to tests/Common/DataFixtures/ProxyReferenceRepositoryTest.php index 3a609993..6821ec8f 100644 --- a/tests/Doctrine/Tests/Common/DataFixtures/ProxyReferenceRepositoryTest.php +++ b/tests/Common/DataFixtures/ProxyReferenceRepositoryTest.php @@ -17,7 +17,7 @@ /** * Test ProxyReferenceRepository. */ -class ProxyReferenceRepositoryTest extends BaseTest +class ProxyReferenceRepositoryTest extends BaseTestCase { public const TEST_ENTITY_ROLE = Role::class; public const TEST_ENTITY_LINK = Link::class; diff --git a/tests/Doctrine/Tests/Common/DataFixtures/Purger/MongoDBPurgerTest.php b/tests/Common/DataFixtures/Purger/MongoDBPurgerTest.php similarity index 93% rename from tests/Doctrine/Tests/Common/DataFixtures/Purger/MongoDBPurgerTest.php rename to tests/Common/DataFixtures/Purger/MongoDBPurgerTest.php index 26a4a7a3..c32f8742 100644 --- a/tests/Doctrine/Tests/Common/DataFixtures/Purger/MongoDBPurgerTest.php +++ b/tests/Common/DataFixtures/Purger/MongoDBPurgerTest.php @@ -4,12 +4,11 @@ namespace Doctrine\Tests\Common\DataFixtures\Purger; -use Doctrine\Common\Annotations\AnnotationRegistry; use Doctrine\Common\DataFixtures\Purger\MongoDBPurger; use Doctrine\ODM\MongoDB\Configuration; use Doctrine\ODM\MongoDB\DocumentManager; use Doctrine\ODM\MongoDB\Mapping\Driver\AnnotationDriver; -use Doctrine\Tests\Common\DataFixtures\BaseTest; +use Doctrine\Tests\Common\DataFixtures\BaseTestCase; use Doctrine\Tests\Common\DataFixtures\TestDocument\Role; use MongoCollection; use MongoDB\Collection; @@ -19,7 +18,7 @@ use function dirname; use function method_exists; -class MongoDBPurgerTest extends BaseTest +class MongoDBPurgerTest extends BaseTestCase { public const TEST_DOCUMENT_ROLE = Role::class; @@ -38,8 +37,6 @@ private function getDocumentManager(): DocumentManager $config->setHydratorNamespace('Hydrators'); $config->setMetadataDriverImpl(AnnotationDriver::create(dirname(__DIR__) . '/TestDocument')); - AnnotationRegistry::registerLoader('class_exists'); - $dm = DocumentManager::create(null, $config); $this->skipIfMongoDBUnavailable($dm); diff --git a/tests/Doctrine/Tests/Common/DataFixtures/Purger/ORMPurgerExcludeTest.php b/tests/Common/DataFixtures/Purger/ORMPurgerExcludeTest.php similarity index 98% rename from tests/Doctrine/Tests/Common/DataFixtures/Purger/ORMPurgerExcludeTest.php rename to tests/Common/DataFixtures/Purger/ORMPurgerExcludeTest.php index fb633b06..462c9ca6 100644 --- a/tests/Doctrine/Tests/Common/DataFixtures/Purger/ORMPurgerExcludeTest.php +++ b/tests/Common/DataFixtures/Purger/ORMPurgerExcludeTest.php @@ -16,7 +16,7 @@ use function method_exists; use function preg_match; -class ORMPurgerExcludeTest extends BaseTest +class ORMPurgerExcludeTest extends BaseTestCase { public const TEST_ENTITY_INCLUDED = IncludedEntity::class; public const TEST_ENTITY_EXCLUDED = ExcludedEntity::class; diff --git a/tests/Doctrine/Tests/Common/DataFixtures/Purger/ORMPurgerTest.php b/tests/Common/DataFixtures/Purger/ORMPurgerTest.php similarity index 98% rename from tests/Doctrine/Tests/Common/DataFixtures/Purger/ORMPurgerTest.php rename to tests/Common/DataFixtures/Purger/ORMPurgerTest.php index 02874278..a9509f0e 100644 --- a/tests/Doctrine/Tests/Common/DataFixtures/Purger/ORMPurgerTest.php +++ b/tests/Common/DataFixtures/Purger/ORMPurgerTest.php @@ -10,7 +10,7 @@ /** * Doctrine\Tests\Common\DataFixtures\ORMPurgerTest */ -class ORMPurgerTest extends BaseTest +class ORMPurgerTest extends BaseTestCase { public const TEST_ENTITY_USER = TestEntity\User::class; public const TEST_ENTITY_USER_WITH_SCHEMA = TestEntity\UserWithSchema::class; diff --git a/tests/Doctrine/Tests/Common/DataFixtures/ReferenceRepositoryTest.php b/tests/Common/DataFixtures/ReferenceRepositoryTest.php similarity index 99% rename from tests/Doctrine/Tests/Common/DataFixtures/ReferenceRepositoryTest.php rename to tests/Common/DataFixtures/ReferenceRepositoryTest.php index f5102335..794ff51e 100644 --- a/tests/Doctrine/Tests/Common/DataFixtures/ReferenceRepositoryTest.php +++ b/tests/Common/DataFixtures/ReferenceRepositoryTest.php @@ -15,7 +15,7 @@ use Doctrine\Tests\Common\DataFixtures\TestEntity\Role; use OutOfBoundsException; -class ReferenceRepositoryTest extends BaseTest +class ReferenceRepositoryTest extends BaseTestCase { public function testReferenceEntry(): void { diff --git a/tests/Doctrine/Tests/Common/DataFixtures/Sorter/TopologicalSorterTest.php b/tests/Common/DataFixtures/Sorter/TopologicalSorterTest.php similarity index 97% rename from tests/Doctrine/Tests/Common/DataFixtures/Sorter/TopologicalSorterTest.php rename to tests/Common/DataFixtures/Sorter/TopologicalSorterTest.php index d482c9a2..e5db2e7b 100644 --- a/tests/Doctrine/Tests/Common/DataFixtures/Sorter/TopologicalSorterTest.php +++ b/tests/Common/DataFixtures/Sorter/TopologicalSorterTest.php @@ -7,7 +7,7 @@ use Doctrine\Common\DataFixtures\Exception\CircularReferenceException; use Doctrine\Common\DataFixtures\Sorter\TopologicalSorter; use Doctrine\ORM\Mapping\ClassMetadata; -use Doctrine\Tests\Common\DataFixtures\BaseTest; +use Doctrine\Tests\Common\DataFixtures\BaseTestCase; use RuntimeException; /** @@ -19,7 +19,7 @@ * * @covers \Doctrine\Common\DataFixtures\Sorter\TopologicalSorter */ -class TopologicalSorterTest extends BaseTest +class TopologicalSorterTest extends BaseTestCase { public function testSuccessSortLinearDependency(): void { diff --git a/tests/Doctrine/Tests/Common/DataFixtures/Sorter/VertexTest.php b/tests/Common/DataFixtures/Sorter/VertexTest.php similarity index 85% rename from tests/Doctrine/Tests/Common/DataFixtures/Sorter/VertexTest.php rename to tests/Common/DataFixtures/Sorter/VertexTest.php index 8be83350..1f856524 100644 --- a/tests/Doctrine/Tests/Common/DataFixtures/Sorter/VertexTest.php +++ b/tests/Common/DataFixtures/Sorter/VertexTest.php @@ -6,10 +6,10 @@ use Doctrine\Common\DataFixtures\Sorter\Vertex; use Doctrine\ORM\Mapping\ClassMetadata; -use Doctrine\Tests\Common\DataFixtures\BaseTest; +use Doctrine\Tests\Common\DataFixtures\BaseTestCase; /** @covers \Doctrine\Common\DataFixtures\Sorter\Vertex */ -class VertexTest extends BaseTest +class VertexTest extends BaseTestCase { public function testNode(): void { diff --git a/tests/Doctrine/Tests/Common/DataFixtures/TestDocument/Role.php b/tests/Common/DataFixtures/TestDocument/Role.php similarity index 100% rename from tests/Doctrine/Tests/Common/DataFixtures/TestDocument/Role.php rename to tests/Common/DataFixtures/TestDocument/Role.php diff --git a/tests/Doctrine/Tests/Common/DataFixtures/TestEntity/Group.php b/tests/Common/DataFixtures/TestEntity/Group.php similarity index 100% rename from tests/Doctrine/Tests/Common/DataFixtures/TestEntity/Group.php rename to tests/Common/DataFixtures/TestEntity/Group.php diff --git a/tests/Doctrine/Tests/Common/DataFixtures/TestEntity/GroupWithSchema.php b/tests/Common/DataFixtures/TestEntity/GroupWithSchema.php similarity index 100% rename from tests/Doctrine/Tests/Common/DataFixtures/TestEntity/GroupWithSchema.php rename to tests/Common/DataFixtures/TestEntity/GroupWithSchema.php diff --git a/tests/Doctrine/Tests/Common/DataFixtures/TestEntity/Link.php b/tests/Common/DataFixtures/TestEntity/Link.php similarity index 100% rename from tests/Doctrine/Tests/Common/DataFixtures/TestEntity/Link.php rename to tests/Common/DataFixtures/TestEntity/Link.php diff --git a/tests/Doctrine/Tests/Common/DataFixtures/TestEntity/Quoted.php b/tests/Common/DataFixtures/TestEntity/Quoted.php similarity index 100% rename from tests/Doctrine/Tests/Common/DataFixtures/TestEntity/Quoted.php rename to tests/Common/DataFixtures/TestEntity/Quoted.php diff --git a/tests/Doctrine/Tests/Common/DataFixtures/TestEntity/Role.php b/tests/Common/DataFixtures/TestEntity/Role.php similarity index 100% rename from tests/Doctrine/Tests/Common/DataFixtures/TestEntity/Role.php rename to tests/Common/DataFixtures/TestEntity/Role.php diff --git a/tests/Doctrine/Tests/Common/DataFixtures/TestEntity/User.php b/tests/Common/DataFixtures/TestEntity/User.php similarity index 100% rename from tests/Doctrine/Tests/Common/DataFixtures/TestEntity/User.php rename to tests/Common/DataFixtures/TestEntity/User.php diff --git a/tests/Doctrine/Tests/Common/DataFixtures/TestEntity/UserWithSchema.php b/tests/Common/DataFixtures/TestEntity/UserWithSchema.php similarity index 100% rename from tests/Doctrine/Tests/Common/DataFixtures/TestEntity/UserWithSchema.php rename to tests/Common/DataFixtures/TestEntity/UserWithSchema.php diff --git a/tests/Doctrine/Tests/Common/DataFixtures/TestFixtures/MyFixture1.php b/tests/Common/DataFixtures/TestFixtures/MyFixture1.php similarity index 100% rename from tests/Doctrine/Tests/Common/DataFixtures/TestFixtures/MyFixture1.php rename to tests/Common/DataFixtures/TestFixtures/MyFixture1.php diff --git a/tests/Doctrine/Tests/Common/DataFixtures/TestFixtures/MyFixture2.php b/tests/Common/DataFixtures/TestFixtures/MyFixture2.php similarity index 100% rename from tests/Doctrine/Tests/Common/DataFixtures/TestFixtures/MyFixture2.php rename to tests/Common/DataFixtures/TestFixtures/MyFixture2.php diff --git a/tests/Doctrine/Tests/Common/DataFixtures/TestFixtures/NotAFixture.php b/tests/Common/DataFixtures/TestFixtures/NotAFixture.php similarity index 100% rename from tests/Doctrine/Tests/Common/DataFixtures/TestFixtures/NotAFixture.php rename to tests/Common/DataFixtures/TestFixtures/NotAFixture.php diff --git a/tests/Doctrine/Tests/Common/DataFixtures/TestFixtures/RoleFixture.php b/tests/Common/DataFixtures/TestFixtures/RoleFixture.php similarity index 100% rename from tests/Doctrine/Tests/Common/DataFixtures/TestFixtures/RoleFixture.php rename to tests/Common/DataFixtures/TestFixtures/RoleFixture.php diff --git a/tests/Doctrine/Tests/Common/DataFixtures/TestFixtures/UserFixture.php b/tests/Common/DataFixtures/TestFixtures/UserFixture.php similarity index 100% rename from tests/Doctrine/Tests/Common/DataFixtures/TestFixtures/UserFixture.php rename to tests/Common/DataFixtures/TestFixtures/UserFixture.php diff --git a/tests/Doctrine/Tests/Common/DataFixtures/TestPurgeEntity/ExcludedEntity.php b/tests/Common/DataFixtures/TestPurgeEntity/ExcludedEntity.php similarity index 100% rename from tests/Doctrine/Tests/Common/DataFixtures/TestPurgeEntity/ExcludedEntity.php rename to tests/Common/DataFixtures/TestPurgeEntity/ExcludedEntity.php diff --git a/tests/Doctrine/Tests/Common/DataFixtures/TestPurgeEntity/IncludedEntity.php b/tests/Common/DataFixtures/TestPurgeEntity/IncludedEntity.php similarity index 100% rename from tests/Doctrine/Tests/Common/DataFixtures/TestPurgeEntity/IncludedEntity.php rename to tests/Common/DataFixtures/TestPurgeEntity/IncludedEntity.php diff --git a/tests/Doctrine/Tests/Common/DataFixtures/TestTypes/UuidType.php b/tests/Common/DataFixtures/TestTypes/UuidType.php similarity index 100% rename from tests/Doctrine/Tests/Common/DataFixtures/TestTypes/UuidType.php rename to tests/Common/DataFixtures/TestTypes/UuidType.php diff --git a/tests/Doctrine/Tests/Common/DataFixtures/TestValueObjects/Uuid.php b/tests/Common/DataFixtures/TestValueObjects/Uuid.php similarity index 100% rename from tests/Doctrine/Tests/Common/DataFixtures/TestValueObjects/Uuid.php rename to tests/Common/DataFixtures/TestValueObjects/Uuid.php diff --git a/tests/Doctrine/Tests/Mock/Node.php b/tests/Mock/Node.php similarity index 100% rename from tests/Doctrine/Tests/Mock/Node.php rename to tests/Mock/Node.php