diff -u b/core/modules/migrate_drupal_ui/tests/src/Functional/MigrateControllerTest.php b/core/modules/migrate_drupal_ui/tests/src/Functional/MigrateControllerTest.php --- b/core/modules/migrate_drupal_ui/tests/src/Functional/MigrateControllerTest.php +++ b/core/modules/migrate_drupal_ui/tests/src/Functional/MigrateControllerTest.php @@ -6,7 +6,7 @@ use Drupal\Tests\BrowserTestBase; /** - * Provides a base class for testing the Migrate Controller. + * Tests for the MigrateController class. * * @group migrate_drupal_ui */ @@ -45,16 +45,25 @@ * Disable the Watchdog view and then tests whether or not the user is * redirected when navigating to admin/reports/upgrades. */ - public function testRedirectDestinationWithDisableView() { + public function testRedirectDestination() { // Disable the watchdog view. $this->drupalGet('admin/structure/views'); - $this->clickViewsDisableLink($this->t('Disable'), '/watchdog/'); - $this->assertResponse(200); + $this->clickViewsOperationsLink($this->t('Disable'), '/watchdog/'); + $this->assertSession()->statusCodeEquals(200); - // Tests whether or not the user is redirected when. + // Tests whether or not the user is redirected with the disable view when. + // Navigating to admin/reports/upgrades. + $this->drupalGet('admin/reports/upgrade'); + $this->assertSession()->addressEquals('admin/reports/dblog?type%5B%5D=migrate_drupal_ui'); + + // Enable the watchdog view. + $this->clickViewsOperationsLink($this->t('Enable'), '/watchdog/'); + $this->assertSession()->statusCodeEquals(200); + + // Tests whether or not the user is redirected with the enable view when. // Navigating to admin/reports/upgrades. $this->drupalGet('admin/reports/upgrade'); - $this->assertUrl('admin/reports/dblog?type%5B%5D=migrate_drupal_ui'); + $this->assertSession()->addressEquals('admin/reports/dblog?type%5B%5D=migrate_drupal_ui'); } /** @@ -66,19 +75,19 @@ public function testRedirectDestinationWithoutView() { // Delete the watchdog view. $this->drupalGet('admin/structure/views/view/watchdog/delete'); - $this->assertResponse(200); + $this->assertSession()->statusCodeEquals(200); $this->submitForm([], 'Delete'); - $this->assertResponse(200); + $this->assertSession()->statusCodeEquals(200); // Tests whether or not the user is redirected when. // Navigating to admin/reports/upgrades. $this->drupalGet('admin/reports/upgrade'); - $this->assertUrl('admin/reports/dblog?type%5B%5D=migrate_drupal_ui'); + $this->assertSession()->addressEquals('admin/reports/dblog?type%5B%5D=migrate_drupal_ui'); } /** - * Clicks a disable link to perform a disable operation on a view. + * Click a view link to perform an operation. * * @param string $label * Text between the anchor tags of the disable link. @@ -86,11 +95,11 @@ * A unique string that is expected to occur within the href of the disable * link. * - * @return bool - * 'TRUE' if the views page content that results from clicking on the - * disable link, or FALSE onfailure. + * @return + * The views page content that results from clicking on the link or, + * FALSE onfailure. */ - public function clickViewsDisableLink($label, $href_part) { + public function clickViewsOperationsLink($label, $href_part) { $links = $this->xpath('//a[normalize-space(text())=:label]', [':label' => (string) $label]); foreach ($links as $link_index => $link) { $position = strpos($link->getAttribute('href'), $href_part); @@ -101,7 +110,6 @@ } if (isset($index)) { $this->clickLink((string) $label, $index); - return TRUE; } else { return FALSE;