Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Fix] Revert removing twig_component.controllers_json #1908

Merged
merged 1 commit into from
Jun 11, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -186,6 +186,10 @@ public function getConfigTreeBuilder(): TreeBuilder
->info('Enables the profiler for Twig Component (in debug mode)')
->defaultValue('%kernel.debug%')
->end()
->scalarNode('controllers_json')
->setDeprecated('symfony/ux-twig-component', '2.18', 'The "twig_component.controllers_json" config option is deprecated, and will be removed in 3.0.')
->defaultNull()
->end()
->end();

return $treeBuilder;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
namespace Symfony\UX\TwigComponent\Test\DependencyInjection;

use PHPUnit\Framework\TestCase;
use Symfony\Bridge\PhpUnit\ExpectDeprecationTrait;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\DependencyInjection\ParameterBag\ParameterBag;
use Symfony\UX\TwigComponent\DependencyInjection\TwigComponentExtension;
Expand All @@ -22,6 +23,8 @@
*/
class TwigComponentExtensionTest extends TestCase
{
use ExpectDeprecationTrait;

public function testDataCollectorWithDebugMode()
{
$container = $this->createContainer();
Expand Down Expand Up @@ -66,6 +69,26 @@ public function testDataCollectorWithoutDebugMode()
$this->assertFalse($container->hasDefinition('ux.twig_component.data_collector'));
}

/**
* @group legacy
*/
public function testSettingControllerJsonKeyTriggerDeprecation()
{
$container = $this->createContainer();
$container->setParameter('kernel.debug', true);
$container->registerExtension(new TwigComponentExtension());
$container->loadFromExtension('twig_component', [
'defaults' => [],
'anonymous_template_directory' => 'components/',
'profiler' => false,
'controllers_json' => null,
]);

$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.');

$this->compileContainer($container);
}

private function createContainer()
{
$container = new ContainerBuilder(new ParameterBag([
Expand Down