From 6f6d98bbe5982a4e5031673333561a23df4a8175 Mon Sep 17 00:00:00 2001 From: madflow Date: Fri, 15 Mar 2024 16:51:51 +0100 Subject: [PATCH] fix: add failing tests --- tests/GeneratorTest.php | 8 ++++++++ tests/Maker/MakeEntityTest.php | 13 +++++++++++++ 2 files changed, 21 insertions(+) diff --git a/tests/GeneratorTest.php b/tests/GeneratorTest.php index 9c1c85f84..57865e94c 100644 --- a/tests/GeneratorTest.php +++ b/tests/GeneratorTest.php @@ -100,5 +100,13 @@ public function getClassNameDetailsTests(): \Generator 'Symfony\\Bundle\\MakerBundle\\Tests\\GeneratorTest', 'Symfony\\Bundle\\MakerBundle\\Tests\\GeneratorTest', ]; + + yield 'simple_class_with_name_collision' => [ + 'locale', + 'Controller\\', + '', + 'App\\Controller\\Locale', + 'Locale', + ]; } } diff --git a/tests/Maker/MakeEntityTest.php b/tests/Maker/MakeEntityTest.php index 0efdfe117..4b2fa77f4 100644 --- a/tests/Maker/MakeEntityTest.php +++ b/tests/Maker/MakeEntityTest.php @@ -631,6 +631,19 @@ public function getTestDetails(): \Generator $this->assertFileExists($runner->getPath('src/Entity/User.php')); }), ]; + + yield 'it_creates_a_new_class_with_name_collision' => [$this->createMakeEntityTest() + ->run(function (MakerTestRunner $runner) { + $runner->runMaker([ + // entity class name + 'Locale', + // add not additional fields + '', + ]); + + $this->runEntityTest($runner); + }), + ]; } private function runEntityTest(MakerTestRunner $runner, array $data = []): void