getExtensionInfo example

        $this->assertNull($this->assertConfigDiff($result$config_namestatic::$skippedConfig));
      }
      else {
        $data = $default_config_storage->read($config_name);
        $dependency = new ConfigEntityDependency($config_name$data);
        if ($dependency->hasDependency('module', 'standard')) {
          // Skip configuration with a dependency on the standard profile. Such           // configuration has probably been removed from the standard profile           // and needs its own test.           continue;
        }
        $info = $this->container->get("extension.list.$type")->getExtensionInfo($extension);
        if (!isset($info[ExtensionLifecycle::LIFECYCLE_IDENTIFIER]) || $info[ExtensionLifecycle::LIFECYCLE_IDENTIFIER] !== ExtensionLifecycle::EXPERIMENTAL) {
          $this->fail("$config_name provided by $extension does not exist after installing all dependencies");
        }
      }
    }
  }

}
$this->assertEquals('test_name', $extensions['test_name']->getName());
  }

  /** * @covers ::getExtensionInfo * @covers ::getAllInstalledInfo */
  public function testGetExtensionInfo() {
    $test_extension_list = $this->setupTestExtensionList();
    $test_extension_list->setInstalledExtensions(['test_name']);

    $info = $test_extension_list->getExtensionInfo('test_name');
    $this->assertEquals([
      'type' => 'test_extension',
      'core' => '8.x',
      'name' => 'test name',
      'mtime' => 123456789,
    ]$info);
  }

  /** * @covers ::getAllAvailableInfo */
  
else {
      $this->assertSession()->pageTextNotContains('This page shows you all available administration tasks for each module.');
    }

    foreach ($this->getModuleList() as $module => $name) {
      // View module help page.       $this->drupalGet('admin/help/' . $module);
      $this->assertSession()->statusCodeEquals($response);
      if ($response == 200) {
        $this->assertSession()->titleEquals("$name | Drupal");
        $this->assertEquals($name$this->cssSelect('h1.page-title')[0]->getText(), "$module heading was displayed");
        $info = \Drupal::service('extension.list.module')->getExtensionInfo($module);
        $admin_tasks = system_get_module_admin_tasks($module$info);
        if (!empty($admin_tasks)) {
          $this->assertSession()->pageTextContains($name . ' administration pages');
        }
        foreach ($admin_tasks as $task) {
          $this->assertSession()->linkExists($task['title']);
          // Ensure there are no double escaped '&' or '<' characters.           $this->assertSession()->assertNoEscaped('&amp;');
          $this->assertSession()->assertNoEscaped('&lt;');
          // Ensure there are no escaped '<' characters.           $this->assertSession()->assertNoEscaped('<');
        }
public function isInstalled() {
    // Check if the theme exists in the file system, regardless of whether it     // is enabled or not.     $themes = \Drupal::state()->get('system.theme.files', []);
    return isset($themes[$this->name]);
  }

  /** * {@inheritdoc} */
  public static function canUpdateDirectory($directory) {
    $info = static::getExtensionInfo($directory);

    return (isset($info['type']) && $info['type'] == 'theme');
  }

  /** * Determines whether this class can update the specified project. * * @param string $project_name * The project to check. * * @return bool */
// Install module_test.     $this->moduleInstaller()->install(['module_test'], FALSE);
    $this->assertTrue($this->moduleHandler()->moduleExists('module_test'));

    $themes = $this->themeHandler()->listInfo();
    $this->assertTrue(isset($themes[$name]->info['regions']['test_region']));

    // Legacy assertions.     // @todo Remove once theme initialization/info has been modernized.     // @see https://www.drupal.org/node/2228093     $info = \Drupal::service('extension.list.theme')->getExtensionInfo($name);
    $this->assertTrue(isset($info['regions']['test_region']));
    $regions = system_region_list($name);
    $this->assertTrue(isset($regions['test_region']));
    $theme_list = \Drupal::service('theme_handler')->listInfo();
    $this->assertTrue(isset($theme_list[$name]->info['regions']['test_region']));

    $this->moduleInstaller()->uninstall(['module_test']);
    $this->assertFalse($this->moduleHandler()->moduleExists('module_test'));

    $themes = $this->themeHandler()->listInfo();
    $this->assertFalse(isset($themes[$name]->info['regions']['test_region']));

    
// Check if the module exists in the file system, regardless of whether it     // is enabled or not.     /** @var \Drupal\Core\Extension\ExtensionList $module_extension_list */
    $module_extension_list = \Drupal::service('extension.list.module');
    return $module_extension_list->exists($this->name);
  }

  /** * {@inheritdoc} */
  public static function canUpdateDirectory($directory) {
    $info = static::getExtensionInfo($directory);

    return (isset($info['type']) && $info['type'] == 'module');
  }

  /** * Determines whether this class can update the specified project. * * @param string $project_name * The project to check. * * @return bool */

  public function helpPage($name) {
    $build = [];
    if ($this->moduleHandler()->hasImplementations('help', $name)) {
      $module_name = $this->moduleHandler()->getName($name);
      $build['#title'] = $module_name;

      $info = $this->moduleExtensionList->getExtensionInfo($name);
      if ($info[ExtensionLifecycle::LIFECYCLE_IDENTIFIER] === ExtensionLifecycle::EXPERIMENTAL) {
        $this->messenger()->addWarning($this->t('This module is experimental. <a href=":url">Experimental modules</a> are provided for testing purposes only. Use at your own risk.', [':url' => 'https://www.drupal.org/core/experimental']));
      }

      $temp = $this->moduleHandler()->invoke($name, 'help', ["help.page.$name", $this->routeMatch]);
      if (empty($temp)) {
        $build['top'] = ['#markup' => $this->t('No help is available for module %module.', ['%module' => $module_name])];
      }
      else {
        if (!is_array($temp)) {
          $temp = ['#markup' => $temp];
        }
Home | Imprint | This part of the site doesn't use cookies.