Skip to content

Commit ed4c33e

Browse files
committed
[FrameworkBundle] Add functional tests for ContainerLintCommand
1 parent c50f247 commit ed4c33e

File tree

1 file changed

+55
-0
lines changed

1 file changed

+55
-0
lines changed
Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
<?php
2+
3+
/*
4+
* This file is part of the Symfony package.
5+
*
6+
* (c) Fabien Potencier <fabien@symfony.com>
7+
*
8+
* For the full copyright and license information, please view the LICENSE
9+
* file that was distributed with this source code.
10+
*/
11+
12+
namespace Symfony\Bundle\FrameworkBundle\Tests\Functional;
13+
14+
use Symfony\Bundle\FrameworkBundle\Console\Application;
15+
use Symfony\Component\Console\Tester\CommandTester;
16+
17+
/**
18+
* @group functional
19+
*/
20+
class ContainerLintCommandTest extends AbstractWebTestCase
21+
{
22+
private Application $application;
23+
24+
/**
25+
* @dataProvider containerLintProvider
26+
*/
27+
public function testLintContainer(string $configFile, string $expectedOutput)
28+
{
29+
$kernel = static::createKernel([
30+
'test_case' => 'ContainerDebug',
31+
'root_config' => $configFile,
32+
'debug' => true,
33+
]);
34+
$this->application = new Application($kernel);
35+
36+
$tester = $this->createCommandTester();
37+
$exitCode = $tester->execute([]);
38+
39+
$this->assertSame(0, $exitCode);
40+
$this->assertStringContainsString($expectedOutput, $tester->getDisplay());
41+
}
42+
43+
public function containerLintProvider(): array
44+
{
45+
return [
46+
'default container' => ['config.yml', 'The container was linted successfully'],
47+
'missing dump file' => ['no_dump.yml', 'The container was linted successfully'],
48+
];
49+
}
50+
51+
private function createCommandTester(): CommandTester
52+
{
53+
return new CommandTester($this->application->get('lint:container'));
54+
}
55+
}

0 commit comments

Comments
 (0)