|
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
|
|
|
private const EXPECTED_COMMANDS = [ |
|
19
|
|
|
'dbal:import', |
|
20
|
|
|
'dbal:reserved-words', |
|
21
|
|
|
'dbal:run-sql', |
|
22
|
|
|
'orm:clear-cache:region:collection', |
|
23
|
|
|
'orm:clear-cache:region:entity', |
|
24
|
|
|
'orm:clear-cache:region:query', |
|
25
|
|
|
'orm:clear-cache:metadata', |
|
26
|
|
|
'orm:clear-cache:query', |
|
27
|
|
|
'orm:clear-cache:result', |
|
28
|
|
|
'orm:convert-d1-schema', |
|
29
|
|
|
'orm:convert-mapping', |
|
30
|
|
|
'orm:convert:d1-schema', |
|
31
|
|
|
'orm:convert:mapping', |
|
32
|
|
|
'orm:ensure-production-settings', |
|
33
|
|
|
'orm:generate-entities', |
|
34
|
|
|
'orm:generate-proxies', |
|
35
|
|
|
'orm:generate-repositories', |
|
36
|
|
|
'orm:generate:entities', |
|
37
|
|
|
'orm:generate:proxies', |
|
38
|
|
|
'orm:generate:repositories', |
|
39
|
|
|
'orm:info', |
|
40
|
|
|
'orm:mapping:describe', |
|
41
|
|
|
'orm:run-dql', |
|
42
|
|
|
'orm:schema-tool:create', |
|
43
|
|
|
'orm:schema-tool:drop', |
|
44
|
|
|
'orm:schema-tool:update', |
|
45
|
|
|
'orm:validate-schema', |
|
46
|
|
|
]; |
|
47
|
|
|
|
|
48
|
|
|
public function testCreateApplicationShouldReturnAnApplicationWithTheCorrectCommands() : void |
|
49
|
|
|
{ |
|
50
|
|
|
$helperSet = new HelperSet(); |
|
51
|
|
|
$app = ConsoleRunner::createApplication($helperSet); |
|
52
|
|
|
|
|
53
|
|
|
self::assertSame($helperSet, $app->getHelperSet()); |
|
54
|
|
|
self::assertEquals(Version::VERSION, $app->getVersion()); |
|
55
|
|
|
|
|
56
|
|
|
foreach (self::EXPECTED_COMMANDS as $command) { |
|
57
|
|
|
self::assertTrue($app->has($command)); |
|
58
|
|
|
} |
|
59
|
|
|
} |
|
60
|
|
|
|
|
61
|
|
|
public function testCreateApplicationShouldAppendGivenCommands() : void |
|
62
|
|
|
{ |
|
63
|
|
|
$command = 'my:lovely-command'; |
|
64
|
|
|
$app = ConsoleRunner::createApplication(new HelperSet(), [new Command($command)]); |
|
65
|
|
|
|
|
66
|
|
|
self::assertTrue($app->has($command)); |
|
67
|
|
|
} |
|
68
|
|
|
} |
|
69
|
|
|
|