4a08e5de730c821f2ed452ffa14ef860095f2465
[yaffs-website] / vendor / drupal / console / Test / Command / GeneratorPluginImageEffectCommandTest.php
1 <?php
2 /**
3  * @file
4  * Contains \Drupal\Console\Test\Command\GeneratorPluginImageEffectCommandTest.
5  */
6
7 namespace Drupal\Console\Test\Command;
8
9 use Drupal\Console\Command\Generate\PluginImageEffectCommand;
10 use Symfony\Component\Console\Tester\CommandTester;
11 use Drupal\Console\Test\DataProvider\PluginImageEffectDataProviderTrait;
12
13 class GeneratorPluginImageEffectCommandTest extends GenerateCommandTest
14 {
15     use PluginImageEffectDataProviderTrait;
16     
17     /**
18      * Plugin image effect generator test
19      *
20      * @param $module
21      * @param $class_name
22      * @param $plugin_label
23      * @param $plugin_id
24      * @param $description
25      *
26      * @dataProvider commandData
27      */
28     public function testGeneratePluginImageEffect(
29         $module,
30         $class_name,
31         $plugin_label,
32         $plugin_id,
33         $description
34     ) {
35         $command = new PluginImageEffectCommand($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               '--class'     => $class_name,
45               '--label'          => $plugin_label,
46               '--plugin-id'      => $plugin_id,
47               '--description'    => $description
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\PluginImageEffectGenerator')
59             ->disableOriginalConstructor()
60             ->setMethods(['generate'])
61             ->getMock();
62     }
63 }