Skip to content

Commit c337b8f

Browse files
committed
Added a smal test
1 parent 827936f commit c337b8f

File tree

1 file changed

+53
-0
lines changed

1 file changed

+53
-0
lines changed
Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
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\Command\CachePoolListCommand;
15+
use Symfony\Bundle\FrameworkBundle\Console\Application;
16+
use Symfony\Component\Console\Tester\CommandTester;
17+
18+
/**
19+
* @group functional
20+
*/
21+
class CachePoolListCommandTest extends WebTestCase
22+
{
23+
protected function setUp()
24+
{
25+
static::bootKernel(['test_case' => 'CachePools', 'root_config' => 'config.yml']);
26+
}
27+
28+
public function testListPools()
29+
{
30+
$tester = $this->createCommandTester(['cache.app', 'cache.system']);
31+
$tester->execute([]);
32+
33+
$this->assertSame(0, $tester->getStatusCode(), 'cache:pool:list exits with 0 in case of success');
34+
$this->assertContains('cache.app', $tester->getDisplay());
35+
$this->assertContains('cache.system', $tester->getDisplay());
36+
}
37+
38+
public function testEmptyList()
39+
{
40+
$tester = $this->createCommandTester([]);
41+
$tester->execute([]);
42+
43+
$this->assertSame(0, $tester->getStatusCode(), 'cache:pool:list exits with 0 in case of success');
44+
}
45+
46+
private function createCommandTester(array $poolNames)
47+
{
48+
$application = new Application(static::$kernel);
49+
$application->add(new CachePoolListCommand($poolNames));
50+
51+
return new CommandTester($application->find('cache:pool:list'));
52+
}
53+
}

0 commit comments

Comments
 (0)