From 8ea38573487cd135d630bf9a8a4e21684fc4e11d Mon Sep 17 00:00:00 2001 From: sez-open Date: Mon, 11 Mar 2019 19:17:50 +0100 Subject: [PATCH 1/2] fix debug:autowiringcommand --- .../Command/DebugAutowiringCommand.php | 2 +- .../Functional/DebugAutowiringCommandTest.php | 14 ++++++++++++++ 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/src/Symfony/Bundle/FrameworkBundle/Command/DebugAutowiringCommand.php b/src/Symfony/Bundle/FrameworkBundle/Command/DebugAutowiringCommand.php index 97493eb28db24..a38614ca31797 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Command/DebugAutowiringCommand.php +++ b/src/Symfony/Bundle/FrameworkBundle/Command/DebugAutowiringCommand.php @@ -110,7 +110,7 @@ protected function execute(InputInterface $input, OutputInterface $output) if ($serviceAlias->isDeprecated()) { $serviceLine .= ' - deprecated'; } - } elseif (!$all) { + } elseif (!$all && !$search) { continue; } $text[] = $serviceLine; diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/Functional/DebugAutowiringCommandTest.php b/src/Symfony/Bundle/FrameworkBundle/Tests/Functional/DebugAutowiringCommandTest.php index 1c64fbe6eeb5b..dcbc3bdcae55f 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Tests/Functional/DebugAutowiringCommandTest.php +++ b/src/Symfony/Bundle/FrameworkBundle/Tests/Functional/DebugAutowiringCommandTest.php @@ -72,4 +72,18 @@ public function testSearchNoResults() $this->assertContains('No autowirable classes or interfaces found matching "foo_fake"', $tester->getErrorOutput()); $this->assertEquals(1, $tester->getStatusCode()); } + + public function testSearchNotAliasedService() + { + static::bootKernel(array('test_case' => 'ContainerDebug', 'root_config' => 'config.yml')); + + $application = new Application(static::$kernel); + $application->setAutoExit(false); + + $tester = new ApplicationTester($application); + $tester->run(array('command' => 'debug:autowiring', 'search' => 'redirect')); + + $this->assertContains('Symfony\Bundle\FrameworkBundle\Controller\RedirectController', $tester->getDisplay()); + $this->assertNotContains('Symfony\Component\Routing\RouterInterface', $tester->getDisplay()); + } } From 7808c3948a9838c9901ba345f3ad3964415c06db Mon Sep 17 00:00:00 2001 From: sez-open Date: Mon, 11 Mar 2019 19:48:50 +0100 Subject: [PATCH 2/2] fix style code --- .../Tests/Functional/DebugAutowiringCommandTest.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/Functional/DebugAutowiringCommandTest.php b/src/Symfony/Bundle/FrameworkBundle/Tests/Functional/DebugAutowiringCommandTest.php index dcbc3bdcae55f..516c0e21baed0 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Tests/Functional/DebugAutowiringCommandTest.php +++ b/src/Symfony/Bundle/FrameworkBundle/Tests/Functional/DebugAutowiringCommandTest.php @@ -75,13 +75,13 @@ public function testSearchNoResults() public function testSearchNotAliasedService() { - static::bootKernel(array('test_case' => 'ContainerDebug', 'root_config' => 'config.yml')); + static::bootKernel(['test_case' => 'ContainerDebug', 'root_config' => 'config.yml']); $application = new Application(static::$kernel); $application->setAutoExit(false); $tester = new ApplicationTester($application); - $tester->run(array('command' => 'debug:autowiring', 'search' => 'redirect')); + $tester->run(['command' => 'debug:autowiring', 'search' => 'redirect']); $this->assertContains('Symfony\Bundle\FrameworkBundle\Controller\RedirectController', $tester->getDisplay()); $this->assertNotContains('Symfony\Component\Routing\RouterInterface', $tester->getDisplay());