|
1 <?php |
|
2 |
|
3 /* |
|
4 * This file is part of the Symfony framework. |
|
5 * |
|
6 * (c) Fabien Potencier <fabien@symfony.com> |
|
7 * |
|
8 * This source file is subject to the MIT license that is bundled |
|
9 * with this source code in the file LICENSE. |
|
10 */ |
|
11 |
|
12 namespace Symfony\Bundle\DoctrineBundle\Tests\Command; |
|
13 |
|
14 use Symfony\Bundle\DoctrineBundle\Tests\TestCase; |
|
15 use Symfony\Bundle\DoctrineBundle\Command\InfoDoctrineCommand; |
|
16 use Symfony\Bundle\FrameworkBundle\Console\Application; |
|
17 use Symfony\Component\Console\Input\StringInput; |
|
18 |
|
19 require_once __DIR__.'/../DependencyInjection/Fixtures/Bundles/YamlBundle/Entity/Test.php'; |
|
20 |
|
21 class InfoDoctrineCommandTest extends TestCase |
|
22 { |
|
23 public function testAnnotationsBundle() |
|
24 { |
|
25 $input = new StringInput('doctrine:mapping:info'); |
|
26 $output = $this->getMock('Symfony\Component\Console\Output\OutputInterface'); |
|
27 $output->expects($this->at(0)) |
|
28 ->method('writeln') |
|
29 ->with($this->equalTo('Found <info>1</info> entities mapped in entity manager <info>default</info>:')); |
|
30 $output->expects($this->at(1)) |
|
31 ->method('writeln') |
|
32 ->with($this->equalTo('<info>[OK]</info> Fixtures\Bundles\YamlBundle\Entity\Test')); |
|
33 |
|
34 $testContainer = $this->createYamlBundleTestContainer(); |
|
35 $kernel = $this->getMock('Symfony\Component\HttpKernel\Kernel', array(), array(), '', false); |
|
36 $kernel->expects($this->once()) |
|
37 ->method('getContainer') |
|
38 ->will($this->returnValue($testContainer)); |
|
39 $application = new Application($kernel); |
|
40 |
|
41 $cmd = new InfoDoctrineCommand(); |
|
42 $cmd->setApplication($application); |
|
43 $cmd->run($input, $output); |
|
44 } |
|
45 } |