You are here

public function DevelMenuLinksTest::testRedirectDestinationLinks in Devel 8.3

Same name and namespace in other branches
  1. 8 tests/src/Functional/DevelMenuLinksTest.php \Drupal\Tests\devel\Functional\DevelMenuLinksTest::testRedirectDestinationLinks()
  2. 8.2 tests/src/Functional/DevelMenuLinksTest.php \Drupal\Tests\devel\Functional\DevelMenuLinksTest::testRedirectDestinationLinks()
  3. 4.x tests/src/Functional/DevelMenuLinksTest.php \Drupal\Tests\devel\Functional\DevelMenuLinksTest::testRedirectDestinationLinks()

Tests redirect destination links.

File

tests/src/Functional/DevelMenuLinksTest.php, line 63

Class

DevelMenuLinksTest
Tests devel menu links.

Namespace

Drupal\Tests\devel\Functional

Code

public function testRedirectDestinationLinks() {

  // By default, in the testing profile, front page is the user canonical URI.
  // For better testing do not use the default frontpage.
  $url = Url::fromRoute('devel.simple_page');
  $destination = Url::fromRoute('devel.simple_page', [], [
    'absolute' => FALSE,
  ]);
  $this
    ->drupalGet($url);
  $this
    ->assertSession()
    ->linkExists('Reinstall Modules');
  $this
    ->clickLink('Reinstall Modules');
  $this
    ->assertSession()
    ->addressEquals('devel/reinstall', [
    'query' => [
      'destination' => $destination
        ->toString(),
    ],
  ]);
  $this
    ->drupalGet($url);
  $this
    ->assertSession()
    ->linkExists('Rebuild Menu');
  $this
    ->clickLink('Rebuild Menu');
  $this
    ->assertSession()
    ->addressEquals('devel/menu/reset', [
    'query' => [
      'destination' => $destination
        ->toString(),
    ],
  ]);
  $this
    ->drupalGet($url);
  $this
    ->assertSession()
    ->linkExists('Cache clear');
  $this
    ->clickLink('Cache clear');
  $this
    ->assertSession()
    ->pageTextContains('Cache cleared.');
  $this
    ->assertSession()
    ->addressEquals($url);
  $this
    ->drupalGet($url);
  $this
    ->assertSession()
    ->linkExists('Run cron');
  $this
    ->clickLink('Run cron');
  $this
    ->assertSession()
    ->pageTextContains('Cron ran successfully.');
  $this
    ->assertSession()
    ->addressEquals($url);
}