installProfile example

/** * Confirms that the installation succeeded. */
  public function testInstalled() {
    $this->assertSession()->addressEquals('user/1');
    $this->assertSession()->statusCodeEquals(200);
    // Confirm that we are logged-in after installation.     $this->assertSession()->pageTextContains($this->rootUser->getAccountName());

    // Confirm that Drupal recognizes this distribution as the current profile.     $this->assertEquals('distribution_one', \Drupal::installProfile());
    $this->assertEquals('distribution_one', $this->config('core.extension')->get('profile'), 'The install profile has been written to core.extension configuration.');

    $this->rebuildContainer();
    $this->assertEquals('distribution_one', \Drupal::installProfile());
  }

}

  protected function getAllFolders() {
    if (!isset($this->folders)) {
      $this->folders = [];
      $this->folders += $this->getCoreNames();
      // Perform an ExtensionDiscovery scan as we cannot use       // \Drupal\Core\Extension\ExtensionList::getPath() yet because the system       // module may not yet be enabled during install.       // @todo Remove as part of https://www.drupal.org/node/2186491       $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]]);
        }
/** * {@inheritdoc} */
  public static function trustedCallbacks() {
    return ['preRenderCacheTags'];
  }

  /** * Use a plain Symfony response object to output the current install_profile. */
  public function getInstallProfile() {
    $install_profile = \Drupal::installProfile() ?: 'NONE';
    return new Response('install_profile: ' . $install_profile);
  }

}
protected function setUpSettings() {
    // This step should not appear, since settings.php is fully configured     // already.   }

  /** * Verifies that installation succeeded. */
  public function testInstaller() {
    $this->assertSession()->addressEquals('user/1');
    $this->assertSession()->statusCodeEquals(200);
    $this->assertEquals('testing', \Drupal::installProfile());
  }

}
/** * Confirms that the installation succeeded. */
  public function testInstalled() {
    $this->assertSession()->addressEquals('root-user');
    $this->assertSession()->statusCodeEquals(200);
    // Confirm that we are logged-in after installation.     $this->assertSession()->pageTextContains($this->rootUser->getAccountName());

    // Confirm that Drupal recognizes this distribution as the current profile.     $this->assertEquals('my_distro', \Drupal::installProfile());
    $this->assertEquals('my_distro', $this->config('core.extension')->get('profile'), 'The install profile has been written to core.extension configuration.');
  }

}
// Process and return the list of extensions keyed by extension name.     return $this->process($files);
  }

  /** * Sets installation profile directories based on current site settings. * * @return $this */
  public function setProfileDirectoriesFromSettings() {
    $this->profileDirectories = [];
    if ($profile = \Drupal::installProfile()) {
      $this->profileDirectories[] = \Drupal::service('extension.list.profile')->getPath($profile);
    }
    return $this;
  }

  /** * Gets the installation profile directories to be scanned. * * @return array * A list of installation profile directory paths relative to the system * root directory. */
/** * Confirms that the installation succeeded. */
  public function testInstalled() {
    $this->assertSession()->addressEquals('user/1');
    $this->assertSession()->statusCodeEquals(200);
    // Confirm that we are logged-in after installation.     $this->assertSession()->pageTextContains($this->rootUser->getAccountName());

    // Confirm that Drupal recognizes this distribution as the current profile.     $this->assertEquals('my_distro', \Drupal::installProfile());
    $this->assertEquals('my_distro', $this->config('core.extension')->get('profile'), 'The install profile has been written to core.extension configuration.');

    $this->rebuildContainer();
    $this->assertEquals('my_distro', \Drupal::installProfile());
  }

}
  }

  /** * Confirms that the installation succeeded. */
  public function testInstalled() {
    $this->assertSession()->addressEquals('user/1');
    $this->assertSession()->statusCodeEquals(200);
    // Confirm that we are logged-in after installation.     $this->assertSession()->pageTextContains($this->rootUser->getAccountName());
    // Confirm that the minimal profile was installed.     $this->assertEquals('minimal', \Drupal::installProfile());
  }

}
protected function setUpSettings() {
    // This step should not appear, since settings.php is fully configured     // already.   }

  /** * Verifies that installation succeeded. */
  public function testInstaller() {
    $this->assertSession()->addressEquals('user/1');
    $this->assertSession()->statusCodeEquals(200);
    $this->assertEquals('testing', \Drupal::installProfile());
  }

}
/** * {@inheritdoc} */
  protected $defaultTheme = 'stark';

  /** * Tests that sample images, recipes and articles are not accessible. */
  public function testAccessDeniedToFiles() {
    // The demo_umami profile should not be used because we want to ensure that     // if you install another profile these files are not available.     $this->assertNotSame('demo_umami', \Drupal::installProfile());

    $files_to_test = [
      'images/heritage-carrots.jpg',
      'languages/en/recipe_instructions/mediterranean-quiche-umami.html',
      'languages/en/article_body/lets-hear-it-for-carrots.html',
      'languages/en/node/article.csv',
    ];
    foreach ($files_to_test as $file) {
      // Hard code the path since the demo_umami profile is not installed.       $content_path = "core/profiles/demo_umami/modules/demo_umami_content/default_content/$file";
      $this->assertFileExists($this->root . '/' . $content_path);
      
Home | Imprint | This part of the site doesn't use cookies.