comparison core/modules/system/src/Tests/Module/VersionTest.php @ 0:4c8ae668cc8c

Initial import (non-working)
author Chris Cannam
date Wed, 29 Nov 2017 16:09:58 +0000
parents
children
comparison
equal deleted inserted replaced
-1:000000000000 0:4c8ae668cc8c
1 <?php
2
3 namespace Drupal\system\Tests\Module;
4
5 /**
6 * Tests module version dependencies.
7 *
8 * @group Module
9 */
10 class VersionTest extends ModuleTestBase {
11
12 /**
13 * Test version dependencies.
14 */
15 public function testModuleVersions() {
16 $dependencies = [
17 // Alternating between being compatible and incompatible with 8.x-2.4-beta3.
18 // The first is always a compatible.
19 'common_test',
20 // Branch incompatibility.
21 'common_test (1.x)',
22 // Branch compatibility.
23 'common_test (2.x)',
24 // Another branch incompatibility.
25 'common_test (>2.x)',
26 // Another branch compatibility.
27 'common_test (<=2.x)',
28 // Another branch incompatibility.
29 'common_test (<2.x)',
30 // Another branch compatibility.
31 'common_test (>=2.x)',
32 // Nonsense, misses a dash. Incompatible with everything.
33 'common_test (=8.x2.x, >=2.4)',
34 // Core version is optional. Compatible.
35 'common_test (=8.x-2.x, >=2.4-alpha2)',
36 // Test !=, explicitly incompatible.
37 'common_test (=2.x, !=2.4-beta3)',
38 // Three operations. Compatible.
39 'common_test (=2.x, !=2.3, <2.5)',
40 // Testing extra version. Incompatible.
41 'common_test (<=2.4-beta2)',
42 // Testing extra version. Compatible.
43 'common_test (>2.4-beta2)',
44 // Testing extra version. Incompatible.
45 'common_test (>2.4-rc0)',
46 ];
47 \Drupal::state()->set('system_test.dependencies', $dependencies);
48 $n = count($dependencies);
49 for ($i = 0; $i < $n; $i++) {
50 $this->drupalGet('admin/modules');
51 $checkbox = $this->xpath('//input[@id="edit-modules-module-test-enable"]');
52 $this->assertEqual(!empty($checkbox[0]['disabled']), $i % 2, $dependencies[$i]);
53 }
54 }
55
56 }