Update Composer, update everything

This commit is contained in:
Oliver Davies 2018-11-23 12:29:20 +00:00
parent ea3e94409f
commit dda5c284b6
19527 changed files with 1135420 additions and 351004 deletions

View file

@ -0,0 +1,71 @@
<?php
/**
* @file
* Contains \Drupal\Console\Test\Command\GeneratorServiceCommandTest.
*/
namespace Drupal\Console\Test\Command\Generate;
use Drupal\Console\Command\Generate\ServiceCommand;
use Symfony\Component\Console\Tester\CommandTester;
use Drupal\Console\Test\DataProvider\ServiceDataProviderTrait;
use Drupal\Console\Test\Command\GenerateCommandTest;
class ServiceCommandTest extends GenerateCommandTest
{
use ServiceDataProviderTrait;
/**
* Service generator test
*
* @param $module
* @param $name
* @param $class
* @param $interface
* @param $services
* @param $path_service
*
* @dataProvider commandData
*/
public function testGenerateService(
$module,
$name,
$class,
$interface,
$services,
$path_service
) {
$command = new ServiceCommand($this->getHelperSet());
$command->setHelperSet($this->getHelperSet());
$command->setGenerator($this->getGenerator());
$commandTester = new CommandTester($command);
$this->markTestIncomplete(
'This test has not been implemented yet.'
);
$code = $commandTester->execute(
[
'--module' => $module,
'--name' => $name,
'--class' => $class,
'--interface' => $interface,
'--services' => $services,
'--path_service' => $path_service,
],
['interactive' => false]
);
$this->assertEquals(0, $code);
}
private function getGenerator()
{
return $this
->getMockBuilder('Drupal\Console\Generator\ServiceGenerator')
->disableOriginalConstructor()
->setMethods(['generate'])
->getMock();
}
}

View file

@ -0,0 +1,19 @@
<?php
namespace Drupal\Console\Test\Command;
use Symfony\Component\DependencyInjection\Container;
use Drupal\Console\Test\BaseTestCase;
abstract class GenerateCommandTest extends BaseTestCase
{
/**
* @return \Symfony\Component\DependencyInjection\ContainerInterface Drupal container
*/
protected function getContainer()
{
$container = new Container();
$container->set('twig', new \Twig_Environment());
return $container;
}
}

View file

@ -0,0 +1,57 @@
<?php
/**
* @file
* Contains \Drupal\Console\Test\Command\GenerateEntityBundleCommandTest.
*/
namespace Drupal\Console\Test\Command;
use Drupal\Console\Command\Generate\EntityBundleCommand;
use Symfony\Component\Console\Tester\CommandTester;
use Drupal\Console\Test\DataProvider\EntityBundleDataProviderTrait;
class GenerateEntityBundleCommandTest extends GenerateCommandTest
{
use EntityBundleDataProviderTrait;
/**
* ContentType generator test
*
* @param $module
* @param $bundle_name
* @param $bundle_title
*
* @dataProvider commandData
*/
public function testGenerateContentType(
$module,
$bundle_name,
$bundle_title
) {
$command = new EntityBundleCommand($this->getHelperSet());
$command->setHelperSet($this->getHelperSet());
$command->setGenerator($this->getGenerator());
$commandTester = new CommandTester($command);
$code = $commandTester->execute(
[
'--module' => $module,
'--bundle-name' => $bundle_name,
'--bundle-title' => $bundle_title
],
['interactive' => false]
);
$this->assertEquals(0, $code);
}
private function getGenerator()
{
return $this
->getMockBuilder('Drupal\Console\Generator\EntityBundleGenerator')
->disableOriginalConstructor()
->setMethods(['generate'])
->getMock();
}
}

View file

@ -0,0 +1,54 @@
<?php
/**
* @file
* Contains \Drupal\Console\Test\Command\GeneratorAuthenticationProviderCommandTest.
*/
namespace Drupal\Console\Test\Command;
use Drupal\Console\Command\Generate\AuthenticationProviderCommand;
use Symfony\Component\Console\Tester\CommandTester;
use Drupal\Console\Test\DataProvider\AuthenticationProviderDataProviderTrait;
class GeneratorAuthenticationProviderCommandTest extends GenerateCommandTest
{
use AuthenticationProviderDataProviderTrait;
/**
* AuthenticationProvider generator test
*
* @param $module
* @param $class
*
* @dataProvider commandData
*/
public function testGenerateAuthenticationProvider(
$module,
$class
) {
$command = new AuthenticationProviderCommand($this->getHelperSet());
$command->setHelperSet($this->getHelperSet());
$command->setGenerator($this->getGenerator());
$commandTester = new CommandTester($command);
$code = $commandTester->execute(
[
'--module' => $module,
'--class' => $class
],
['interactive' => false]
);
$this->assertEquals(0, $code);
}
private function getGenerator()
{
return $this
->getMockBuilder('Drupal\Console\Generator\AuthenticationProviderGenerator')
->disableOriginalConstructor()
->setMethods(['generate'])
->getMock();
}
}

View file

