setUpSettings example


  protected function setUpSettings() {
    // Assert that the expected title is present.     $this->assertEquals('Database configuration', $this->cssSelect('main h2')[0]->getText());

    // Assert that we use the by core supported database drivers by default and     // not the ones from the driver_test module.     $this->assertSession()->elementTextEquals('xpath', '//label[@for="edit-driver-mysql"]', 'MySQL, MariaDB, Percona Server, or equivalent');
    $this->assertSession()->elementTextEquals('xpath', '//label[@for="edit-driver-pgsql"]', 'PostgreSQL');

    parent::setUpSettings();
  }

  /** * {@inheritdoc} */
  protected function setUpSite() {
    // Assert that the expected title is present.     $this->assertEquals('Configure site', $this->cssSelect('main h2')[0]->getText());

    // Test that SiteConfigureForm::buildForm() has made the site directory and     // the settings file non-writable.
// Check the language direction.     $direction = $this->getSession()->getPage()->find('xpath', '/@dir')->getText();
    $this->assertEquals('ltr', $direction);

    // Verify that the distribution name appears.     $this->assertSession()->pageTextContains($this->info['distribution']['name']);
    // Verify that the requested theme is used.     $this->assertSession()->responseContains($this->info['distribution']['install']['theme']);
    // Verify that the "Choose profile" step does not appear.     $this->assertSession()->pageTextNotContains('profile');

    parent::setUpSettings();
  }

  /** * 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->getDisplayName());

    
public function testInstaller() {
    // Verify that Drupal can't be immediately reinstalled.     $this->visitInstaller();
    $this->assertSession()->pageTextContains('Drupal already installed');

    // Delete settings.php and attempt to reinstall again.     unlink($this->siteDirectory . '/settings.php');
    $this->visitInstaller();
    $this->setUpLanguage();
    $this->setUpProfile();
    $this->setUpRequirementsProblem();
    $this->setUpSettings();
    $this->assertSession()->pageTextContains('Drupal already installed');
  }

}
parent::setUpLanguage();
  }

  /** * {@inheritdoc} */
  public function setUpSettings() {
    // The configuration is from a site installed in French.     // So after selecting the profile the installer detects that the site must     // be installed in French, thus we change the button translation.     $this->translations['Save and continue'] = 'Enregistrer et continuer';
    parent::setUpSettings();
  }

  /** * {@inheritdoc} */
  protected function getConfigTarball() {
    return __DIR__ . '/../../../fixtures/config_install/testing_config_install.tar.gz';
  }

}
    $spec = [
      'fields' => [
        'id' => [
          'type' => 'int',
          'not null' => TRUE,
        ],
      ],
      'primary key' => ['id'],
    ];

    Database::getConnection('default')->schema()->createTable('drupal_install_test', $spec);
    parent::setUpSettings();

    // Ensure that the error message translation is working.     // cSpell:disable     $this->assertSession()->responseContains('Beheben Sie alle Probleme unten, um die Installation fortzusetzen. Informationen zur Konfiguration der Datenbankserver finden Sie in der <a href="https://www.drupal.org/docs/installing-drupal">Installationshandbuch</a>, oder kontaktieren Sie Ihren Hosting-Anbieter.');
    $this->assertSession()->responseContains('<strong>CREATE</strong> ein Test-Tabelle auf Ihrem Datenbankserver mit dem Befehl <em class="placeholder">CREATE TABLE {drupal_install_test} (id int NOT NULL PRIMARY KEY)</em> fehlgeschlagen.');
    // cSpell:enable
    // Now do it successfully.     Database::getConnection('default')->schema()->dropTable('drupal_install_test');
    parent::setUpSettings();
  }

  
// Select language.     $this->setUpLanguage();

    // Select profile.     $this->setUpProfile();

    // Address the requirements problem screen, if any.     $this->setUpRequirementsProblem();

    // Configure settings.     $this->setUpSettings();

    // @todo Allow test classes based on this class to act on further installer     // screens.
    // Configure site.     $this->setUpSite();

    if ($this->isInstalled) {
      // Import new settings.php written by the installer.       $request = Request::createFromGlobals();
      $class_loader = require $this->container->getParameter('app.root') . '/autoload.php';
      
    $spec = [
      'fields' => [
        'id' => [
          'type' => 'int',
          'not null' => TRUE,
        ],
      ],
      'primary key' => ['id'],
    ];

    Database::getConnection('default')->schema()->createTable('drupal_install_test', $spec);
    parent::setUpSettings();
  }

  /** * {@inheritdoc} */
  protected function setUpSite() {
    // This step should not appear as we had a failure on the settings screen.   }

  /** * Verifies that the error message in the settings step is correct. */

  protected function getConfigTarball() {
    return __DIR__ . '/../../../fixtures/config_install/multilingual.tar.gz';
  }

  /** * Installer step: Configure settings. */
  protected function setUpSettings() {
    // Cause a profile mismatch by hacking the URL.     $this->drupalGet(str_replace($this->profile, 'minimal', $this->getUrl()));
    parent::setUpSettings();
  }

  protected function setUpSite() {
    // This step will not occur because there is an error.   }

  /** * Tests that profile mismatch fails to install. */
  public function testConfigSync() {
    $this->htmlOutput(NULL);
    
// Check the language direction.     $this->assertSession()->elementTextEquals('xpath', '/@dir', 'ltr');

    // Verify that the distribution name appears.     $this->assertSession()->pageTextContains($this->info['distribution']['name']);
    // Verify that the requested theme is used.     $this->assertSession()->responseContains($this->info['distribution']['install']['theme']);
    // Verify that the "Choose profile" step does not appear.     $this->assertSession()->pageTextNotContains('profile');

    parent::setUpSettings();
  }

  /** * 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->getDisplayName());

    
Home | Imprint | This part of the site doesn't use cookies.