diff --git a/src/Filesystem/ZddMessageFilesystem.php b/src/Filesystem/ZddMessageFilesystem.php index 6135762..7f6903c 100644 --- a/src/Filesystem/ZddMessageFilesystem.php +++ b/src/Filesystem/ZddMessageFilesystem.php @@ -67,8 +67,9 @@ public function exists(string $messageFqcn): bool private function getDirectoryAndShortname(string $classFqcn): array { $path = explode('\\', $classFqcn); - $directory = $path[\count($path) - 2]; $shortName = end($path); + array_pop($path); + $directory = implode('/', $path); return [$directory, $shortName]; } diff --git a/tests/Fixtures/App/Messages/Config/MessageConfig.php b/tests/Fixtures/App/Messages/Config/MessageConfig.php index fdf1975..a09f596 100644 --- a/tests/Fixtures/App/Messages/Config/MessageConfig.php +++ b/tests/Fixtures/App/Messages/Config/MessageConfig.php @@ -9,6 +9,7 @@ use Yousign\ZddMessageBundle\Tests\Fixtures\App\Messages\DummyMessageWithPrivateConstructor; use Yousign\ZddMessageBundle\Tests\Fixtures\App\Messages\Input\Locale; use Yousign\ZddMessageBundle\Tests\Fixtures\App\Messages\Input\Status; +use Yousign\ZddMessageBundle\Tests\Fixtures\App\Messages\Other; class MessageConfig implements ZddMessageConfigInterface { @@ -21,6 +22,7 @@ public function getMessageToAssert(): array DummyMessageWithNullableNumberProperty::class, DummyMessageWithPrivateConstructor::class, DummyMessageWithAllManagedTypes::class, + Other\DummyMessage::class, ]; } diff --git a/tests/Fixtures/App/Messages/Other/DummyMessage.php b/tests/Fixtures/App/Messages/Other/DummyMessage.php new file mode 100644 index 0000000..0502851 --- /dev/null +++ b/tests/Fixtures/App/Messages/Other/DummyMessage.php @@ -0,0 +1,11 @@ +command = new CommandTester((new Application($kernel))->find('yousign:zdd-message:generate')); $customBasePathFile = $kernel->getContainer()->getParameter('custom_path_file'); - $this->serializedMessagesDir = $customBasePathFile.'/Messages'; + $this->serializedMessagesDir = $customBasePathFile.'/Yousign/ZddMessageBundle/Tests/Fixtures/App/Messages'; } protected function tearDown(): void @@ -49,6 +49,7 @@ public function testThatCommandIsSuccessful(): void 2 Yousign\ZddMessageBundle\Tests\Fixtures\App\Messages\DummyMessageWithNullableNumberProperty 3 Yousign\ZddMessageBundle\Tests\Fixtures\App\Messages\DummyMessageWithPrivateConstructor 4 Yousign\ZddMessageBundle\Tests\Fixtures\App\Messages\DummyMessageWithAllManagedTypes + 5 Yousign\ZddMessageBundle\Tests\Fixtures\App\Messages\Other\DummyMessage --- --------------------------------------------------------------------------------------------- EOF; diff --git a/tests/Func/ListZddMessageCommandTest.php b/tests/Func/ListZddMessageCommandTest.php index 8782bf9..3670f7a 100644 --- a/tests/Func/ListZddMessageCommandTest.php +++ b/tests/Func/ListZddMessageCommandTest.php @@ -30,6 +30,7 @@ public function testCommandIsSuccess(): void 2 Yousign\ZddMessageBundle\Tests\Fixtures\App\Messages\DummyMessageWithNullableNumberProperty 3 Yousign\ZddMessageBundle\Tests\Fixtures\App\Messages\DummyMessageWithPrivateConstructor 4 Yousign\ZddMessageBundle\Tests\Fixtures\App\Messages\DummyMessageWithAllManagedTypes + 5 Yousign\ZddMessageBundle\Tests\Fixtures\App\Messages\Other\DummyMessage --- --------------------------------------------------------------------------------------------- EOF; diff --git a/tests/Func/ValidateZddMessageCommandTest.php b/tests/Func/ValidateZddMessageCommandTest.php index 448b0d8..aaaaaef 100644 --- a/tests/Func/ValidateZddMessageCommandTest.php +++ b/tests/Func/ValidateZddMessageCommandTest.php @@ -22,7 +22,7 @@ protected function setUp(): void $kernel = self::bootKernel(); $this->command = new CommandTester((new Application(self::$kernel))->find('yousign:zdd-message:validate')); $customBasePathFile = $kernel->getContainer()->getParameter('custom_path_file'); - $this->serializedMessagesDir = $customBasePathFile.'/Messages'; + $this->serializedMessagesDir = $customBasePathFile.'/Yousign/ZddMessageBundle/Tests/Fixtures/App/Messages'; MessageConfig::$messagesToAssert = [ DummyMessage::class,