@ -0,0 +1,60 @@
<?php
/**
* @file
* Contains \Drupal\Console\Test\Command\GeneratorCommandCommandTest.
*/
namespace Drupal\Console\Test\Command;
use Drupal\Console\Command\Generate\CommandCommand;
use Symfony\Component\Console\Tester\CommandTester;
use Drupal\Console\Test\DataProvider\CommandDataProviderTrait;
class GeneratorCommandCommandTest extends GenerateCommandTest
{
use CommandDataProviderTrait;
/**
* Command generator test
*
* @param $module
* @param $name
* @param $class
* @param $containerAware
*
* @dataProvider commandData
*/
public function testGenerateCommand(
$module,
$name,
$class,
$containerAware
) {
$command = new CommandCommand($this->getHelperSet());
$command->setHelperSet($this->getHelperSet());
$command->setGenerator($this->getGenerator());
$commandTester = new CommandTester($command);
$code = $commandTester->execute(
[
'--module' => $module,
'--name' => $name,
'--class' => $class,
'--container-aware' => $containerAware
],
['interactive' => false]
);
$this->assertEquals(0, $code);
}
private function getGenerator()
{
return $this
->getMockBuilder('Drupal\Console\Generator\CommandGenerator')
->disableOriginalConstructor()
->setMethods(['generate'])
->getMock();
}
}

View file

@ -0,0 +1,65 @@
<?php
/**
* @file
* Contains \Drupal\Console\Test\Command\GeneratorConfigFormBaseCommandTest.
*/
namespace Drupal\Console\Test\Command;
use Drupal\Console\Command\Generate\ConfigFormBaseCommand;
use Symfony\Component\Console\Tester\CommandTester;
use Drupal\Console\Test\DataProvider\ConfigFormBaseDataProviderTrait;
class GeneratorConfigFormBaseCommandTest extends GenerateCommandTest
{
use ConfigFormBaseDataProviderTrait;
/**
* ConfigFormBase generator test
*
* @param $module
* @param $class_name
* @param $form_id
* @param $services
* @param $inputs
* @param $routing
*
* @dataProvider commandData
*/
public function testGenerateConfigFormBase(
$module,
$class_name,
$form_id,
$services,
$inputs,
$routing
) {
$command = new ConfigFormBaseCommand($this->getHelperSet());
$command->setHelperSet($this->getHelperSet());
$command->setGenerator($this->getGenerator());
$commandTester = new CommandTester($command);
$code = $commandTester->execute(
[
'--module' => $module,
'--class' => $class_name,
'--form-id' => $form_id,
'--services' => $services,
'--inputs' => $inputs
],
['interactive' => false]
);
$this->assertEquals(0, $code);
}
private function getGenerator()
{
return $this
->getMockBuilder('Drupal\Console\Generator\FormGenerator')
->disableOriginalConstructor()
->setMethods(['generate'])
->getMock();
}
}

View file

@ -0,0 +1,63 @@
<?php
/**
* @file
* Contains \Drupal\Console\Test\Command\GeneratorControllerCommandTest.
*/
namespace Drupal\Console\Test\Command;
use Drupal\Console\Command\Generate\ControllerCommand;
use Symfony\Component\Console\Tester\CommandTester;
use Drupal\Console\Test\DataProvider\ControllerDataProviderTrait;
class GeneratorControllerCommandTest extends GenerateCommandTest
{
use ControllerDataProviderTrait;
/**
* Controller generator test
*
* @param $module
* @param $class_name
* @param $routes
* @param $test
* @param $services
*
* @dataProvider commandData
*/
public function testGenerateController(
$module,
$class_name,
$routes,
$test,
$services
) {
$command = new ControllerCommand($this->getHelperSet());
$command->setHelperSet($this->getHelperSet());
$command->setGenerator($this->getGenerator());
$commandTester = new CommandTester($command);
$code = $commandTester->execute(
[
'--module' => $module,
'--class' => $class_name,
'--routes' => $routes,
'--test' => $test,
'--services' => $services,
],
['interactive' => false]
);
$this->assertEquals(0, $code);
}
private function getGenerator()
{
return $this
->getMockBuilder('Drupal\Console\Generator\ControllerGenerator')
->disableOriginalConstructor()
->setMethods(['generate'])
->getMock();
}
}

View file

@ -0,0 +1,60 @@
<?php
/**
* @file
* Contains \Drupal\Console\Test\Command\GeneratorEntityCommandTest.
*/
namespace Drupal\Console\Test\Command;
use Drupal\Console\Command\Generate\EntityConfigCommand;
use Symfony\Component\Console\Tester\CommandTester;
use Drupal\Console\Test\DataProvider\EntityDataProviderTrait;
class GeneratorEntityCommandTest extends GenerateCommandTest
{
use EntityDataProviderTrait;
/**
* EntityConfig generator test
*
* @param $module
* @param $entity_class
* @param $entity_name
* @param $label
*
* @dataProvider commandData
*/
public function testGenerateEntityConfig(
$module,
$entity_class,
$entity_name,
$label
) {
$command = new EntityConfigCommand($this->getHelperSet());
$command->setHelperSet($this->getHelperSet());
$command->setGenerator($this->getGenerator());
$commandTester = new CommandTester($command);
$code = $commandTester->execute(
[
'--module' => $module,
'--entity-class' => $entity_class,
'--entity-name' => $entity_name,
'--label' => $label
],
['interactive' => false]
);
$this->assertEquals(0, $code);
}
private function getGenerator()
{
return $this
->getMockBuilder('Drupal\Console\Generator\EntityConfigGenerator')
->disableOriginalConstructor()
->setMethods(['generate'])
->getMock();
}
}

