You are here

public function MigrateControllerTest::testUpgradeReport in Drupal 9

Same name and namespace in other branches
  1. 8 core/modules/migrate_drupal_ui/tests/src/Functional/MigrateControllerTest.php \Drupal\Tests\migrate_drupal_ui\Functional\MigrateControllerTest::testUpgradeReport()

Tests the upgrade report with the view enabled, disabled and uninstalled.

File

core/modules/migrate_drupal_ui/tests/src/Functional/MigrateControllerTest.php, line 46

Class

MigrateControllerTest
Tests for the MigrateController class.

Namespace

Drupal\Tests\migrate_drupal_ui\Functional

Code

public function testUpgradeReport() {
  $session = $this
    ->assertSession();
  $this
    ->assertTrue(View::load('watchdog')
    ->status(), 'Watchdog view is enabled');

  // Tests redirection to report page when the watchdog view is enabled.
  $this
    ->drupalGet('admin/reports/upgrade');
  $session
    ->optionExists('type[]', 'migrate_drupal_ui')
    ->isSelected();
  $session
    ->pageTextContainsOnce('A test message');

  // Disable the watchdog view.
  $this
    ->drupalGet('admin/structure/views');
  $this
    ->assertTrue($this
    ->clickViewsOperationsLink('Disable', '/watchdog/'));
  $session
    ->statusCodeEquals(200);

  // Tests redirection to report page when the watchdog view is disabled.
  $this
    ->drupalGet('admin/reports/upgrade');
  $session
    ->optionExists('type[]', 'migrate_drupal_ui')
    ->isSelected();
  $session
    ->pageTextContainsOnce('A test message');
  \Drupal::service('module_installer')
    ->uninstall([
    'views_ui',
    'views',
  ]);

  // Tests redirection to report page when views is uninstalled.
  $this
    ->drupalGet('admin/reports/upgrade');
  $session
    ->optionExists('type[]', 'migrate_drupal_ui')
    ->isSelected();
  $session
    ->pageTextContainsOnce('A test message');
}