Version 1
[yaffs-website] / vendor / drupal / console / Test / Generator / ProfileGeneratorTest.php
1 <?php
2 /**
3  * @file
4  * Contains Drupal\Console\Test\Generator\ProfileGeneratorTest.
5  */
6
7 namespace Drupal\Console\Test\Generator;
8
9 use Drupal\Console\Generator\ProfileGenerator;
10 use Drupal\Console\Test\DataProvider\ProfileDataProviderTrait;
11
12 /**
13  * Class ProfileGeneratorTest
14  * @package Drupal\Console\Test\Generator
15  */
16 class ProfileGeneratorTest extends GeneratorTest
17 {
18     use ProfileDataProviderTrait;
19
20     /**
21      * Profile generator test.
22      *
23      * @param $profile
24      * @param $machine_name
25      * @param $profile_path
26      * @param $description
27      * @param $core
28      * @param $dependencies
29      * @param $distribution
30      *
31      * @dataProvider commandData
32      */
33     public function testGenerateProfile(
34         $profile,
35         $machine_name,
36         $profile_path,
37         $description,
38         $core,
39         $dependencies,
40         $distribution
41     ) {
42         $generator = new ProfileGenerator();
43         $this->getRenderHelper()->setSkeletonDirs($this->getSkeletonDirs());
44         $this->getRenderHelper()->setTranslator($this->getTranslatorHelper());
45         $generator->setHelperSet($this->getHelperSet());
46
47         $generator->generate(
48             $profile,
49             $machine_name,
50             $profile_path,
51             $description,
52             $core,
53             $dependencies,
54             $distribution
55         );
56
57         $files = [
58             $machine_name . '.info.yml',
59             $machine_name . '.install',
60             $machine_name . '.profile',
61         ];
62
63         foreach ($files as $file) {
64             $file_path = $profile_path . '/' . $machine_name . '/' . $file;
65             $this->assertTrue(
66                 file_exists($file_path),
67                 sprintf('%s has been generated', $file_path)
68             );
69         }
70     }
71
72 }