View file

@ -0,0 +1,63 @@
<?php
/**
* @file
* Contains \Drupal\Console\Test\Command\GeneratorEntityConfigCommandTest.
*/
namespace Drupal\Console\Test\Command;
use Drupal\Console\Command\Generate\EntityConfigCommand;
use Symfony\Component\Console\Tester\CommandTester;
use Drupal\Console\Test\DataProvider\EntityConfigDataProviderTrait;
class GeneratorEntityConfigCommandTest extends GenerateCommandTest
{
use EntityConfigDataProviderTrait;
/**
* EntityConfig generator test
*
* @param $module
* @param $entity_name
* @param $entity_class
* @param $label
* @param $base_path
*
* @dataProvider commandData
*/
public function testGenerateEntityConfig(
$module,
$entity_name,
$entity_class,
$label,
$base_path
) {
$command = new EntityConfigCommand($this->getHelperSet());
$command->setHelperSet($this->getHelperSet());
$command->setGenerator($this->getGenerator());
$commandTester = new CommandTester($command);
$code = $commandTester->execute(
[
'--module' => $module,
'--entity-name' => $entity_name,
'--entity-class' => $entity_class,
'--label' => $label,
'--base-path' => $base_path,
],
['interactive' => false]
);
$this->assertEquals(0, $code);
}
private function getGenerator()
{
return $this
->getMockBuilder('Drupal\Console\Generator\EntityConfigGenerator')
->disableOriginalConstructor()
->setMethods(['generate'])
->getMock();
}
}

View file

@ -0,0 +1,63 @@
<?php
/**
* @file
* Contains \Drupal\Console\Test\Command\GeneratorEntityContentCommandTest.
*/
namespace Drupal\Console\Test\Command;
use Drupal\Console\Command\Generate\EntityContentCommand;
use Symfony\Component\Console\Tester\CommandTester;
use Drupal\Console\Test\DataProvider\EntityContentDataProviderTrait;
class GeneratorEntityContentCommandTest extends GenerateCommandTest
{
use EntityContentDataProviderTrait;
/**
* EntityContent generator test
*
* @param $module
* @param $entity_name
* @param $entity_class
* @param $label
* @param $base_path
*
* @dataProvider commandData
*/
public function testGenerateEntityContent(
$module,
$entity_name,
$entity_class,
$label,
$base_path
) {
$command = new EntityContentCommand($this->getHelperSet());
$command->setHelperSet($this->getHelperSet());
$command->setGenerator($this->getGenerator());
$commandTester = new CommandTester($command);
$code = $commandTester->execute(
[
'--module' => $module,
'--entity-name' => $entity_name,
'--entity-class' => $entity_class,
'--label' => $label,
'--base-path' => $base_path,
],
['interactive' => false]
);
$this->assertEquals(0, $code);
}
private function getGenerator()
{
return $this
->getMockBuilder('Drupal\Console\Generator\EntityContentGenerator')
->disableOriginalConstructor()
->setMethods(['generate'])
->getMock();
}
}

View file

@ -0,0 +1,74 @@
<?php
/**
* @file
* Contains \Drupal\Console\Test\Command\GeneratorFormCommandTest.
*/
namespace Drupal\Console\Test\Command;
use Drupal\Console\Command\Generate\FormCommand;
use Symfony\Component\Console\Tester\CommandTester;
use Drupal\Console\Test\DataProvider\FormDataProviderTrait;
class GeneratorFormCommandTest extends GenerateCommandTest
{
use FormDataProviderTrait;
/**
* Form generator test
*
* @param $module
* @param $class_name
* @param $services
* @param $inputs
* @param $form_id
* @param $routing_update
*
* @dataProvider commandData
*/
public function testGenerateForm(
$module,
$class_name,
$form_id,
$services,
$inputs,
$routing_update
) {
$command = $this->getGeneratorConfig();
$command->setHelperSet($this->getHelperSet(null));
$command->setGenerator($this->getGenerator());
$commandTester = new CommandTester($command);
$code = $commandTester->execute(
[
'--module' => $module,
'--class' => $class_name,
'--services' => $services,
'--inputs' => $inputs,
'--form-id' => $form_id
],
['interactive' => false]
);
$this->assertEquals(0, $code);
}
private function getGeneratorConfig()
{
return $this
->getMockBuilder('Drupal\Console\Command\Generate\ConfigFormBaseCommand')
->setMethods(['getModules', 'getServices', '__construct'])
->setConstructorArgs([$this->getHelperSet()])
->getMock();
}
private function getGenerator()
{
return $this
->getMockBuilder('Drupal\Console\Generator\FormGenerator')
->disableOriginalConstructor()
->setMethods(['generate'])
->getMock();
}
}

