Security update for Core, with self-updated composer
[yaffs-website] / vendor / drupal / console / Test / Command / GeneratorEntityConfigCommandTest.php
1 <?php
2 /**
3  * @file
4  * Contains \Drupal\Console\Test\Command\GeneratorEntityConfigCommandTest.
5  */
6
7 namespace Drupal\Console\Test\Command;
8
9 use Drupal\Console\Command\Generate\EntityConfigCommand;
10 use Symfony\Component\Console\Tester\CommandTester;
11 use Drupal\Console\Test\DataProvider\EntityConfigDataProviderTrait;
12
13 class GeneratorEntityConfigCommandTest extends GenerateCommandTest
14 {
15     use EntityConfigDataProviderTrait;
16
17     /**
18      * EntityConfig generator test
19      *
20      * @param $module
21      * @param $entity_name
22      * @param $entity_class
23      * @param $label
24      * @param $base_path
25      *
26      * @dataProvider commandData
27      */
28     public function testGenerateEntityConfig(
29         $module,
30         $entity_name,
31         $entity_class,
32         $label,
33         $base_path
34     ) {
35         $command = new EntityConfigCommand($this->getHelperSet());
36         $command->setHelperSet($this->getHelperSet());
37         $command->setGenerator($this->getGenerator());
38
39         $commandTester = new CommandTester($command);
40
41         $code = $commandTester->execute(
42             [
43               '--module'         => $module,
44               '--entity-name'    => $entity_name,
45               '--entity-class'   => $entity_class,
46               '--label'          => $label,
47               '--base-path'      => $base_path,
48             ],
49             ['interactive' => false]
50         );
51
52         $this->assertEquals(0, $code);
53     }
54
55     private function getGenerator()
56     {
57         return $this
58             ->getMockBuilder('Drupal\Console\Generator\EntityConfigGenerator')
59             ->disableOriginalConstructor()
60             ->setMethods(['generate'])
61             ->getMock();
62     }
63 }