class InstallerBrokenDatabasePortSettingsTest

Same name and namespace in other branches
  1. 11.x core/tests/Drupal/FunctionalTests/Installer/InstallerBrokenDatabasePortSettingsTest.php \Drupal\FunctionalTests\Installer\InstallerBrokenDatabasePortSettingsTest

Tests the installer with incorrect connection info in settings.php.

@group Installer

Hierarchy

Expanded class hierarchy of InstallerBrokenDatabasePortSettingsTest

File

core/tests/Drupal/FunctionalTests/Installer/InstallerBrokenDatabasePortSettingsTest.php, line 14

Namespace

Drupal\FunctionalTests\Installer
View source
class InstallerBrokenDatabasePortSettingsTest extends InstallerTestBase {
  
  /**
   * {@inheritdoc}
   */
  protected $defaultTheme = 'stark';
  
  /**
   * {@inheritdoc}
   */
  protected function prepareEnvironment() {
    parent::prepareEnvironment();
    // Pre-configure database credentials in settings.php.
    $connection_info = Database::getConnectionInfo();
    if ($connection_info['default']['driver'] !== 'mysql') {
      $this->markTestSkipped('This test relies on overriding the mysql driver');
    }
    // Override the port number to random port.
    $connection_info['default']['port'] = 1234;
    $this->settings['databases']['default'] = (object) [
      'value' => $connection_info,
      'required' => TRUE,
    ];
  }
  
  /**
   * {@inheritdoc}
   */
  protected function setUpSettings() {
    // This form will never be reached.
  }
  
  /**
   * {@inheritdoc}
   */
  protected function setUpSite() {
    // This form will never be reached.
  }
  
  /**
   * Tests the expected requirements problem.
   */
  public function testRequirementsProblem() : void {
    $this->assertSession()
      ->titleEquals('Requirements problem | Drupal');
    $this->assertSession()
      ->pageTextContains('Database settings');
    $this->assertSession()
      ->pageTextContains('Resolve all issues below to continue the installation. For help configuring your database server,');
    $this->assertSession()
      ->pageTextContains("[Tip: This message normally means that there is no MySQL server running on the system or that you are using an incorrect host name or port number when trying to connect to the server. You should also check that the TCP/IP port you are using has not been blocked by a firewall or port blocking service.]");
  }

}

Members

Title Sort descending Modifiers Object type Summary
InstallerBrokenDatabasePortSettingsTest::$defaultTheme protected property The theme to install as the default for testing.
InstallerBrokenDatabasePortSettingsTest::prepareEnvironment protected function Prepares the current environment for running the test.
InstallerBrokenDatabasePortSettingsTest::setUpSettings protected function Installer step: Configure settings.
InstallerBrokenDatabasePortSettingsTest::setUpSite protected function Final installer step: Configure site.
InstallerBrokenDatabasePortSettingsTest::testRequirementsProblem public function Tests the expected requirements problem.

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.