From 1a11c07ce1f994c64f71ea75e580829ce00f1472 Mon Sep 17 00:00:00 2001 From: Tom H Anderson Date: Sat, 26 Oct 2024 17:40:25 -0600 Subject: [PATCH 1/2] Moved entities to Assets dir --- tests/{ => Assets}/Entity/Scientist.php | 2 +- tests/{ => Assets}/Entity/Theory.php | 4 ++-- tests/Feature/IlluminateRegistryTest.php | 19 +++++++++---------- 3 files changed, 12 insertions(+), 13 deletions(-) rename tests/{ => Assets}/Entity/Scientist.php (91%) rename tests/{ => Assets}/Entity/Theory.php (75%) diff --git a/tests/Entity/Scientist.php b/tests/Assets/Entity/Scientist.php similarity index 91% rename from tests/Entity/Scientist.php rename to tests/Assets/Entity/Scientist.php index 4aaa326e..5430fe16 100644 --- a/tests/Entity/Scientist.php +++ b/tests/Assets/Entity/Scientist.php @@ -1,6 +1,6 @@ shouldReceive('isTransient') - ->with('LaravelDoctrineTest\ORM\Entity\Scientist') + ->with('LaravelDoctrineTest\ORM\Assets\Entity\Scientist') ->once() ->andReturnFalse(); $metadata = m::mock(\Doctrine\Persistence\Mapping\ClassMetadata::class); $metadata->shouldReceive('getName') ->once() - ->andReturn('LaravelDoctrineTest\ORM\Entity\Scientist'); + ->andReturn('LaravelDoctrineTest\ORM\Assets\Entity\Scientist'); $metadataFactory->shouldReceive('getAllMetadata') ->once() @@ -439,7 +438,7 @@ public function testGetManagerForClass(): void $entityManager->shouldReceive('getMetadataFactory') ->andReturn($metadataFactory); - $this->assertEquals($entityManager, $this->registry->getManagerForClass('LaravelDoctrineTest\ORM\Entity\Scientist')); + $this->assertEquals($entityManager, $this->registry->getManagerForClass('LaravelDoctrineTest\ORM\Assets\Entity\Scientist')); } public function testGetManagerForClassWithNamespace(): void @@ -457,21 +456,21 @@ public function testGetManagerForClassWithNamespace(): void $configuration->shouldReceive('getEntityNamespace') ->with('Alias') ->once() - ->andReturn('LaravelDoctrineTest\ORM\Entity'); + ->andReturn('LaravelDoctrineTest\ORM\Assets\Entity'); $entityManager->shouldReceive('getConfiguration')->andReturn($configuration); $metadataFactory = m::mock(\Doctrine\ORM\Mapping\ClassMetadataFactory::class); $metadataFactory->shouldReceive('isTransient') - ->with('LaravelDoctrineTest\ORM\Entity\Scientist') + ->with('LaravelDoctrineTest\ORM\Assets\Entity\Scientist') ->once() ->andReturnFalse(); $metadata = m::mock(\Doctrine\Persistence\Mapping\ClassMetadata::class); $metadata->shouldReceive('getName') ->once() - ->andReturn('LaravelDoctrineTest\ORM\Entity\Scientist'); + ->andReturn('LaravelDoctrineTest\ORM\Assets\Entity\Scientist'); $metadataFactory->shouldReceive('getAllMetadata') ->once() @@ -497,14 +496,14 @@ public function testGetManagerForClassThrowsExceptionWhenNotFound(): void $metadataFactory = m::mock(\Doctrine\ORM\Mapping\ClassMetadataFactory::class); $metadataFactory->shouldReceive('isTransient') - ->with('LaravelDoctrineTest\ORM\Entity\Scientist') + ->with('LaravelDoctrineTest\ORM\Assets\Entity\Scientist') ->once() ->andReturnFalse(); $metadata = m::mock(\Doctrine\Persistence\Mapping\ClassMetadata::class); $metadata->shouldReceive('getName') ->once() - ->andReturn('LaravelDoctrineTest\ORM\Entity\Theory'); + ->andReturn('LaravelDoctrineTest\ORM\Assets\Entity\Theory'); $metadataFactory->shouldReceive('getAllMetadata') ->once() @@ -513,7 +512,7 @@ public function testGetManagerForClassThrowsExceptionWhenNotFound(): void $entityManager->shouldReceive('getMetadataFactory') ->andReturn($metadataFactory); - $this->assertEquals($entityManager, $this->registry->getManagerForClass('LaravelDoctrineTest\ORM\Entity\Scientist')); + $this->assertEquals($entityManager, $this->registry->getManagerForClass('LaravelDoctrineTest\ORM\Assets\Entity\Scientist')); } public function testGetManagerForClassInvalidClass(): void From 5e71eb5a7c0f60648c832fe55263d7e4989abbe4 Mon Sep 17 00:00:00 2001 From: Tom H Anderson Date: Sat, 26 Oct 2024 17:44:55 -0600 Subject: [PATCH 2/2] Added asset repositories --- tests/Assets/Entity/Scientist.php | 2 +- tests/Assets/Repository/ScientistRepository.php | 9 +++++++++ tests/Assets/Repository/TheoryRepository.php | 9 +++++++++ 3 files changed, 19 insertions(+), 1 deletion(-) create mode 100644 tests/Assets/Repository/ScientistRepository.php create mode 100644 tests/Assets/Repository/TheoryRepository.php diff --git a/tests/Assets/Entity/Scientist.php b/tests/Assets/Entity/Scientist.php index 5430fe16..4c14f89c 100644 --- a/tests/Assets/Entity/Scientist.php +++ b/tests/Assets/Entity/Scientist.php @@ -4,7 +4,7 @@ use Doctrine\ORM\Mapping as ORM; -#[ORM\Entity(repositoryClass: "App\Doctrine\ORM\Repository\ScientistRepository")] +#[ORM\Entity(repositoryClass: "LaravelDoctrineTest\ORM\Assets\Repository\ScientistRepository")] class Scientist { #[ORM\Id] diff --git a/tests/Assets/Repository/ScientistRepository.php b/tests/Assets/Repository/ScientistRepository.php new file mode 100644 index 00000000..fcace610 --- /dev/null +++ b/tests/Assets/Repository/ScientistRepository.php @@ -0,0 +1,9 @@ +