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