diff options
author | Dries Buytaert <dries@buytaert.net> | 2009-07-28 19:06:16 +0000 |
---|---|---|
committer | Dries Buytaert <dries@buytaert.net> | 2009-07-28 19:06:16 +0000 |
commit | 12d6d6662eb6300e9ea00fc39440f209b99d86d4 (patch) | |
tree | 9398119b45febdc33a1578f9f5712be328cff939 /modules/system/system.test | |
parent | 3625dddf1174adce9dd988c7139e2a58b9245f52 (diff) | |
download | brdo-12d6d6662eb6300e9ea00fc39440f209b99d86d4.tar.gz brdo-12d6d6662eb6300e9ea00fc39440f209b99d86d4.tar.bz2 |
- Patch #211747 by chx, alex_b, dww: allow specifying version information as part of module dependencies.
Diffstat (limited to 'modules/system/system.test')
-rw-r--r-- | modules/system/system.test | 55 |
1 files changed, 55 insertions, 0 deletions
diff --git a/modules/system/system.test b/modules/system/system.test index a48cbd95a..09f49b9f5 100644 --- a/modules/system/system.test +++ b/modules/system/system.test @@ -198,6 +198,61 @@ class ModuleDependencyTestCase extends ModuleTestCase { } /** + * Test module dependency on specific versions. + */ +class ModuleVersionTestCase extends ModuleTestCase { + public static function getInfo() { + return array( + 'name' => 'Module versions', + 'description' => 'Check module version dependencies.', + 'group' => 'Module', + ); + } + + function setup() { + parent::setUp('module_test'); + } + + /** + * Test version dependencies. + */ + function testModuleVersions() { + $dependencies = array( + // Alternating between being compatible and incompatible with 7.x-2.4. + // The first is always a compatible. + 'common_test', + // Branch incompatibility. + 'common_test (1.x)', + // Branch compatibility. + 'common_test (2.x)', + // Another branch incompatibility. + 'common_test (>2.x)', + // Another branch compatibility. + 'common_test (<=2.x)', + // Another branch incompatibility. + 'common_test (<2.x)', + // Another branch compatibility. + 'common_test (>=2.x)', + // Nonsense, misses a dash. Incompatible with everything. + 'common_test (=7.x2.x, >=2.4)', + // Core version is optional. Compatible. + 'common_test (=7.x-2.x, >=2.4)', + // Test !=, explicitly incompatible. + 'common_test (=2.x, !=2.4)', + // Three operations. Compatible. + 'common_test (=2.x, !=2.3, <2.5)', + ); + variable_set('dependencies', $dependencies); + $n = count($dependencies); + for ($i = 0; $i < $n; $i++) { + $this->drupalGet('admin/structure/modules'); + $checkbox = $this->xpath('//input[@id="edit-modules-Testing-module-test-enable"]'); + $this->assertEqual(!empty($checkbox[0]['disabled']), $i % 2, $dependencies[$i]); + } + } +} + +/** * Test required modules functionality. */ class ModuleRequiredTestCase extends ModuleTestCase { |