View file

@ -0,0 +1,55 @@
<?php
/**
* @file
* Contains \Drupal\Console\Test\Command\GeneratorJsTestCommandTest.
*/
namespace Drupal\Console\Test\Command;
use Drupal\Console\Command\Generate\JsTestCommand;
use Symfony\Component\Console\Tester\CommandTester;
use Drupal\Console\Test\DataProvider\JsTestDataProviderTrait;
class GeneratorJsTestCommandTest extends GenerateCommandTest
{
use JsTestDataProviderTrait;
/**
* JavaScript test command test
*
* @param $module
* @param $class_name
*
* @dataProvider commandData
*/
public function testCommandJsTest(
$module,
$class_name
) {
$command = new JsTestCommand($this->getHelperSet());
$command->setHelperSet($this->getHelperSet());
$command->setGenerator($this->getGenerator());
$commandTester = new CommandTester($command);
$code = $commandTester->execute(
[
'--module' => $module,
'--class' => $class_name,
],
['interactive' => false]
);
$this->assertEquals(0, $code);
}
private function getGenerator()
{
return $this
->getMockBuilder('Drupal\Console\Generator\JsTestGenerator')
->disableOriginalConstructor()
->setMethods(['generate'])
->getMock();
}
}

View file

@ -0,0 +1,75 @@
<?php
/**
* @file
* Contains \Drupal\Console\Test\Command\GeneratorModuleCommandTest.
*/
namespace Drupal\Console\Test\Command;
use Drupal\Console\Command\Generate\ModuleCommand;
use Symfony\Component\Console\Tester\CommandTester;
use Drupal\Console\Test\DataProvider\ModuleDataProviderTrait;
class GeneratorModuleCommandTest extends GenerateCommandTest
{
use ModuleDataProviderTrait;
/**
* Module generator test
*
* @param $module
* @param $machine_name
* @param $module_path
* @param $description
* @param $core
* @param $package
* @param $featuresBundle
* @param $composer
* @param $dependencies
*
* @dataProvider commandData
*/
public function testGenerateModule(
$module,
$machine_name,
$module_path,
$description,
$core,
$package,
$featuresBundle,
$composer,
$dependencies
) {
$command = new ModuleCommand($this->getHelperSet());
$command->setHelperSet($this->getHelperSet());
$command->setGenerator($this->getGenerator());
$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);
}
private function getGenerator()
{
return $this
->getMockBuilder('Drupal\Console\Generator\ModuleGenerator')
->disableOriginalConstructor()
->setMethods(['generate'])
->getMock();
}
}

View file

@ -0,0 +1,54 @@
<?php
/**
* @file
* Contains \Drupal\Console\Test\Command\GeneratorPermissionCommandTest.
*/
namespace Drupal\Console\Test\Command;
use Drupal\Console\Command\Generate\PermissionCommand;
use Symfony\Component\Console\Tester\CommandTester;
use Drupal\Console\Test\DataProvider\PermissionDataProviderTrait;
class GeneratorPermissionCommandTest extends GenerateCommandTest
{
use PermissionDataProviderTrait;
/**
* Permission generator test
*
* @param $module
* @param $permissions
*
* @dataProvider commandData
*/
public function testGeneratePermission(
$module,
$permissions
) {
$command = new PermissionCommand($this->getHelperSet());
$command->setHelperSet($this->getHelperSet());
$command->setGenerator($this->getGenerator());
$commandTester = new CommandTester($command);
$code = $commandTester->execute(
[
'--module' => $module,
'--permissions' => $permissions,
],
['interactive' => false]
);
$this->assertEquals(0, $code);
}
private function getGenerator()
{
return $this
->getMockBuilder('Drupal\Console\Generator\PermissionGenerator')
->disableOriginalConstructor()
->setMethods(['generate'])
->getMock();
}
}

View file

@ -0,0 +1,68 @@
<?php
/**
* @file
* Contains \Drupal\Console\Test\Command\GeneratorPluginBlockCommandTest.
*/
namespace Drupal\Console\Test\Command;
use Drupal\Console\Command\Generate\PluginBlockCommand;
use Symfony\Component\Console\Tester\CommandTester;
use Drupal\Console\Test\DataProvider\PluginBlockDataProviderTrait;
class GeneratorPluginBlockCommandTest extends GenerateCommandTest
{
use PluginBlockDataProviderTrait;
/**
* Plugin block generator test
*
* @param $module
* @param $class_name
* @param $label
* @param $plugin_id
*
* @dataProvider commandData
*/
public function testGeneratePluginBlock(
$module,
$class_name,
$label,
$plugin_id,
$services,
$inputs
) {
$command = new PluginBlockCommand($this->getHelperSet());
$command->setHelperSet($this->getHelperSet());
$command->setGenerator($this->getGenerator());
$commandTester = new CommandTester($command);
$this->markTestIncomplete(
'This test has not been implemented yet.'
);
$code = $commandTester->execute(
[
'--module' => $module,
'--class' => $class_name,
'--label' => $label,
'--plugin-id' => $plugin_id,
'--services' => $services,
'--inputs' => $inputs
],
['interactive' => false]
);
$this->assertEquals(0, $code);
}
private function getGenerator()
{
return $this
->getMockBuilder('Drupal\Console\Generator\PluginBlockGenerator')
->disableOriginalConstructor()
->setMethods(['generate'])
->getMock();
}
}

