|
29 | 29 | use ApiPlatform\Tests\Fixtures\TestBundle\TestBundle; |
30 | 30 | use Doctrine\Bundle\DoctrineBundle\DoctrineBundle; |
31 | 31 | use Doctrine\ORM\OptimisticLockException; |
| 32 | +use PHPUnit\Framework\Attributes\PreserveGlobalState; |
| 33 | +use PHPUnit\Framework\Attributes\RunInSeparateProcess; |
32 | 34 | use PHPUnit\Framework\TestCase; |
33 | 35 | use Symfony\AI\McpBundle\McpBundle; |
| 36 | +use Symfony\Bundle\FrameworkBundle\Command\TranslationExtractCommand as FrameworkTranslationExtractCommand; |
34 | 37 | use Symfony\Bundle\SecurityBundle\SecurityBundle; |
35 | 38 | use Symfony\Bundle\TwigBundle\TwigBundle; |
36 | 39 | use Symfony\Component\DependencyInjection\ChildDefinition; |
37 | 40 | use Symfony\Component\DependencyInjection\ContainerBuilder; |
38 | 41 | use Symfony\Component\DependencyInjection\ParameterBag\ParameterBag; |
39 | 42 | use Symfony\Component\HttpFoundation\Response; |
40 | 43 | use Symfony\Component\Serializer\NameConverter\MetadataAwareNameConverter; |
| 44 | +use Symfony\Component\Translation\Command\TranslationExtractCommand; |
41 | 45 |
|
42 | 46 | class ApiPlatformExtensionTest extends TestCase |
43 | 47 | { |
@@ -184,6 +188,20 @@ private function assertServiceHasTags(string $service, array $tags = []): void |
184 | 188 | } |
185 | 189 | } |
186 | 190 |
|
| 191 | + #[RunInSeparateProcess] |
| 192 | + #[PreserveGlobalState(false)] |
| 193 | + public function testObjectMapperDoesNotLoadDeprecatedTranslationCommand(): void |
| 194 | + { |
| 195 | + if (!class_exists(TranslationExtractCommand::class)) { |
| 196 | + self::markTestSkipped('Requires the Symfony 8.2 translation command.'); |
| 197 | + } |
| 198 | + |
| 199 | + (new ApiPlatformExtension())->load(self::DEFAULT_CONFIG, $this->container); |
| 200 | + |
| 201 | + self::assertTrue($this->container->hasDefinition('api_platform.object_mapper.metadata_factory')); |
| 202 | + self::assertFalse(class_exists(FrameworkTranslationExtractCommand::class, false)); |
| 203 | + } |
| 204 | + |
187 | 205 | public function testCommonConfiguration(): void |
188 | 206 | { |
189 | 207 | $config = self::DEFAULT_CONFIG; |
|
0 commit comments