Skip to content

Commit 23c7c26

Browse files
committed
Move console commands to Drush namespace
1 parent a67b4ce commit 23c7c26

File tree

19 files changed

+35
-35
lines changed

19 files changed

+35
-35
lines changed

scripts/sut-tests.sh

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -483,16 +483,16 @@ if [[ $test_filter = all || $test_filter = theme ]]; then
483483
dcg_module_uninstall $module_machine_name
484484
fi
485485

486-
# --- Test module --- #
487-
if [[ $test_filter = all || $test_filter = console ]]; then
488-
dcg_label 'Console Commands'
486+
# --- Test drush commands --- #
487+
if [[ $test_filter = all || $test_filter = drush ]]; then
488+
dcg_label 'Drush Commands'
489489

490490
module_machine_name=sonata
491491
module_dir=$drupal_dir/modules/$module_machine_name
492492
cp -R $source_dir/$module_machine_name $module_dir
493493
cd $module_dir
494494

495-
$dcg console:symfony-command -d $drupal_dir/modules -a sonata -a Sonata -a 'sonata:example' \
495+
$dcg drush:symfony-command -d $drupal_dir/modules -a sonata -a Sonata -a 'sonata:example' \
496496
-a 'Simple command generated by DCG.' -a example -a ExampleCommand -a Yes -a No
497497

498498
dcg_phpcs $module_dir

src/Command/Console/DcgCommand.php renamed to src/Command/Drush/Generator.php

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,25 @@
11
<?php declare(strict_types = 1);
22

3-
namespace DrupalCodeGenerator\Command\Console;
3+
namespace DrupalCodeGenerator\Command\Drush;
44

55
use DrupalCodeGenerator\Application;
66
use DrupalCodeGenerator\Asset\Assets;
7-
use DrupalCodeGenerator\Attribute\Generator;
7+
use DrupalCodeGenerator\Attribute\Generator as GeneratorDefinition;
88
use DrupalCodeGenerator\Command\BaseGenerator;
99
use DrupalCodeGenerator\GeneratorType;
1010
use DrupalCodeGenerator\Utils;
1111
use DrupalCodeGenerator\Validator\RegExp;
1212
use DrupalCodeGenerator\Validator\Required;
1313

14-
#[Generator(
15-
name: 'console:dcg-command',
16-
description: 'Generates DCG command',
17-
aliases: ['dcg-command'],
18-
templatePath: Application::TEMPLATE_PATH . '/Console/_dcg-command',
14+
#[GeneratorDefinition(
15+
name: 'drush:generator',
16+
description: 'Generates Drush generator',
17+
aliases: ['generator'],
18+
templatePath: Application::TEMPLATE_PATH . '/Drush/_generator',
1919
type: GeneratorType::MODULE_COMPONENT,
2020
label: 'DCG command',
2121
)]
22-
final class DcgCommand extends BaseGenerator {
22+
final class Generator extends BaseGenerator {
2323

2424
/**
2525
* {@inheritdoc}

src/Command/Console/SymfonyCommand.php renamed to src/Command/Drush/SymfonyCommand.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?php declare(strict_types = 1);
22

3-
namespace DrupalCodeGenerator\Command\Console;
3+
namespace DrupalCodeGenerator\Command\Drush;
44

55
use DrupalCodeGenerator\Application;
66
use DrupalCodeGenerator\Asset\AssetCollection;
@@ -11,10 +11,10 @@
1111
use DrupalCodeGenerator\Validator\RegExp;
1212

1313
#[Generator(
14-
name: 'console:symfony-command',
14+
name: 'drush:symfony-command',
1515
description: 'Generates Symfony console command',
1616
aliases: ['symfony-command'],
17-
templatePath: Application::TEMPLATE_PATH . '/Console/_symfony-command',
17+
templatePath: Application::TEMPLATE_PATH . '/Drush/_symfony-command',
1818
type: GeneratorType::MODULE_COMPONENT,
1919
)]
2020
final class SymfonyCommand extends BaseGenerator {

tests/functional/Generator/Console/DcgCommandTest.php renamed to tests/functional/Generator/Drush/GeneratorTest.php

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,16 @@
11
<?php declare(strict_types = 1);
22

3-
namespace DrupalCodeGenerator\Tests\Generator\Console;
3+
namespace DrupalCodeGenerator\Tests\Generator\Drush;
44

5-
use DrupalCodeGenerator\Command\Console\DcgCommand;
5+
use DrupalCodeGenerator\Command\Drush\Generator;
66
use DrupalCodeGenerator\Test\Functional\GeneratorTestBase;
77

88
/**
9-
* Tests console:dcg-command generator.
9+
* Tests drush:generator generator.
1010
*/
11-
final class DcgCommandTest extends GeneratorTestBase {
11+
final class GeneratorTest extends GeneratorTestBase {
1212

13-
protected string $fixtureDir = __DIR__ . '/_dcg_command';
13+
protected string $fixtureDir = __DIR__ . '/_generator';
1414

1515
/**
1616
* Test callback.
@@ -26,12 +26,12 @@ public function testGenerator(): void {
2626
'example',
2727
'example',
2828
];
29-
$this->execute(DcgCommand::class, $input);
29+
$this->execute(Generator::class, $input);
3030

3131
$expected_display = <<< 'TXT'
3232
33-
Welcome to dcg-command generator!
34-
–––––––––––––––––––––––––––––––––––
33+
Welcome to generator generator!
34+
–––––––––––––––––––––––––––––––––
3535
3636
Module machine name:
3737

tests/functional/Generator/Console/SymfonyCommandTest.php renamed to tests/functional/Generator/Drush/SymfonyCommandTest.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
<?php declare(strict_types = 1);
22

3-
namespace DrupalCodeGenerator\Tests\Functional\Generator;
3+
namespace DrupalCodeGenerator\Tests\Functional\Drush;
44

5-
use DrupalCodeGenerator\Command\Console\SymfonyCommand;
5+
use DrupalCodeGenerator\Command\Drush\SymfonyCommand;
66
use DrupalCodeGenerator\Test\Functional\GeneratorTestBase;
77

88
/**
9-
* Tests console:symfony-command generator.
9+
* Tests drush:symfony-command generator.
1010
*/
1111
final class SymfonyCommandTest extends GeneratorTestBase {
1212

0 commit comments

Comments
 (0)