View file

@ -0,0 +1,69 @@
<?php
/**
* @file
* Contains \Drupal\Console\Test\Command\GeneratorPluginConditionCommandTest.
*/
namespace Drupal\Console\Test\Command;
use Drupal\Console\Command\Generate\PluginConditionCommand;
use Symfony\Component\Console\Tester\CommandTester;
use Drupal\Console\Test\DataProvider\PluginConditionDataProviderTrait;
class GeneratorPluginConditionCommandTest extends GenerateCommandTest
{
use PluginConditionDataProviderTrait;
/**
* Plugin block generator test
*
* @param $module
* @param $class_name
* @param $label
* @param $plugin_id
* @param $context_definition_id
* @param $context_definition_label
* @param $context_definition_required
*
* @dataProvider commandData
*/
public function testGeneratePluginCondition(
$module,
$class_name,
$label,
$plugin_id,
$context_definition_id,
$context_definition_label,
$context_definition_required
) {
$command = new PluginConditionCommand($this->getHelperSet());
$command->setHelperSet($this->getHelperSet());
$command->setGenerator($this->getGenerator());
$commandTester = new CommandTester($command);
$code = $commandTester->execute(
[
'--module' => $module,
'--class' => $class_name,
'--label' => $label,
'--plugin-id' => $plugin_id,
'--context-definition-id' => $context_definition_id,
'--context-definition-label' => $context_definition_label,
'--context-definition-required' => $context_definition_required
],
['interactive' => false]
);
$this->assertEquals(0, $code);
}
private function getGenerator()
{
return $this
->getMockBuilder('Drupal\Console\Generator\PluginConditionGenerator')
->disableOriginalConstructor()
->setMethods(['generate'])
->getMock();
}
}

View file

@ -0,0 +1,90 @@
<?php
/**
* @file
* Contains \Drupal\Console\Test\Command\GeneratorPluginFieldCommandTest.
*/
namespace Drupal\Console\Test\Command;
use Drupal\Console\Command\Generate\PluginFieldCommand;
use Symfony\Component\Console\Tester\CommandTester;
use Drupal\Console\Test\DataProvider\PluginFieldDataProviderTrait;
class GeneratorPluginFieldCommandTest extends GenerateCommandTest
{
use PluginFieldDataProviderTrait;
/**
* Plugin block generator test
*
* @param $module
* @param $type_class_name
* @param $type_label
* @param $type_plugin_id
* @param $type_description
* @param $formatter_class_name
* @param $formatter_label
* @param $formatter_plugin_id
* @param $widget_class_name
* @param $widget_label
* @param $widget_plugin_id
* @param $field_type
* @param $default_widget
* @param $default_formatter
*
* @dataProvider commandData
*/
public function testGeneratePluginField(
$module,
$type_class_name,
$type_label,
$type_plugin_id,
$type_description,
$formatter_class_name,
$formatter_label,
$formatter_plugin_id,
$widget_class_name,
$widget_label,
$widget_plugin_id,
$field_type,
$default_widget,
$default_formatter
) {
$command = new PluginFieldCommand($this->getHelperSet());
$command->setHelperSet($this->getHelperSet());
$command->setGenerator($this->getGenerator());
$commandTester = new CommandTester($command);
$code = $commandTester->execute(
[
'--module' => $module,
'--type-class' => $type_class_name,
'--type-label' => $type_label,
'--type-plugin-id' => $type_plugin_id,
'--type-description' => $type_description,
'--formatter-class' => $formatter_class_name,
'--formatter-label' => $formatter_label,
'--formatter-plugin-id' => $formatter_plugin_id,
'--widget-class' => $widget_class_name,
'--widget-label' => $widget_label,
'--widget-plugin-id' => $widget_plugin_id,
'--field-type' => $field_type,
'--default-widget' => $default_widget,
'--default-formatter' => $default_formatter
],
['interactive' => false]
);
$this->assertEquals(0, $code);
}
private function getGenerator()
{
return $this
->getMockBuilder('Drupal\Console\Generator\PluginFieldTypeGenerator')
->disableOriginalConstructor()
->setMethods(['generate'])
->getMock();
}
}

View file

