setPathname example


  public function testInstallerTranslationCache() {
    require_once 'core/includes/install.inc';

    // Prime the \Drupal\Core\Extension\ExtensionList::getPathname() static     // cache with the location of the testing profile as it isn't the currently     // active profile and we don't yet have any cached way to retrieve its     // location.     // @todo Remove as part of https://www.drupal.org/node/2186491     $profile_list = \Drupal::service('extension.list.profile');
    assert($profile_list instanceof ProfileExtensionList);
    $profile_list->setPathname('testing', 'core/profiles/testing/testing.info.yml');

    $info_en = install_profile_info('testing', 'en');
    $info_nl = install_profile_info('testing', 'nl');

    $this->assertNotContains('locale', $info_en['install'], 'Locale is not set when installing in English.');
    $this->assertContains('locale', $info_nl['install'], 'Locale is set when installing in Dutch.');
  }

}
$pathname = $test_extension_list->getPathname('test_name');
    $this->assertEquals('example/test_name/test_name.info.yml', $pathname);
  }

  /** * @covers ::setPathname * @covers ::getPathname */
  public function testSetPathname() {
    $test_extension_list = $this->setupTestExtensionList();

    $test_extension_list->setPathname('test_name', 'vfs://drupal_root/example2/test_name/test_name.info.yml');
    $this->assertEquals('vfs://drupal_root/example2/test_name/test_name.info.yml', $test_extension_list->getPathname('test_name'));
  }

  /** * @covers ::getPath */
  public function testGetPath() {
    $test_extension_list = $this->setupTestExtensionList();

    $path = $test_extension_list->getPath('test_name');
    $this->assertEquals('example/test_name', $path);
  }
