Proposal
In order to launch the first stable version, We need to update the test (List below) and create the base for more commands and classes within DrupalConsole.
How can We do
The base class used in all test is BaseTestCase this class provide a lot of Mocks/Stubs that is common like Translator object. For each kind of commands, We need to create a base class like GenerateCommandTest to create Mocks/Stubs for the own kind of class.
My Approach, updating test by test and create the essential code to create the own base for testing Drupal Console
Follow the pattern Test Data Builder but using like Test Double Builder proposed by @MontealegreLuis, We want to write test more legible and easy to maintain.
$command = new ModuleCommand(
$this->getGenerator(),
A::validator()->build(),
'/tmp',
A::stringConverter()->withInvalidModuleName()->build(),
A::drupalApi()->withVersion('8.2.0')->build(),
A::guzzleHttpClient()->build(),
A::utils->build()
);
$commandTester = new CommandTester($command);
$code = $commandTester->execute(
[
'--module' => $module,
'--machine-name' => $machine_name,
'--module-path' => $module_path,
'--description' => $description,
'--core' => $core,
'--package' => $package,
'--features-bundle'=> $featuresBundle,
'--composer' => $composer,
'--dependencies' => $dependencies
],
['interactive' => false]
);
$this->assertEquals(0, $code);
Proposal
In order to launch the first stable version, We need to update the test (List below) and create the base for more commands and classes within DrupalConsole.
How can We do
The base class used in all test is
BaseTestCasethis class provide a lot of Mocks/Stubs that is common likeTranslatorobject. For each kind of commands, We need to create a base class likeGenerateCommandTestto create Mocks/Stubs for the own kind of class.My Approach, updating test by test and create the essential code to create the own base for testing Drupal Console
Follow the pattern
Test Data Builderbut using likeTest Double Builderproposed by @MontealegreLuis, We want to write test more legible and easy to maintain.