@ -0,0 +1,63 @@
<?php
/**
* @file
* Contains \Drupal\Console\Test\Command\GeneratorPluginFieldFormatterCommandTest.
*/
namespace Drupal\Console\Test\Command;
use Drupal\Console\Command\Generate\PluginFieldFormatterCommand;
use Symfony\Component\Console\Tester\CommandTester;
use Drupal\Console\Test\DataProvider\PluginFieldFormatterDataProviderTrait;
class GeneratorPluginFieldFormatterCommandTest extends GenerateCommandTest
{
use PluginFieldFormatterDataProviderTrait;
/**
* Plugin block generator test
*
* @param $module
* @param $class_name
* @param $label
* @param $plugin_id
* @param $field_type
*
* @dataProvider commandData
*/
public function testGeneratePluginFieldFormatter(
$module,
$class_name,
$label,
$plugin_id,
$field_type
) {
$command = new PluginFieldFormatterCommand($this->getHelperSet());
$command->setHelperSet($this->getHelperSet());
$command->setGenerator($this->getGenerator());
$commandTester = new CommandTester($command);
$code = $commandTester->execute(
[
'--module' => $module,
'--class' => $class_name,
'--label' => $label,
'--plugin-id' => $plugin_id,
'--field-type' => $field_type
],
['interactive' => false]
);
$this->assertEquals(0, $code);
}
private function getGenerator()
{
return $this
->getMockBuilder('Drupal\Console\Generator\PluginFieldFormatterGenerator')
->disableOriginalConstructor()
->setMethods(['generate'])
->getMock();
}
}

View file

@ -0,0 +1,69 @@
<?php
/**
* @file
* Contains \Drupal\Console\Test\Command\GeneratorPluginFieldTypeCommandTest.
*/
namespace Drupal\Console\Test\Command;
use Drupal\Console\Command\Generate\PluginFieldTypeCommand;
use Symfony\Component\Console\Tester\CommandTester;
use Drupal\Console\Test\DataProvider\PluginFieldTypeDataProviderTrait;
class GeneratorPluginFieldTypeCommandTest extends GenerateCommandTest
{
use PluginFieldTypeDataProviderTrait;
/**
* Plugin block generator test
*
* @param $module
* @param $class_name
* @param $label
* @param $plugin_id
* @param $description
* @param $default_widget
* @param $default_formatter
*
* @dataProvider commandData
*/
public function testGeneratePluginFieldType(
$module,
$class_name,
$label,
$plugin_id,
$description,
$default_widget,
$default_formatter
) {
$command = new PluginFieldTypeCommand($this->getHelperSet());
$command->setHelperSet($this->getHelperSet());
$command->setGenerator($this->getGenerator());
$commandTester = new CommandTester($command);
$code = $commandTester->execute(
[
'--module' => $module,
'--class' => $class_name,
'--label' => $label,
'--plugin-id' => $plugin_id,
'--description' => $description,
'--default-widget' => $default_widget,
'--default-formatter' => $default_formatter
],
['interactive' => false]
);
$this->assertEquals(0, $code);
}
private function getGenerator()
{
return $this
->getMockBuilder('Drupal\Console\Generator\PluginFieldTypeGenerator')
->disableOriginalConstructor()
->setMethods(['generate'])
->getMock();
}
}

View file

@ -0,0 +1,63 @@
<?php
/**
* @file
* Contains \Drupal\Console\Test\Command\GeneratorPluginFieldWidgetCommandTest.
*/
namespace Drupal\Console\Test\Command;
use Drupal\Console\Command\Generate\PluginFieldWidgetCommand;
use Symfony\Component\Console\Tester\CommandTester;
use Drupal\Console\Test\DataProvider\PluginFieldWidgetDataProviderTrait;
class GeneratorPluginFieldWidgetCommandTest extends GenerateCommandTest
{
use PluginFieldWidgetDataProviderTrait;
/**
* Plugin block generator test
*
* @param $module
* @param $class_name
* @param $label
* @param $plugin_id
* @param $field_type
*
* @dataProvider commandData
*/
public function testGeneratePluginFieldWidget(
$module,
$class_name,
$label,
$plugin_id,
$field_type
) {
$command = new PluginFieldWidgetCommand($this->getHelperSet());
$command->setHelperSet($this->getHelperSet());
$command->setGenerator($this->getGenerator());
$commandTester = new CommandTester($command);
$code = $commandTester->execute(
[
'--module' => $module,
'--class' => $class_name,
'--label' => $label,
'--plugin-id' => $plugin_id,
'--field-type' => $field_type
],
['interactive' => false]
);
$this->assertEquals(0, $code);
}
private function getGenerator()
{
return $this
->getMockBuilder('Drupal\Console\Generator\PluginFieldWidgetGenerator')
->disableOriginalConstructor()
->setMethods(['generate'])
->getMock();
}
}

View file

@ -0,0 +1,63 @@
<?php
/**
* @file
* Contains \Drupal\Console\Test\Command\GeneratorPluginImageEffectCommandTest.
*/
namespace Drupal\Console\Test\Command;
use Drupal\Console\Command\Generate\PluginImageEffectCommand;
use Symfony\Component\Console\Tester\CommandTester;
use Drupal\Console\Test\DataProvider\PluginImageEffectDataProviderTrait;
class GeneratorPluginImageEffectCommandTest extends GenerateCommandTest
{
use PluginImageEffectDataProviderTrait;
/**
* Plugin image effect generator test
*
* @param $module
* @param $class_name
* @param $plugin_label
* @param $plugin_id
* @param $description
*
* @dataProvider commandData
*/
public function testGeneratePluginImageEffect(
$module,
$class_name,
$plugin_label,
$plugin_id,
$description
) {
$command = new PluginImageEffectCommand($this->getHelperSet());
$command->setHelperSet($this->getHelperSet());
$command->setGenerator($this->getGenerator());
$commandTester = new CommandTester($command);
$code = $commandTester->execute(
[
'--module' => $module,
'--class' => $class_name,
'--label' => $plugin_label,
'--plugin-id' => $plugin_id,
'--description' => $description
],
['interactive' => false]
);
$this->assertEquals(0, $code);
}
private function getGenerator()
{
return $this
->getMockBuilder('Drupal\Console\Generator\PluginImageEffectGenerator')
->disableOriginalConstructor()
->setMethods(['generate'])
->getMock();
}
}

