4 * Class CRM_Core_ComposerConfigTest
7 class CRM_Core_ComposerConfigTest
extends \PHPUnit\Framework\TestCase
{
10 * Assert that `composer.lock` remains as expected.
13 * - In `civicrm-core`, the `composer.json` is permissive. It can be updated
14 * to support different versions of Symfony.
15 * - In `civicrm-core`, the `composer.lock` is less permissive, driven by
16 * the interests of existing D7/WP/J sites.
18 * Without this check, a well-meaning developer may upgrade the
19 * `composer.lock`, and no one would notice the change in policy
20 * because reviewers' eyes tend to gloss over `composer.lock`.
22 public function testHardLocks() {
24 'symfony/config' => '/^v2\.8\./',
25 'symfony/dependency-injection' => '/^v2\.8\./',
26 'symfony/event-dispatcher' => '/^v2\.8\./',
27 'symfony/filesystem' => '/^v2\.8\./',
28 'symfony/finder' => '/^v2\.8\./',
29 'symfony/process' => '/^v2\.8\./',
32 $lockFile = Civi
::paths()->getPath('[civicrm.root]/composer.lock');
33 $lock = json_decode(file_get_contents($lockFile), 1);
35 foreach ($lock['packages'] as $package) {
36 if (isset($hardLocks[$package['name']])) {
37 $this->assertRegExp($hardLocks[$package['name']], $package['version'],
38 "Check hardlock for " . $package['name']);
39 unset($hardLocks[$package['name']]);
42 $this->assertEquals(array(), $hardLocks,
43 'composer.lock should have references to all hardlocks');