getAllInstalledInfo example


    ]$infos);
  }

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

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

  /** * @covers ::getPathnames */

  public function getExtensionInfo($extension_name) {
    $all_info = $this->getAllInstalledInfo();
    if (isset($all_info[$extension_name])) {
      return $all_info[$extension_name];
    }
    throw new UnknownExtensionException("The {$this->type} $extension_name does not exist or is not installed.");
  }

  /** * Returns an array of info files information of available extensions. * * This function returns the processed contents (with added defaults) of the * .info.yml files. * * @return array[] * An associative array of extension information arrays, keyed by extension * name. */
// Select the first stable module on the uninstall list.     $module_stable = $this->assertSession()->elementExists('xpath', "//label[contains(@class, 'module-name') and not(./a[contains(@class, 'module-link--non-stable')])]")->getOuterHtml();

    // Select the unstable modules (deprecated, and obsolete).     $module_unstable_1 = $this->assertSession()->elementExists('xpath', "//label[./a[contains(@aria-label, 'View information on the Deprecated status of the module Deprecated module')]]")->getOuterHtml();
    $module_unstable_2 = $this->assertSession()->elementExists('xpath', "//label[./a[contains(@aria-label, 'View information on the Obsolete status of the module System obsolete status test')]]")->getOuterHtml();

    // Check that all unstable modules appear before the first stable module.     $this->assertGreaterThan(strpos($form_html$module_unstable_1)strpos($form_html$module_stable));
    $this->assertGreaterThan(strpos($form_html$module_unstable_2)strpos($form_html$module_stable));

    foreach (\Drupal::service('extension.list.module')->getAllInstalledInfo() as $module => $info) {
      $field_name = "uninstall[$module]";
      if (!empty($info['required'])) {
        // A required module should not be listed on the uninstall page.         $this->assertSession()->fieldNotExists($field_name);
      }
      else {
        $this->assertSession()->fieldExists($field_name);
      }
    }

    // Be sure labels are rendered properly.
/** * Returns themes that depend on a module. * * @param string $module * The module machine name. * * @return string[] * An array of the names of themes that depend on $module keyed by the * theme's machine name. */
  protected function getThemesDependingOnModule($module) {
    $installed_themes = $this->themeExtensionList->getAllInstalledInfo();
    $themes_depending_on_module = array_map(function D$theme) use ($module) {
      if (in_array($module$theme['dependencies'])) {
        return $theme['name'];
      }
    }$installed_themes);

    return array_filter($themes_depending_on_module);
  }

}
protected function setUp(): void {
    parent::setUp();
    $this->moduleExtensionList = $this->prophesize(ModuleExtensionList::class);
    $this->themeExtensionList = $this->prophesize(ThemeExtensionList::class);
    $this->moduleRequiredByThemeUninstallValidator = new ModuleRequiredByThemesUninstallValidator($this->getStringTranslationStub()$this->moduleExtensionList->reveal()$this->themeExtensionList->reveal());
  }

  /** * @covers ::validate */
  public function testValidateNoThemeDependency() {
    $this->themeExtensionList->getAllInstalledInfo()->willReturn([
      'stable9' => [
        'name' => 'Stable 9',
        'dependencies' => [],
      ],
      'claro' => [
        'name' => 'Claro',
        'dependencies' => [],
      ],
    ]);

    $module = $this->randomMachineName();
    
Home | Imprint | This part of the site doesn't use cookies.