function MigrateMessageControllerTest::testOverview

Same name in this branch
  1. 10 core/modules/migrate/tests/src/Functional/MigrateMessageControllerTest.php \Drupal\Tests\migrate\Functional\MigrateMessageControllerTest::testOverview()
Same name in other branches
  1. 11.x core/modules/migrate/tests/src/Functional/MigrateMessageControllerTest.php \Drupal\Tests\migrate\Functional\MigrateMessageControllerTest::testOverview()
  2. 11.x core/modules/migrate_drupal_ui/tests/src/Functional/MigrateMessageControllerTest.php \Drupal\Tests\migrate_drupal_ui\Functional\MigrateMessageControllerTest::testOverview()

Tests the overview page for migrate messages.

Tests the overview page with the following scenarios;

  • No source database connection or message tables.
  • No source database connection with message tables.
  • A source database connection with message tables.

File

core/modules/migrate_drupal_ui/tests/src/Functional/MigrateMessageControllerTest.php, line 78

Class

MigrateMessageControllerTest
Tests for the MigrateController class.

Namespace

Drupal\Tests\migrate_drupal_ui\Functional

Code

public function testOverview() : void {
    $session = $this->assertSession();
    // First, test with no source database or message tables.
    $this->drupalGet('/admin/reports/migration-messages');
    $session->titleEquals('Migration messages | Drupal');
    $session->pageTextContainsOnce('The upgrade process may log messages about steps that require user action or errors. This page allows you to view these messages');
    $session->pageTextContainsOnce('There are no migration message tables.');
    // Create map and message tables.
    $this->createMigrateTables($this->migrationIds);
    // Test overview with no source database connection and with message tables.
    $this->drupalGet('/admin/reports/migration-messages');
    $session->statusCodeEquals(200);
    $session->pageTextContains('Failed to connect to your database server');
    $session->pageTextContains('database connection configured for source plugin variable.');
    foreach ($this->migrationIds as $migration_id) {
        $session->pageTextContains($migration_id);
    }
    // Create a source database connection.
    $this->createMigrationConnection();
    $this->sourceDatabase = Database::getConnection('default', 'migrate_drupal_ui');
    $this->createSourceTables();
    // Now, test with a source database connection and with message tables.
    $this->drupalGet('/admin/reports/migration-messages');
    $session->statusCodeEquals(200);
    $session->pageTextNotContains('Failed to connect to your database server');
    foreach ($this->migrationIds as $migration_id) {
        $session->pageTextContains($migration_id);
    }
}

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