2014-07-24 09:23:36 +02:00
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace Doctrine\Tests\ORM\Tools\Console;
|
|
|
|
|
|
|
|
use Doctrine\ORM\Tools\Console\ConsoleRunner;
|
|
|
|
use Doctrine\ORM\Version;
|
|
|
|
use Doctrine\Tests\DoctrineTestCase;
|
2017-07-22 21:47:50 +02:00
|
|
|
use Symfony\Component\Console\Command\Command;
|
2014-07-24 09:23:36 +02:00
|
|
|
use Symfony\Component\Console\Helper\HelperSet;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @group DDC-3186
|
|
|
|
*
|
|
|
|
* @covers \Doctrine\ORM\Tools\Console\ConsoleRunner
|
|
|
|
*/
|
2017-07-22 21:47:50 +02:00
|
|
|
final class ConsoleRunnerTest extends DoctrineTestCase
|
2014-07-24 09:23:36 +02:00
|
|
|
{
|
2017-07-22 21:47:50 +02:00
|
|
|
public function testCreateApplicationShouldReturnAnApplicationWithTheCorrectCommands() : void
|
2014-07-24 09:23:36 +02:00
|
|
|
{
|
|
|
|
$helperSet = new HelperSet();
|
|
|
|
$app = ConsoleRunner::createApplication($helperSet);
|
|
|
|
|
2017-07-22 21:47:50 +02:00
|
|
|
self::assertSame($helperSet, $app->getHelperSet());
|
|
|
|
self::assertEquals(Version::VERSION, $app->getVersion());
|
|
|
|
|
|
|
|
self::assertTrue($app->has('dbal:import'));
|
|
|
|
self::assertTrue($app->has('dbal:reserved-words'));
|
|
|
|
self::assertTrue($app->has('dbal:run-sql'));
|
|
|
|
self::assertTrue($app->has('orm:clear-cache:region:collection'));
|
|
|
|
self::assertTrue($app->has('orm:clear-cache:region:entity'));
|
|
|
|
self::assertTrue($app->has('orm:clear-cache:region:query'));
|
|
|
|
self::assertTrue($app->has('orm:clear-cache:metadata'));
|
|
|
|
self::assertTrue($app->has('orm:clear-cache:query'));
|
|
|
|
self::assertTrue($app->has('orm:clear-cache:result'));
|
|
|
|
self::assertTrue($app->has('orm:convert-d1-schema'));
|
|
|
|
self::assertTrue($app->has('orm:convert-mapping'));
|
|
|
|
self::assertTrue($app->has('orm:convert:d1-schema'));
|
|
|
|
self::assertTrue($app->has('orm:convert:mapping'));
|
|
|
|
self::assertTrue($app->has('orm:ensure-production-settings'));
|
|
|
|
self::assertTrue($app->has('orm:generate-entities'));
|
|
|
|
self::assertTrue($app->has('orm:generate-proxies'));
|
|
|
|
self::assertTrue($app->has('orm:generate-repositories'));
|
|
|
|
self::assertTrue($app->has('orm:generate:entities'));
|
|
|
|
self::assertTrue($app->has('orm:generate:proxies'));
|
|
|
|
self::assertTrue($app->has('orm:generate:repositories'));
|
|
|
|
self::assertTrue($app->has('orm:info'));
|
|
|
|
self::assertTrue($app->has('orm:mapping:describe'));
|
|
|
|
self::assertTrue($app->has('orm:run-dql'));
|
|
|
|
self::assertTrue($app->has('orm:schema-tool:create'));
|
|
|
|
self::assertTrue($app->has('orm:schema-tool:drop'));
|
|
|
|
self::assertTrue($app->has('orm:schema-tool:update'));
|
|
|
|
self::assertTrue($app->has('orm:validate-schema'));
|
|
|
|
}
|
|
|
|
|
|
|
|
public function testCreateApplicationShouldAppendGivenCommands() : void
|
|
|
|
{
|
|
|
|
$command = 'my:lovely-command';
|
|
|
|
$app = ConsoleRunner::createApplication(new HelperSet(), [new Command($command)]);
|
|
|
|
|
|
|
|
self::assertTrue($app->has($command));
|
2014-07-24 09:23:36 +02:00
|
|
|
}
|
|
|
|
}
|