Skip to content

Commit 2174ca0

Browse files
committed
Add functional test for dcg command generator
1 parent daf3383 commit 2174ca0

File tree

5 files changed

+51
-27
lines changed

5 files changed

+51
-27
lines changed

tests/dcg/Generator/Console/DcgCommandTest.php

Lines changed: 0 additions & 25 deletions
This file was deleted.
Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
<?php declare(strict_types=1);
2+
3+
namespace DrupalCodeGenerator\Tests\Generator\Console;
4+
5+
use DrupalCodeGenerator\Command\Console\DcgCommand;
6+
use DrupalCodeGenerator\Test\Functional\GeneratorTestBase;
7+
8+
/**
9+
* Tests console:dcg-command generator.
10+
*/
11+
final class DcgCommandTest extends GeneratorTestBase {
12+
13+
protected string $fixtureDir = __DIR__ . '/_dcg_command';
14+
15+
public function testGenerator(): void {
16+
17+
$input = [
18+
'custom:example',
19+
'Some description',
20+
'example',
21+
];
22+
$this->execute(new DcgCommand(), $input);
23+
24+
$expected_display = <<< 'TXT'
25+
26+
Welcome to dcg-command generator!
27+
–––––––––––––––––––––––––––––––––––
28+
29+
Command name [custom:example]:
30+
31+
32+
Command description:
33+
34+
35+
Command alias [example]:
36+
37+
38+
The following directories and files have been created or updated:
39+
–––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––
40+
• custom/Example.php
41+
• custom/example.twig
42+
43+
TXT;
44+
$this->assertDisplay($expected_display);
45+
46+
$this->assertGeneratedFile('custom/Example.php');
47+
$this->assertGeneratedFile('custom/example.twig');
48+
}
49+
50+
}

tests/functional/_navigation_fixture.txt

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -130,8 +130,7 @@
130130
Select generator
131131
[0] ..
132132
[1] Apache virtual host
133-
[2] HTML page
134-
[3] Nginx virtual host
133+
[2] Nginx virtual host
135134
➤ 0⏎
136135
Select generator
137136
[ 0] ..

0 commit comments

Comments
 (0)