diff --git a/tests/Assets/Extensions/ExtensionMock.php b/tests/Assets/Extensions/ExtensionMock.php new file mode 100644 index 00000000..e09e849f --- /dev/null +++ b/tests/Assets/Extensions/ExtensionMock.php @@ -0,0 +1,25 @@ +assertTrue(true); + } + + /** + * @return mixed[] + */ + public function getFilters(): array + { + return []; + } +} diff --git a/tests/Assets/Extensions/ExtensionMock2.php b/tests/Assets/Extensions/ExtensionMock2.php new file mode 100644 index 00000000..b4c7c636 --- /dev/null +++ b/tests/Assets/Extensions/ExtensionMock2.php @@ -0,0 +1,22 @@ + 'FilterMock', + 'filter2' => 'FilterMock' + ]; + } +} diff --git a/tests/Feature/Extensions/ExtensionManagerTest.php b/tests/Feature/Extensions/ExtensionManagerTest.php index 49fc433e..5b2cfeeb 100644 --- a/tests/Feature/Extensions/ExtensionManagerTest.php +++ b/tests/Feature/Extensions/ExtensionManagerTest.php @@ -1,13 +1,18 @@ em = m::mock(EntityManagerInterface::class); $this->evm = m::mock(EventManager::class); $this->configuration = m::mock(Configuration::class); - $this->driver = m::mock(\Doctrine\ORM\Mapping\Driver\XmlDriver::class); - $this->reader = m::mock(Reader::class); + $this->driver = m::mock(XmlDriver::class); $this->manager = $this->newManager(); } @@ -93,7 +92,7 @@ public function test_boot_manager_with_one_manager_and_one_extension() // Should be inside booted extensions now $booted = $this->manager->getBootedExtensions(); - $this->assertTrue($booted['default']['ExtensionMock']); + $this->assertTrue((bool) $booted['default']['LaravelDoctrineTest\ORM\Assets\Extensions\ExtensionMock']); } public function test_boot_manager_with_two_managers_and_one_extension() @@ -114,8 +113,8 @@ public function test_boot_manager_with_two_managers_and_one_extension() // Should be inside booted extensions now $booted = $this->manager->getBootedExtensions(); - $this->assertTrue($booted['default']['ExtensionMock']); - $this->assertTrue($booted['custom']['ExtensionMock']); + $this->assertTrue((bool) $booted['default']['LaravelDoctrineTest\ORM\Assets\Extensions\ExtensionMock']); + $this->assertTrue((bool) $booted['custom']['LaravelDoctrineTest\ORM\Assets\Extensions\ExtensionMock']); } public function test_boot_manager_with_one_manager_and_two_extensions() @@ -138,8 +137,8 @@ public function test_boot_manager_with_one_manager_and_two_extensions() // Should be inside booted extensions now $booted = $this->manager->getBootedExtensions(); - $this->assertTrue($booted['default']['ExtensionMock']); - $this->assertTrue($booted['default']['ExtensionMock2']); + $this->assertTrue((bool) $booted['default']['LaravelDoctrineTest\ORM\Assets\Extensions\ExtensionMock']); + $this->assertTrue((bool) $booted['default']['LaravelDoctrineTest\ORM\Assets\Extensions\ExtensionMock2']); } public function test_extension_will_only_be_booted_once() @@ -161,7 +160,7 @@ public function test_extension_will_only_be_booted_once() // Should be inside booted extensions now $booted = $this->manager->getBootedExtensions(); - $this->assertTrue($booted['default']['ExtensionMock']); + $this->assertTrue((bool) $booted['default']['LaravelDoctrineTest\ORM\Assets\Extensions\ExtensionMock']); } public function test_filters_get_registered_on_boot() @@ -191,7 +190,8 @@ public function test_filters_get_registered_on_boot() // Should be inside booted extensions now $booted = $this->manager->getBootedExtensions(); - $this->assertTrue($booted['default']['ExtensionWithFiltersMock']); + + $this->assertTrue((bool) $booted['default']['LaravelDoctrineTest\ORM\Assets\Extensions\ExtensionWithFiltersMock']); } protected function tearDown(): void @@ -206,53 +206,3 @@ protected function newManager() return new ExtensionManager($this->container); } } - -class ExtensionMock implements Extension -{ - public function addSubscribers(EventManager $manager, EntityManagerInterface $em): void - { - // Confirm it get's called - (new ExtensionManagerTest)->assertTrue(true); - } - - /** - * @return mixed[] - */ - public function getFilters(): array - { - return []; - } -} - -class ExtensionMock2 implements Extension -{ - public function addSubscribers(EventManager $manager, EntityManagerInterface $em): void - { - } - - /** - * @return mixed[] - */ - public function getFilters(): array - { - return []; - } -} - -class ExtensionWithFiltersMock implements Extension -{ - public function addSubscribers(EventManager $manager, EntityManagerInterface $em): void - { - } - - /** - * @return mixed[] - */ - public function getFilters(): array - { - return [ - 'filter' => 'FilterMock', - 'filter2' => 'FilterMock' - ]; - } -} diff --git a/tests/Feature/Extensions/MappingDriverChainTest.php b/tests/Feature/Extensions/MappingDriverChainTest.php index 283688e3..0da97cbe 100644 --- a/tests/Feature/Extensions/MappingDriverChainTest.php +++ b/tests/Feature/Extensions/MappingDriverChainTest.php @@ -1,5 +1,7 @@