2525use PHPUnit \Framework \TestCase ;
2626use Symfony \Component \EventDispatcher \EventDispatcherInterface ;
2727use Symfony \Component \Routing \Generator \UrlGeneratorInterface ;
28+ use Symfony \Contracts \Translation \TranslatorInterface ;
2829
2930abstract class BaseActionMenuBuilderTest extends TestCase
3031{
@@ -52,6 +53,9 @@ abstract class BaseActionMenuBuilderTest extends TestCase
5253 /** @var \Ibexa\Contracts\Core\Repository\ContentService&\PHPUnit\Framework\MockObject\MockObject */
5354 protected ContentService $ contentService ;
5455
56+ /** @var \Symfony\Contracts\Translation\TranslatorInterface&\PHPUnit\Framework\MockObject\MockObject */
57+ protected TranslatorInterface $ translator ;
58+
5559 /** @var \Symfony\Component\Routing\Generator\UrlGeneratorInterface&\PHPUnit\Framework\MockObject\MockObject */
5660 protected UrlGeneratorInterface $ urlGenerator ;
5761
@@ -69,6 +73,7 @@ protected function setUp(): void
6973 );
7074 $ this ->eventDispatcher = $ this ->createMock (EventDispatcherInterface::class);
7175 $ this ->contentService = $ this ->createMock (ContentService::class);
76+ $ this ->translator = $ this ->createMock (TranslatorInterface::class);
7277 $ this ->urlGenerator = $ this ->createMock (UrlGeneratorInterface::class);
7378 $ this ->userService = $ this ->createMock (UserService::class);
7479 }
@@ -162,6 +167,15 @@ protected function mockUserServiceIsUser(
162167 ->willReturn ($ isUser );
163168 }
164169
170+ protected function mockTranslatorTranslate (): void
171+ {
172+ $ this ->translator
173+ ->method ('trans ' )
174+ ->willReturnCallback (function (string $ id ): string {
175+ return $ id ;
176+ });
177+ }
178+
165179 /**
166180 * @param array<string, mixed> $parameters
167181 */
0 commit comments