Skip to content
Snippets Groups Projects
Select Git revision
  • e839a9726a0f9abb4e6776b56eabdce546a961ce
  • 11.x default protected
  • 11.2.x protected
  • 10.5.x protected
  • 10.6.x protected
  • 11.1.x protected
  • 10.4.x protected
  • 11.0.x protected
  • 10.3.x protected
  • 7.x protected
  • 10.2.x protected
  • 10.1.x protected
  • 9.5.x protected
  • 10.0.x protected
  • 9.4.x protected
  • 9.3.x protected
  • 9.2.x protected
  • 9.1.x protected
  • 8.9.x protected
  • 9.0.x protected
  • 8.8.x protected
  • 10.5.1 protected
  • 11.2.2 protected
  • 11.2.1 protected
  • 11.2.0 protected
  • 10.5.0 protected
  • 11.2.0-rc2 protected
  • 10.5.0-rc1 protected
  • 11.2.0-rc1 protected
  • 10.4.8 protected
  • 11.1.8 protected
  • 10.5.0-beta1 protected
  • 11.2.0-beta1 protected
  • 11.2.0-alpha1 protected
  • 10.4.7 protected
  • 11.1.7 protected
  • 10.4.6 protected
  • 11.1.6 protected
  • 10.3.14 protected
  • 10.4.5 protected
  • 11.0.13 protected
41 results

CacheCollectorInterface.php

Blame
  • Code owners
    Assign users and groups as approvers for specific file changes. Learn more.
    DependencyTest.php 7.84 KiB
    <?php
    
    /**
     * @file
     * Contains \Drupal\system\Tests\Module\DependencyTest.
     */
    
    namespace Drupal\system\Tests\Module;
    
    /**
     * Tests module dependency functionality.
     */
    class DependencyTest extends ModuleTestBase {
      public static function getInfo() {
        return array(
          'name' => 'Module dependencies',
          'description' => 'Enable module without dependency enabled.',
          'group' => 'Module',
        );
      }
    
      /**
       * Attempts to enable the Content Translation module without Language enabled.
       */
      function testEnableWithoutDependency() {
        // Attempt to enable Content Translation without Language enabled.
        $edit = array();
        $edit['modules[Multilingual][content_translation][enable]'] = 'content_translation';
        $this->drupalPostForm('admin/modules', $edit, t('Save configuration'));
        $this->assertText(t('Some required modules must be enabled'), 'Dependency required.');
    
        $this->assertModules(array('content_translation', 'language'), FALSE);
    
        // Assert that the language tables weren't enabled.
        $this->assertTableCount('language', FALSE);
    
        $this->drupalPostForm(NULL, NULL, t('Continue'));
        $this->assertText(t('The configuration options have been saved.'), 'Modules status has been updated.');
    
        $this->assertModules(array('content_translation', 'language'), TRUE);
    
        // Assert that the language YAML files were created.
        $storage = $this->container->get('config.storage');
        $this->assertTrue(count($storage->listAll('language.entity.')) > 0, 'Language config entity files exist.');
      }
    
      /**
       * Attempts to enable a module with a missing dependency.
       */
      function testMissingModules() {
        // Test that the system_dependencies_test module is marked
        // as missing a dependency.
        $this->drupalGet('admin/modules');
        $this->assertRaw(t('@module (<span class="admin-missing">missing</span>)', array('@module' => drupal_ucfirst('_missing_dependency'))), 'A module with missing dependencies is marked as such.');
        $checkbox = $this->xpath('//input[@type="checkbox" and @disabled="disabled" and @name="modules[Testing][system_dependencies_test][enable]"]');
        $this->assert(count($checkbox) == 1, 'Checkbox for the module is disabled.');
      }
    
      /**
       * Tests enabling a module that depends on an incompatible version of a module.
       */
      function testIncompatibleModuleVersionDependency() {
        // Test that the system_incompatible_module_version_dependencies_test is
        // marked as having an incompatible dependency.
        $this->drupalGet('admin/modules');
        $this->assertRaw(t('@module (<span class="admin-missing">incompatible with</span> version @version)', array(
          '@module' => 'System incompatible module version test (>2.0)',
          '@version' => '1.0',
        )), 'A module that depends on an incompatible version of a module is marked as such.');
        $checkbox = $this->xpath('//input[@type="checkbox" and @disabled="disabled" and @name="modules[Testing][system_incompatible_module_version_dependencies_test][enable]"]');