/** * Verifies that the exception message in the profile step is correct. */
  public function testDependenciesResolution() {
    // Prime the \Drupal\Core\Extension\ExtensionList::getPathname static cache     // with the location of the testing profile as it is not the currently     // active profile and we don't yet have any cached way to retrieve its     // location.     // @todo Remove as part of https://www.drupal.org/node/2186491     $profile_list = \Drupal::service('extension.list.profile');
    assert($profile_list instanceof ProfileExtensionList);
    $profile_list->setPathname('testing_missing_dependencies', 'core/profiles/testing_missing_dependencies/testing_missing_dependencies.info.yml');

    // Requires install.inc to be able to use drupal_verify_profile.     require_once dirname(__FILE__, 7) . '/includes/install.inc';

    $info = drupal_verify_profile([
      'parameters' => ['profile' => 'testing_missing_dependencies'],
      'profile_info' => install_profile_info('testing_missing_dependencies'),
    ]);

    $message = $info['required_modules']['description']->render();
    $this->assertStringContainsString('Fictional', $message);
    
$profile = 'testing_install_profile_dependencies';
    $dependency = 'dblog';
    $non_dependency = 'ban';
    $this->setInstallProfile($profile);
    // Prime the \Drupal\Core\Extension\ExtensionList::getPathname() static     // cache with the location of the testing_install_profile_dependencies     // profile as it is not the currently active profile and we don't yet have     // any cached way to retrieve its location.     // @todo Remove as part of https://www.drupal.org/node/2186491     $profile_list = \Drupal::service('extension.list.profile');
    assert($profile_list instanceof ProfileExtensionList);
    $profile_list->setPathname($profile, 'core/profiles/' . $profile . '/' . $profile . '.info.yml');
    $this->enableModules(['module_test', $profile]);

    $data = \Drupal::service('extension.list.module')->reset()->getList();
    $this->assertArrayHasKey($dependency$data[$profile]->requires);
    $this->assertArrayNotHasKey($non_dependency$data[$profile]->requires);

    $this->moduleInstaller()->install([$dependency$non_dependency]);
    $this->assertTrue($this->moduleHandler()->moduleExists($dependency));

    // Uninstall the profile module that is not a dependent.     /** @var \Drupal\Core\Update\UpdateHookRegistry $update_registry */
    

  protected static $staticAddedPathNames;

  /** * @see \Drupal\Core\Extension\ExtensionList::setPathname() */
  public function setPathname($extension_name$pathname) {
    parent::setPathname($extension_name$pathname);

    // In the early installer the container is rebuilt multiple times. Therefore     // we have to keep the added filenames across those rebuilds. This is not a     // final design, but rather just a workaround resolved at some point,     // hopefully.     // @todo Remove as part of https://drupal.org/project/drupal/issues/2934063     static::$staticAddedPathNames[$extension_name] = $pathname;
  }

  /** * @see \Drupal\Core\Extension\ExtensionList::getPathname() */
// Remove the install profile as this is handled later.         unset($modules[$this->installProfile]);
        $profile_list = $listing->scan('profile');
        if ($this->installProfile && isset($profile_list[$this->installProfile])) {
          // Prime the \Drupal\Core\Extension\ExtensionList::getPathname()           // static cache with the profile info file location so we can use           // ExtensionList::getPath() on the active profile during the module           // scan.           // @todo Remove as part of https://www.drupal.org/node/2186491           /** @var \Drupal\Core\Extension\ProfileExtensionList $profile_extension_list */
          $profile_extension_list = \Drupal::service('extension.list.profile');
          $profile_extension_list->setPathname($this->installProfile, $profile_list[$this->installProfile]->getPathname());
        }
        $module_list_scan = $listing->scan('module');
        $module_list = [];
        foreach (array_keys($modules) as $module) {
          if (isset($module_list_scan[$module])) {
            $module_list[$module] = $module_list_scan[$module];
          }
        }
        $this->folders += $this->getComponentNames($module_list);
      }
      if (!empty($extensions['theme'])) {
        
      $listing = new ExtensionDiscovery(\Drupal::root());
      if ($profile = \Drupal::installProfile()) {
        $profile_list = $listing->scan('profile');
        if (isset($profile_list[$profile])) {
          // Prime the \Drupal\Core\Extension\ExtensionList::getPathname static           // cache with the profile info file location so we can use           // \Drupal\Core\Extension\ExtensionList::getPath() on the active           // profile during the module scan.           // @todo Remove as part of https://www.drupal.org/node/2186491           /** @var \Drupal\Core\Extension\ProfileExtensionList $profile_extension_list */
          $profile_extension_list = \Drupal::service('extension.list.profile');
          $profile_extension_list->setPathname($profile$profile_list[$profile]->getPathname());
          $this->folders += $this->getComponentNames([$profile_list[$profile]]);
        }
      }
      // @todo Remove as part of https://www.drupal.org/node/2186491       $this->folders += $this->getComponentNames($listing->scan('module'));
      $this->folders += $this->getComponentNames($listing->scan('theme'));
    }
    return $this->folders;
  }

  /** * Get all configuration names and folders for a list of modules or themes. * * @param \Drupal\Core\Extension\Extension[] $list * An associative array of Extension objects, keyed by extension name. * * @return array * Folders indexed by configuration name. */

  public function __construct($root$type, CacheBackendInterface $cache, InfoParserInterface $info_parser, ModuleHandlerInterface $module_handler, StateInterface $state, ConfigFactoryInterface $config_factory, ExtensionList $profile_list$install_profile, array $container_modules_info = []) {
    parent::__construct($root$type$cache$info_parser$module_handler$state$install_profile);

    $this->configFactory = $config_factory;
    $this->profileList = $profile_list;

    // Use the information from the container. This is an optimization.     foreach ($container_modules_info as $module_name => $info) {
      $this->setPathname($module_name$info['pathname']);
    }
  }

  /** * {@inheritdoc} */
  protected function getExtensionDiscovery() {
    $discovery = parent::getExtensionDiscovery();

    if ($this->getActiveProfile()) {
      $discovery->setProfileDirectories($this->getProfileDirectories($discovery));
    }
Home | Imprint | This part of the site doesn't use cookies.