|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
namespace Doctrine\Tests\ORM\Tools\Console; |
|
4
|
|
|
|
|
5
|
|
|
use Doctrine\ORM\Tools\Console\ConsoleRunner; |
|
6
|
|
|
use Doctrine\ORM\Version; |
|
7
|
|
|
use Doctrine\Tests\DoctrineTestCase; |
|
8
|
|
|
use Symfony\Component\Console\Command\Command; |
|
9
|
|
|
use Symfony\Component\Console\Helper\HelperSet; |
|
10
|
|
|
|
|
11
|
|
|
/** |
|
12
|
|
|
* @group DDC-3186 |
|
13
|
|
|
* |
|
14
|
|
|
* @covers \Doctrine\ORM\Tools\Console\ConsoleRunner |
|
15
|
|
|
*/ |
|
16
|
|
|
final class ConsoleRunnerTest extends DoctrineTestCase |
|
17
|
|
|
{ |
|
18
|
|
|
public function testCreateApplicationShouldReturnAnApplicationWithTheCorrectCommands() : void |
|
19
|
|
|
{ |
|
20
|
|
|
$helperSet = new HelperSet(); |
|
21
|
|
|
$app = ConsoleRunner::createApplication($helperSet); |
|
22
|
|
|
|
|
23
|
|
|
self::assertSame($helperSet, $app->getHelperSet()); |
|
24
|
|
|
self::assertEquals(Version::VERSION, $app->getVersion()); |
|
25
|
|
|
|
|
26
|
|
|
self::assertTrue($app->has('dbal:import')); |
|
27
|
|
|
self::assertTrue($app->has('dbal:reserved-words')); |
|
28
|
|
|
self::assertTrue($app->has('dbal:run-sql')); |
|
29
|
|
|
self::assertTrue($app->has('orm:clear-cache:region:collection')); |
|
30
|
|
|
self::assertTrue($app->has('orm:clear-cache:region:entity')); |
|
31
|
|
|
self::assertTrue($app->has('orm:clear-cache:region:query')); |
|
32
|
|
|
self::assertTrue($app->has('orm:clear-cache:metadata')); |
|
33
|
|
|
self::assertTrue($app->has('orm:clear-cache:query')); |
|
34
|
|
|
self::assertTrue($app->has('orm:clear-cache:result')); |
|
35
|
|
|
self::assertTrue($app->has('orm:convert-d1-schema')); |
|
36
|
|
|
self::assertTrue($app->has('orm:convert-mapping')); |
|
37
|
|
|
self::assertTrue($app->has('orm:convert:d1-schema')); |
|
38
|
|
|
self::assertTrue($app->has('orm:convert:mapping')); |
|
39
|
|
|
self::assertTrue($app->has('orm:ensure-production-settings')); |
|
40
|
|
|
self::assertTrue($app->has('orm:generate-entities')); |
|
41
|
|
|
self::assertTrue($app->has('orm:generate-proxies')); |
|
42
|
|
|
self::assertTrue($app->has('orm:generate-repositories')); |
|
43
|
|
|
self::assertTrue($app->has('orm:generate:entities')); |
|
44
|
|
|
self::assertTrue($app->has('orm:generate:proxies')); |
|
45
|
|
|
self::assertTrue($app->has('orm:generate:repositories')); |
|
46
|
|
|
self::assertTrue($app->has('orm:info')); |
|
47
|
|
|
self::assertTrue($app->has('orm:mapping:describe')); |
|
48
|
|
|
self::assertTrue($app->has('orm:run-dql')); |
|
49
|
|
|
self::assertTrue($app->has('orm:schema-tool:create')); |
|
50
|
|
|
self::assertTrue($app->has('orm:schema-tool:drop')); |
|
51
|
|
|
self::assertTrue($app->has('orm:schema-tool:update')); |
|
52
|
|
|
self::assertTrue($app->has('orm:validate-schema')); |
|
53
|
|
|
} |
|
54
|
|
|
|
|
55
|
|
|
public function testCreateApplicationShouldAppendGivenCommands() : void |
|
56
|
|
|
{ |
|
57
|
|
|
$command = 'my:lovely-command'; |
|
58
|
|
|
$app = ConsoleRunner::createApplication(new HelperSet(), [new Command($command)]); |
|
59
|
|
|
|
|
60
|
|
|
self::assertTrue($app->has($command)); |
|
61
|
|
|
} |
|
62
|
|
|
} |
|
63
|
|
|
|