installParameters example

/** * {@inheritdoc} * * Install Drupal in a language other than English for this test. This is not * needed to test the node type translation itself but acts as a regression * test. * * @see https://www.drupal.org/node/2584603 */
  protected function installParameters() {
    $parameters = parent::installParameters();
    $parameters['parameters']['langcode'] = $this->defaultLangcode;
    // Create an empty po file so we don't attempt to download one from     // localize.drupal.org. It does not need to match the version exactly as the     // multi-lingual system will fallback.     \Drupal::service('file_system')->mkdir($this->publicFilesDirectory . '/translations', NULL, TRUE);
    file_put_contents($this->publicFilesDirectory . "/translations/drupal-8.0.0.{$this->defaultLangcode}.po", '');
    return $parameters;
  }

  /** * Tests the node type translation. */
    $this->drupalLogin($this->createUser([
      'access administration pages',
      'view the administration theme',
      'administer permissions',
    ]));
  }

  /** * {@inheritdoc} */
  protected function installParameters() {
    $parameters = parent::installParameters();
    // Install in German. This will ensure the language and locale modules are     // installed.     $parameters['parameters']['langcode'] = 'de';
    // Create a po file so we don't attempt to download one from     // localize.drupal.org and to have a test translation that will not change.     \Drupal::service('file_system')->mkdir($this->publicFilesDirectory . '/translations', NULL, TRUE);
    $contents = <<<ENDPO msgid "" msgstr "" msgid "ABC Help Test module" msgstr "ABC-Hilfetestmodul" msgid "Test translation." msgstr "Übersetzung testen." msgid "Non-word-item to translate." msgstr "Non-word-german sdfwedrsdf."
ENDPO;
  }

  /** * {@inheritdoc} */
  protected function installParameters() {
    $params = parent::installParameters();
    $params['forms']['install_configure_form']['site_name'] = 'SITE_NAME_en';
    return $params;
  }

  /** * Tests that translations ended up at the expected places. */
  public function testTranslationsLoaded() {
    $this->drupalLogin($this->createUser([], NULL, TRUE));
    // Ensure the title is correct.     $this->assertEquals('SITE_NAME_en', \Drupal::config('system.site')->get('name'));

    
ENDPO;
  }

  /** * {@inheritdoc} */
  protected function installParameters() {
    $params = parent::installParameters();
    $params['forms']['install_configure_form']['site_name'] = 'SITE_NAME_' . $this->langcode;
    return $params;
  }

  /** * Tests that translations ended up at the expected places. */
  public function testTranslationsLoaded() {
    // Ensure the title is correct.     $this->assertEquals('SITE_NAME_' . $this->langcode, \Drupal::config('system.site')->get('name'));

    

  protected function getVersionStringToTest() {
    include_once $this->root . '/core/includes/install.core.inc';
    $version = _install_get_version_info(\Drupal::VERSION);
    return $version['major'] . '.0.0';
  }

  /** * {@inheritdoc} */
  protected function installParameters() {
    $parameters = parent::installParameters();
    // Install Drupal in German.     $parameters['parameters']['langcode'] = 'de';
    // Create a po file so we don't attempt to download one from     // localize.drupal.org and to have a test translation that will not change.     \Drupal::service('file_system')->mkdir($this->publicFilesDirectory . '/translations', NULL, TRUE);
    $contents = <<<ENDPO msgid "" msgstr "" msgid "Enter the password that accompanies your username." msgstr "Geben sie das Passwort für ihren Benutzernamen ein."
/** * {@inheritdoc} */
  protected $defaultTheme = 'stark';

  /** * {@inheritdoc} */
  protected function installParameters() {
    $this->siteName = $this->randomMachineName();
    $parameters = parent::installParameters();
    $parameters['forms']['install_configure_form']['site_name'] = $this->siteName;
    return $parameters;
  }

  /** * Tests that the desired site name appears on the page after installation. */
  public function testSiteName() {
    $this->drupalGet('');
    $this->assertSession()->pageTextContains($this->siteName);
  }

}
return $request;
  }

  /** * Execute the non-interactive installer. * * @see install_drupal() */
  protected function doInstall() {
    require_once DRUPAL_ROOT . '/core/includes/install.core.inc';
    $parameters = $this->installParameters();
    // Simulate a real install which does not start with the any connections set     // in \Drupal\Core\Database\Database::$connections.     Database::removeConnection('default');
    install_drupal($this->classLoader, $parameters);
  }

  /** * Initialize settings created during install. */
  protected function initSettings() {
    Settings::initialize(DRUPAL_ROOT, $this->siteDirectory, $this->classLoader);

    

  abstract protected function getConfigTarball();

  /** * {@inheritdoc} */
  protected function installParameters() {
    $parameters = parent::installParameters();

    // The options that change configuration are disabled when installing from     // existing configuration.     unset($parameters['forms']['install_configure_form']['site_name']);
    unset($parameters['forms']['install_configure_form']['site_mail']);
    unset($parameters['forms']['install_configure_form']['enable_update_status_module']);
    unset($parameters['forms']['install_configure_form']['enable_update_status_emails']);

    return $parameters;
  }

  
/** * Whether the installer has completed. * * @var bool */
  protected $isInstalled = FALSE;

  /** * {@inheritdoc} */
  protected function installParameters() {
    $params = parent::installParameters();
    // Set the checkbox values to FALSE so that     // \Drupal\Tests\BrowserTestBase::translatePostValues() does not remove     // them.     $params['forms']['install_configure_form']['enable_update_status_module'] = FALSE;
    $params['forms']['install_configure_form']['enable_update_status_emails'] = FALSE;
    return $params;
  }

  /** * {@inheritdoc} */
  
/** * Ensure the Update module is installed. */
  public function testUpdateModuleInstall() {
    $this->assertTrue(\Drupal::moduleHandler()->moduleExists('update'));
  }

  /** * {@inheritdoc} */
  protected function installParameters() {
    $params = parent::installParameters();
    $params['forms']['install_configure_form']['enable_update_status_module'] = TRUE;
    return $params;
  }

}

class DemoUmamiProfileTest extends BrowserTestBase {
  use AssertConfigTrait;

  /** * {@inheritdoc} */
  protected function installParameters() {
    $parameters = parent::installParameters();
    $parameters['forms']['install_configure_form']['site_mail'] = 'admin@example.com';
    return $parameters;
  }

  /** * {@inheritdoc} */
  protected $profile = 'demo_umami';

  /** * Tests demo_umami profile warnings shown on Status Page. */
/** * The timezone we expect to be set from the install profile. * * @see testing_site_config_install() */
  const EXPECTED_TIMEZONE = 'America/Los_Angeles';

  /** * {@inheritdoc} */
  protected function installParameters() {
    $parameters = parent::installParameters();

    // Don't override the site email address, allowing it to default to the one     // from our install profile.     unset($parameters['forms']['install_configure_form']['site_mail']);

    return $parameters;
  }

  /** * {@inheritdoc} */
  
Home | Imprint | This part of the site doesn't use cookies.