diff --git a/src/Symfony/Component/Translation/Tests/Extractor/Visitor/TransMethodVisitorTest.php b/src/Symfony/Component/Translation/Tests/Extractor/Visitor/TransMethodVisitorTest.php index 2b0ffda00f5c3..9340b23a18269 100644 --- a/src/Symfony/Component/Translation/Tests/Extractor/Visitor/TransMethodVisitorTest.php +++ b/src/Symfony/Component/Translation/Tests/Extractor/Visitor/TransMethodVisitorTest.php @@ -71,6 +71,9 @@ public function assertCatalogue(MessageCatalogue $catalogue): void 'translatable-short-fqn '.$expectedNowdoc => 'prefixtranslatable-short-fqn '.$expectedNowdoc, 'translatable-short-fqn concatenated message with heredoc and nowdoc' => 'prefixtranslatable-short-fqn concatenated message with heredoc and nowdoc', 'translatable-short-fqn default domain' => 'prefixtranslatable-short-fqn default domain', + 'text_align.left.label' => 'prefixtext_align.left.label', + 'text_align.center.label' => 'prefixtext_align.center.label', + 'text_align.right.label' => 'prefixtext_align.right.label', ], 'not_messages' => [ 'other-domain-test-no-params-short-array' => 'prefixother-domain-test-no-params-short-array', @@ -111,5 +114,7 @@ public function assertCatalogue(MessageCatalogue $catalogue): void $this->assertEquals(['sources' => [self::FIXTURES_FOLDER . 'translatable-short-fqn.html.php:2']], $catalogue->getMetadata('translatable-short-fqn single-quoted key')); $this->assertEquals(['sources' => [self::FIXTURES_FOLDER . 'translatable-short-fqn.html.php:37']], $catalogue->getMetadata('translatable-short-fqn other-domain-test-no-params-short-array', 'not_messages')); + + $this->assertEquals(['sources' => [self::FIXTURES_FOLDER . 'translatable-backed-enum.html.php:17']], $catalogue->getMetadata('text_align.left.label')); } } diff --git a/src/Symfony/Component/Translation/Tests/Fixtures/extractor-php-ast/trans-method-visitor/translatable-backed-enum.html.php b/src/Symfony/Component/Translation/Tests/Fixtures/extractor-php-ast/trans-method-visitor/translatable-backed-enum.html.php new file mode 100644 index 0000000000000..e3529bf56a34f --- /dev/null +++ b/src/Symfony/Component/Translation/Tests/Fixtures/extractor-php-ast/trans-method-visitor/translatable-backed-enum.html.php @@ -0,0 +1,22 @@ +This template is used for translation message extraction tests + $translator->trans('text_align.left.label', locale: $locale), + self::Center => $translator->trans('text_align.center.label', locale: $locale), + self::Right => $translator->trans('text_align.right.label', locale: $locale), + }; + } +}