InfoDoctrineCommandTest.php 1.7 KB

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