Yaffs site version 1.1
[yaffs-website] / vendor / drupal / console / Test / Command / GenerateEntityBundleCommandTest.php
1 <?php
2 /**
3  * @file
4  * Contains \Drupal\Console\Test\Command\GenerateEntityBundleCommandTest.
5  */
6
7 namespace Drupal\Console\Test\Command;
8
9 use Drupal\Console\Command\Generate\EntityBundleCommand;
10 use Symfony\Component\Console\Tester\CommandTester;
11 use Drupal\Console\Test\DataProvider\EntityBundleDataProviderTrait;
12
13 class GenerateEntityBundleCommandTest extends GenerateCommandTest
14 {
15     use EntityBundleDataProviderTrait;
16
17     /**
18      * ContentType generator test
19      *
20      * @param $module
21      * @param $bundle_name
22      * @param $bundle_title
23      *
24      * @dataProvider commandData
25      */
26     public function testGenerateContentType(
27         $module,
28         $bundle_name,
29         $bundle_title
30     ) {
31         $command = new EntityBundleCommand($this->getHelperSet());
32         $command->setHelperSet($this->getHelperSet());
33         $command->setGenerator($this->getGenerator());
34
35         $commandTester = new CommandTester($command);
36
37         $code = $commandTester->execute(
38             [
39               '--module'         => $module,
40               '--bundle-name'    => $bundle_name,
41               '--bundle-title'   => $bundle_title
42             ],
43             ['interactive' => false]
44         );
45
46         $this->assertEquals(0, $code);
47     }
48
49     private function getGenerator()
50     {
51         return $this
52             ->getMockBuilder('Drupal\Console\Generator\EntityBundleGenerator')
53             ->disableOriginalConstructor()
54             ->setMethods(['generate'])
55             ->getMock();
56     }
57 }