Mercurial > hg > isophonics-drupal-site
comparison core/tests/Drupal/Tests/ComposerIntegrationTest.php @ 18:af1871eacc83
Update to Drupal core 8.7.1
author | Chris Cannam |
---|---|
date | Thu, 09 May 2019 15:33:08 +0100 |
parents | 1fec387a4317 |
children |
comparison
equal
deleted
inserted
replaced
17:129ea1e6d783 | 18:af1871eacc83 |
---|---|
1 <?php | 1 <?php |
2 | 2 |
3 namespace Drupal\Tests; | 3 namespace Drupal\Tests; |
4 | |
5 use Composer\Semver\Semver; | |
6 | 4 |
7 /** | 5 /** |
8 * Tests Composer integration. | 6 * Tests Composer integration. |
9 * | 7 * |
10 * @group Composer | 8 * @group Composer |
11 */ | 9 */ |
12 class ComposerIntegrationTest extends UnitTestCase { | 10 class ComposerIntegrationTest extends UnitTestCase { |
13 | |
14 /** | |
15 * The minimum PHP version supported by Drupal. | |
16 * | |
17 * @see https://www.drupal.org/docs/8/system-requirements/web-server | |
18 * | |
19 * @todo Remove as part of https://www.drupal.org/node/2908079 | |
20 */ | |
21 const MIN_PHP_VERSION = '5.5.9'; | |
22 | 11 |
23 /** | 12 /** |
24 * Gets human-readable JSON error messages. | 13 * Gets human-readable JSON error messages. |
25 * | 14 * |
26 * @return string[] | 15 * @return string[] |
75 $this->root . '/core/lib/Drupal/Component/Render', | 64 $this->root . '/core/lib/Drupal/Component/Render', |
76 $this->root . '/core/lib/Drupal/Component/Serialization', | 65 $this->root . '/core/lib/Drupal/Component/Serialization', |
77 $this->root . '/core/lib/Drupal/Component/Transliteration', | 66 $this->root . '/core/lib/Drupal/Component/Transliteration', |
78 $this->root . '/core/lib/Drupal/Component/Utility', | 67 $this->root . '/core/lib/Drupal/Component/Utility', |
79 $this->root . '/core/lib/Drupal/Component/Uuid', | 68 $this->root . '/core/lib/Drupal/Component/Uuid', |
69 $this->root . '/core/lib/Drupal/Component/Version', | |
80 ]; | 70 ]; |
81 } | 71 } |
82 | 72 |
83 /** | 73 /** |
84 * Tests composer.json. | 74 * Tests composer.json. |
177 $this->assertArrayHasKey( | 167 $this->assertArrayHasKey( |
178 'drupal/' . $module_name, | 168 'drupal/' . $module_name, |
179 $composer_replace_packages, | 169 $composer_replace_packages, |
180 'Unable to find ' . $module_name . ' in replace list of composer.json' | 170 'Unable to find ' . $module_name . ' in replace list of composer.json' |
181 ); | 171 ); |
182 } | |
183 } | |
184 | |
185 /** | |
186 * Tests package requirements for the minimum supported PHP version by Drupal. | |
187 * | |
188 * @todo This can be removed when DrupalCI supports dependency regression | |
189 * testing in https://www.drupal.org/node/2874198 | |
190 */ | |
191 public function testMinPHPVersion() { | |
192 // Check for lockfile in the application root. If the lockfile does not | |
193 // exist, then skip this test. | |
194 $lockfile = $this->root . '/composer.lock'; | |
195 if (!file_exists($lockfile)) { | |
196 $this->markTestSkipped('/composer.lock is not available.'); | |
197 } | |
198 | |
199 $lock = json_decode(file_get_contents($lockfile), TRUE); | |
200 | |
201 // Check the PHP version for each installed non-development package. The | |
202 // testing infrastructure uses the uses the development packages, and may | |
203 // update them for particular environment configurations. In particular, | |
204 // PHP 7.2+ require an updated version of phpunit, which is incompatible | |
205 // with Drupal's minimum PHP requirement. | |
206 foreach ($lock['packages'] as $package) { | |
207 if (isset($package['require']['php'])) { | |
208 $this->assertTrue(Semver::satisfies(static::MIN_PHP_VERSION, $package['require']['php']), $package['name'] . ' has a PHP dependency requirement of "' . $package['require']['php'] . '"'); | |
209 } | |
210 } | 172 } |
211 } | 173 } |
212 | 174 |
213 // @codingStandardsIgnoreStart | 175 // @codingStandardsIgnoreStart |
214 /** | 176 /** |