Yaffs site version 1.1
[yaffs-website] / vendor / drush / drush / tests / makeConvertTest.php
1 <?php
2
3 namespace Unish;
4
5 /**
6  * Make makefile tests.
7  * @group make
8  * @group slow
9  */
10 class makeConvertCase extends CommandUnishTestCase {
11
12   /**
13    * Tests the conversion of make file to various formats.
14    *
15    * @param string $source_filename
16    *   The source file to be converted.
17    *
18    * @param $options
19    *   Options to be passed to the make-convert command. E.g., --format=yml.
20    *
21    * @param $expected_lines
22    *   An array of lines expected to be present in the command output.
23    *
24    * @dataProvider providerTestMakeConvert
25    */
26   public function testMakeConvert($source_filename, $options, $expected_lines) {
27     $makefile_dir =  dirname(__FILE__) . DIRECTORY_SEPARATOR . 'makefiles';
28     $source_file = $makefile_dir . DIRECTORY_SEPARATOR . $source_filename;
29     $return = $this->drush('make-convert', array($source_file), $options);
30     $output = $this->getOutput();
31     foreach ($expected_lines as $expected_line) {
32       $this->assertContains($expected_line, $output);
33     }
34   }
35
36   /**
37    * Data provider for testMakeConvert().
38    *
39    * @return array
40    *   An array of test case data. See testMakeConvert() signature.
41    */
42   public function providerTestMakeConvert() {
43     return array(
44       array(
45         // Source filename in makefiles directory.
46         'patches.make',
47         // Command pptions.
48         array('format' => 'yml'),
49         // Expected output lines.
50         array(
51           'core: 7.x',
52           'features:',
53           'version: 1.0-beta4',
54           'patch:',
55           "- 'http://drupal.org/files/issues/features-drush-backend-invoke-25.patch'",
56         ),
57       ),
58       array(
59         'patches.make',
60         array('format' => 'composer'),
61         array(
62           '"drupal/drupal": "7.*",',
63           '"drupal/features": "7.1.0-beta4",',
64           '"patches": {',
65           '"drupal/features": {',
66           '"Enter drupal/features patch #0 description here": "http://drupal.org/files/issues/features-drush-backend-invoke-25.patch"',
67         ),
68       ),
69       array(
70         'patches.make.yml',
71         array('format' => 'composer'),
72         array(
73           '"drupal/drupal": "7.*",',
74           '"drupal/features": "7.1.0-beta4",',
75           '"patches": {',
76           '"drupal/features": {',
77           '"Enter drupal/features patch #0 description here": "http://drupal.org/files/issues/features-drush-backend-invoke-25.patch"',
78         ),
79       ),
80       array(
81         'composer.lock',
82         array('format' => 'make'),
83         array(
84           'core = 7.x',
85           'api = 2',
86           // Ensure Drupal core tag is set correctly.
87           'projects[drupal][download][tag] = "7.43"',
88           'projects[features][download][type] = "git"',
89           'projects[features][download][url] = "https://git.drupal.org/project/features"',
90           'projects[features][download][tag] = "7.x-1.0-beta4"',
91           'projects[features][patch][0] = "http://drupal.org/files/issues/features-drush-backend-invoke-25.patch"'),
92       ),
93       array(
94         'composer.lock',
95         array('format' => 'yml'),
96         array(
97           'core: 7.x',
98           'api: 2',
99           // Ensure Drupal core tag is set correctly.
100           "tag: '7.43'",
101           'features:',
102           'tag: 7.x-1.0-beta4',
103           'patch:',
104           "- 'http://drupal.org/files/issues/features-drush-backend-invoke-25.patch'",
105         ),
106       ),
107     );
108   }
109
110 }