More tidying.
[yaffs-website] / vendor / drupal / console / Test / Generator / ServiceGeneratorTest.php
1 <?php
2
3 /**
4  * @file
5  * Contains Drupal\Console\Test\Generator\ServiceGeneratorTest.
6  */
7
8 namespace Drupal\Console\Test\Generator;
9
10 use Drupal\Console\Generator\ServiceGenerator;
11 use Drupal\Console\Test\DataProvider\ServiceDataProviderTrait;
12
13 class ServiceGeneratorTest extends GeneratorTest
14 {
15     use ServiceDataProviderTrait;
16
17     /**
18      * Service generator test
19      *
20      * @param $module
21      * @param $name
22      * @param $class
23      * @param $interface
24      * @param $services
25      * @param $path_service
26      *
27      * @dataProvider commandData
28      */
29     public function testGenerateService(
30         $module,
31         $name,
32         $class,
33         $interface,
34         $services,
35         $path_service
36     ) {
37         $generator = new ServiceGenerator();
38         $this->getRenderHelper()->setSkeletonDirs($this->getSkeletonDirs());
39         $this->getRenderHelper()->setTranslator($this->getTranslatorHelper());
40         $generator->setHelperSet($this->getHelperSet());
41
42         $generator->generate(
43             $module,
44             $name,
45             $class,
46             $interface,
47             $services,
48             $path_service
49         );
50
51         $files = [
52           $generator->getSite()->getModulePath($module).'/'.$module.'.services.yml',
53           $generator->getSite()->getModulePath($module).'/'.$path_service .'/'.$class.'.php'
54         ];
55      
56         foreach ($files as $file) {
57             $this->assertTrue(
58                 file_exists($file),
59                 sprintf('%s does not exist', $file)
60             );
61         }
62     }
63 }