View file

@ -0,0 +1,61 @@
<?php
/**
* @file
* Contains \Drupal\Console\Test\Command\GeneratorPluginImageFormatterCommandTest.
*/
namespace Drupal\Console\Test\Command;
use Drupal\Console\Command\Generate\PluginImageFormatterCommand;
use Symfony\Component\Console\Tester\CommandTester;
use Drupal\Console\Test\DataProvider\PluginImageFormatterDataProviderTrait;
class GeneratorPluginImageFormatterCommandTest extends GenerateCommandTest
{
use PluginImageFormatterDataProviderTrait;
/**
* Plugin image effect generator test
*
* @param $module
* @param $class_name
* @param $plugin_label
* @param $plugin_id
* @param $description
*
* @dataProvider commandData
*/
public function testGeneratePluginImageFormatter(
$module,
$class_name,
$plugin_label,
$plugin_id
) {
$command = new PluginImageFormatterCommand($this->getHelperSet());
$command->setHelperSet($this->getHelperSet());
$command->setGenerator($this->getGenerator());
$commandTester = new CommandTester($command);
$code = $commandTester->execute(
[
'--module' => $module,
'--class' => $class_name,
'--label' => $plugin_label,
'--plugin-id' => $plugin_id
],
['interactive' => false]
);
$this->assertEquals(0, $code);
}
private function getGenerator()
{
return $this
->getMockBuilder('Drupal\Console\Generator\PluginImageFormatterGenerator')
->disableOriginalConstructor()
->setMethods(['generate'])
->getMock();
}
}

View file

@ -0,0 +1,66 @@
<?php
/**
* @file
* Contains \Drupal\Console\Test\Command\GeneratorPluginRestResourceCommandTest.
*/
namespace Drupal\Console\Test\Command;
use Drupal\Console\Command\Generate\PluginRestResourceCommand;
use Symfony\Component\Console\Tester\CommandTester;
use Drupal\Console\Test\DataProvider\PluginRestResourceDataProviderTrait;
class GeneratorPluginRestResourceCommandTest extends GenerateCommandTest
{
use PluginRestResourceDataProviderTrait;
/**
* Plugin rest resource generator test
*
* @param $module
* @param $class_name
* @param $plugin_id
* @param $plugin_label
* @param $plugin_url
* @param $plugin_states
*
* @dataProvider commandData
*/
public function testGeneratePluginRestResource(
$module,
$class_name,
$plugin_id,
$plugin_label,
$plugin_url,
$plugin_states
) {
$command = new PluginRestResourceCommand($this->getHelperSet());
$command->setHelperSet($this->getHelperSet());
$command->setGenerator($this->getGenerator());
$commandTester = new CommandTester($command);
$code = $commandTester->execute(
[
'--module' => $module,
'--class' => $class_name,
'--plugin-id' => $plugin_id,
'--plugin-label' => $plugin_label,
'--plugin-url' => $plugin_url,
'--plugin-states' => $plugin_states,
],
['interactive' => false]
);
$this->assertEquals(0, $code);
}
private function getGenerator()
{
return $this
->getMockBuilder('Drupal\Console\Generator\PluginRestResourceGenerator')
->disableOriginalConstructor()
->setMethods(['generate'])
->getMock();
}
}

View file

@ -0,0 +1,69 @@
<?php
/**
* @file
* Contains \Drupal\Console\Test\Command\GeneratorPluginRulesActionCommandTest.
*/
namespace Drupal\Console\Test\Command;
use Drupal\Console\Command\Generate\PluginRulesActionCommand;
use Symfony\Component\Console\Tester\CommandTester;
use Drupal\Console\Test\DataProvider\PluginRulesActionDataProviderTrait;
class GeneratorPluginRulesActionCommandTest extends GenerateCommandTest
{
use PluginRulesActionDataProviderTrait;
/**
* Plugin rules action generator test
*
* @param $module
* @param $class_name
* @param $label
* @param $plugin_id
* @param $category
* @param $context
* @param $type
*
* @dataProvider commandData
*/
public function testGeneratePluginRulesAction(
$module,
$class_name,
$label,
$plugin_id,
$category,
$context,
$type
) {
$command = new PluginRulesActionCommand($this->getHelperSet());
$command->setHelperSet($this->getHelperSet());
$command->setGenerator($this->getGenerator());
$commandTester = new CommandTester($command);
$code = $commandTester->execute(
[
'--module' => $module,
'--class' => $class_name,
'--label' => $label,
'--plugin-id' => $plugin_id,
'--category' => $category,
'--context' => $context,
'--type' => $type
],
['interactive' => false]
);
$this->assertEquals(0, $code);
}
private function getGenerator()
{
return $this
->getMockBuilder('Drupal\Console\Generator\PluginRulesActionGenerator')
->disableOriginalConstructor()
->setMethods(['generate'])
->getMock();
}
}

