From 9e8232b91935b982ba1b22bdcee1c6fe56470ff9 Mon Sep 17 00:00:00 2001 From: Fran Moreno Date: Tue, 6 Apr 2021 08:53:44 +0200 Subject: [PATCH] Use real classes for tests --- .../Tests/Persistence/Mapping/DriverChainTest.php | 14 +++++++------- .../Mapping/Fixtures/Manager/Manager.php | 9 +++++++++ .../Tests/Persistence/Mapping/Fixtures/Model.php | 9 +++++++++ 3 files changed, 25 insertions(+), 7 deletions(-) create mode 100644 tests/Doctrine/Tests/Persistence/Mapping/Fixtures/Manager/Manager.php create mode 100644 tests/Doctrine/Tests/Persistence/Mapping/Fixtures/Model.php diff --git a/tests/Doctrine/Tests/Persistence/Mapping/DriverChainTest.php b/tests/Doctrine/Tests/Persistence/Mapping/DriverChainTest.php index 66ca5936..abef8a04 100644 --- a/tests/Doctrine/Tests/Persistence/Mapping/DriverChainTest.php +++ b/tests/Doctrine/Tests/Persistence/Mapping/DriverChainTest.php @@ -7,6 +7,8 @@ use Doctrine\Persistence\Mapping\Driver\MappingDriverChain; use Doctrine\Persistence\Mapping\MappingException; use Doctrine\Tests\DoctrineTestCase; +use Doctrine\Tests\Persistence\Mapping\Fixtures\Manager\Manager; +use Doctrine\Tests\Persistence\Mapping\Fixtures\Model; use stdClass; class DriverChainTest extends DoctrineTestCase @@ -93,12 +95,10 @@ public function testIsTransient(): void */ public function testDefaultDriver(): void { - $companyDriver = $this->createMock(MappingDriver::class); - $defaultDriver = $this->createMock(MappingDriver::class); - /** @psalm-var class-string */ - $entityClassName = 'Doctrine\Tests\ORM\Mapping\DriverChainEntity'; - /** @psalm-var class-string */ - $managerClassName = 'Doctrine\Tests\Models\Company\CompanyManager'; + $companyDriver = $this->createMock(MappingDriver::class); + $defaultDriver = $this->createMock(MappingDriver::class); + $entityClassName = Model::class; + $managerClassName = Manager::class; $chain = new MappingDriverChain(); $companyDriver->expects($this->never()) @@ -118,7 +118,7 @@ public function testDefaultDriver(): void self::assertNull($chain->getDefaultDriver()); $chain->setDefaultDriver($defaultDriver); - $chain->addDriver($companyDriver, 'Doctrine\Tests\Models\Company'); + $chain->addDriver($companyDriver, 'Doctrine\Tests\Persistence\Mapping\Fixtures\Manager'); self::assertSame($defaultDriver, $chain->getDefaultDriver()); diff --git a/tests/Doctrine/Tests/Persistence/Mapping/Fixtures/Manager/Manager.php b/tests/Doctrine/Tests/Persistence/Mapping/Fixtures/Manager/Manager.php new file mode 100644 index 00000000..8a891bc8 --- /dev/null +++ b/tests/Doctrine/Tests/Persistence/Mapping/Fixtures/Manager/Manager.php @@ -0,0 +1,9 @@ +