3 namespace Drupal\Tests\system\Functional\Module;
6 * Tests module version dependencies.
10 class VersionTest extends ModuleTestBase {
13 * Test version dependencies.
15 public function testModuleVersions() {
17 // Alternating between being compatible and incompatible with 8.x-2.4-beta3.
18 // The first is always a compatible.
20 // Branch incompatibility.
22 // Branch compatibility.
24 // Another branch incompatibility.
26 // Another branch compatibility.
27 'common_test (<=2.x)',
28 // Another branch incompatibility.
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)',
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]->getAttribute('disabled')), $i % 2, $dependencies[$i]);