View file

@ -0,0 +1,60 @@
<?php
/**
* @file
* Contains \Drupal\Console\Test\Command\GeneratorPluginTypeAnnotationCommandTest.
*/
namespace Drupal\Console\Test\Command;
use Drupal\Console\Command\Generate\PluginTypeAnnotationCommand;
use Symfony\Component\Console\Tester\CommandTester;
use Drupal\Console\Test\DataProvider\PluginTypeYamlDataProviderTrait;
class GeneratorPluginTypeAnnotationCommandTest extends GenerateCommandTest
{
use PluginTypeYamlDataProviderTrait;
/**
* Plugin type yaml generator test
*
* @param $module
* @param $class_name
* @param $machine_name
* @param $label
*
* @dataProvider commandData
*/
public function testGeneratePluginTypeYaml(
$module,
$class_name,
$machine_name,
$label
) {
$command = new PluginTypeAnnotationCommand($this->getHelperSet());
$command->setHelperSet($this->getHelperSet());
$command->setGenerator($this->getGenerator());
$commandTester = new CommandTester($command);
$code = $commandTester->execute(
[
'--module' => $module,
'--class' => $class_name,
'--machine-name' => $machine_name,
'--label' => $label
],
['interactive' => false]
);
$this->assertEquals(0, $code);
}
private function getGenerator()
{
return $this
->getMockBuilder('Drupal\Console\Generator\PluginTypeYamlGenerator')
->disableOriginalConstructor()
->setMethods(['generate'])
->getMock();
}
}

View file

@ -0,0 +1,60 @@
<?php
/**
* @file
* Contains \Drupal\Console\Test\Command\GeneratorPluginTypeYamlCommandTest.
*/
namespace Drupal\Console\Test\Command;
use Drupal\Console\Command\Generate\PluginTypeYamlCommand;
use Symfony\Component\Console\Tester\CommandTester;
use Drupal\Console\Test\DataProvider\PluginTypeYamlDataProviderTrait;
class GeneratorPluginTypeYamlCommandTest extends GenerateCommandTest
{
use PluginTypeYamlDataProviderTrait;
/**
* Plugin type yaml generator test
*
* @param $module
* @param $plugin_class
* @param $plugin_name
* @param $plugin_file_name
*
* @dataProvider commandData
*/
public function testGeneratePluginTypeYaml(
$module,
$plugin_class,
$plugin_name,
$plugin_file_name
) {
$command = new PluginTypeYamlCommand($this->getHelperSet());
$command->setHelperSet($this->getHelperSet());
$command->setGenerator($this->getGenerator());
$commandTester = new CommandTester($command);
$code = $commandTester->execute(
[
'--module' => $module,
'--class' => $plugin_class,
'--plugin-name' => $plugin_name,
'--plugin-file-name' => $plugin_file_name
],
['interactive' => false]
);
$this->assertEquals(0, $code);
}
private function getGenerator()
{
return $this
->getMockBuilder('Drupal\Console\Generator\PluginTypeYamlGenerator')
->disableOriginalConstructor()
->setMethods(['generate'])
->getMock();
}
}

View file

@ -0,0 +1,78 @@
<?php
/**
* @file
* Contains Drupal\Console\Test\Command\GeneratorThemeCommandTest.
*/
namespace Drupal\Console\Test\Command;
use Drupal\Console\Command\Generate\ThemeCommand;
use Symfony\Component\Console\Tester\CommandTester;
use Drupal\Console\Test\DataProvider\ThemeDataProviderTrait;
class GeneratorThemeCommandTest extends GenerateCommandTest
{
use ThemeDataProviderTrait;
/**
* Theme generator test
*
* @param $theme
* @param $machine_name
* @param $theme_path
* @param $description
* @param $core
* @param $package
* @param $global_library
* @param $base_theme
* @param $regions
* @param $breakpoints
*
* @dataProvider commandData
*/
public function testGenerateTheme(
$theme,
$machine_name,
$theme_path,
$description,
$core,
$package,
$global_library,
$base_theme,
$regions,
$breakpoints
) {
$command = new ThemeCommand($this->getHelperSet());
$command->setHelperSet($this->getHelperSet());
$command->setGenerator($this->getGenerator());
$commandTester = new CommandTester($command);
$code = $commandTester->execute(
[
'--theme' => $theme,
'--machine-name' => $machine_name,
'--theme-path' => $theme_path,
'--description' => $description,
'--core' => $core,
'--package' => $package,
'--global-library' => $global_library,
'--base-theme' => $base_theme,
'--regions' => $regions,
'--breakpoints' => $breakpoints
],
['interactive' => false]
);
$this->assertEquals(0, $code);
}
private function getGenerator()
{
return $this
->getMockBuilder('Drupal\Console\Generator\ThemeGenerator')
->disableOriginalConstructor()
->setMethods(['generate'])
->getMock();
}
}