1
0
mirror of synced 2025-02-03 22:09:26 +03:00
Luís Cobucci 43a88d539d
Format commands' tests
To simplify and organise the code (also replacing `$this->assert*`
with `self::assert*`).
2017-11-24 01:25:15 +01:00

56 lines
1.6 KiB
PHP

<?php
namespace Doctrine\Tests\ORM\Tools\Console\Command;
use Doctrine\Common\Persistence\Mapping\Driver\MappingDriver;
use Doctrine\ORM\Configuration;
use Doctrine\ORM\EntityManagerInterface;
use Doctrine\ORM\Mapping\MappingException;
use Doctrine\ORM\Tools\Console\Helper\EntityManagerHelper;
use Doctrine\Tests\Models\Cache\AttractionInfo;
use Doctrine\Tests\Models\Cache\City;
use Symfony\Component\Console\Tester\CommandTester;
use Symfony\Component\Console\Helper\HelperSet;
use Symfony\Component\Console\Application;
use Doctrine\Tests\OrmFunctionalTestCase;
use Doctrine\ORM\Tools\Console\Command\InfoCommand;
class InfoCommandTest extends OrmFunctionalTestCase
{
/**
* @var \Symfony\Component\Console\Application
*/
private $application;
/**
* @var \Doctrine\ORM\Tools\Console\Command\InfoCommand
*/
private $command;
/**
* @var \Symfony\Component\Console\Tester\CommandTester
*/
private $tester;
protected function setUp()
{
parent::setUp();
$this->application = new Application();
$this->application->setHelperSet(new HelperSet(['em' => new EntityManagerHelper($this->_em)]));
$this->application->add(new InfoCommand());
$this->command = $this->application->find('orm:info');
$this->tester = new CommandTester($this->command);
}
public function testListAllClasses()
{
$this->tester->execute(['command' => $this->command->getName()]);
self::assertContains(AttractionInfo::class, $this->tester->getDisplay());
self::assertContains(City::class, $this->tester->getDisplay());
}
}