|
12 | 12 | namespace Symfony\UX\TwigComponent\Test\DependencyInjection;
|
13 | 13 |
|
14 | 14 | use PHPUnit\Framework\TestCase;
|
| 15 | +use Symfony\Bridge\PhpUnit\ExpectDeprecationTrait; |
15 | 16 | use Symfony\Component\DependencyInjection\ContainerBuilder;
|
16 | 17 | use Symfony\Component\DependencyInjection\ParameterBag\ParameterBag;
|
17 | 18 | use Symfony\UX\TwigComponent\DependencyInjection\TwigComponentExtension;
|
|
22 | 23 | */
|
23 | 24 | class TwigComponentExtensionTest extends TestCase
|
24 | 25 | {
|
| 26 | + use ExpectDeprecationTrait; |
| 27 | + |
25 | 28 | public function testDataCollectorWithDebugMode()
|
26 | 29 | {
|
27 | 30 | $container = $this->createContainer();
|
@@ -66,6 +69,26 @@ public function testDataCollectorWithoutDebugMode()
|
66 | 69 | $this->assertFalse($container->hasDefinition('ux.twig_component.data_collector'));
|
67 | 70 | }
|
68 | 71 |
|
| 72 | + /** |
| 73 | + * @group legacy |
| 74 | + */ |
| 75 | + public function testSettingControllerJsonKeyTriggerDeprecation() |
| 76 | + { |
| 77 | + $container = $this->createContainer(); |
| 78 | + $container->setParameter('kernel.debug', true); |
| 79 | + $container->registerExtension(new TwigComponentExtension()); |
| 80 | + $container->loadFromExtension('twig_component', [ |
| 81 | + 'defaults' => [], |
| 82 | + 'anonymous_template_directory' => 'components/', |
| 83 | + 'profiler' => false, |
| 84 | + 'controllers_json' => null, |
| 85 | + ]); |
| 86 | + |
| 87 | + $this->expectDeprecation('Since symfony/ux-twig-component 2.18: The "twig_component.controllers_json" config option is deprecated, and will be removed in 3.0.'); |
| 88 | + |
| 89 | + $this->compileContainer($container); |
| 90 | + } |
| 91 | + |
69 | 92 | private function createContainer()
|
70 | 93 | {
|
71 | 94 | $container = new ContainerBuilder(new ParameterBag([
|
|
0 commit comments