You are here

public function DevelMenuLinksTest::testRedirectDestinationLinks in Devel 8

Same name and namespace in other branches
  1. 8.3 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 80

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
    ->assertLink(t('Reinstall Modules'));
  $this
    ->clickLink(t('Reinstall Modules'));
  $this
    ->assertUrl('devel/reinstall', [
    'query' => [
      'destination' => $destination
        ->toString(),
    ],
  ]);
  $this
    ->drupalGet($url);
  $this
    ->assertLink(t('Rebuild Menu'));
  $this
    ->clickLink(t('Rebuild Menu'));
  $this
    ->assertUrl('devel/menu/reset', [
    'query' => [
      'destination' => $destination
        ->toString(),
    ],
  ]);
  $this
    ->drupalGet($url);
  $this
    ->assertLink(t('Cache clear'));
  $this
    ->clickLink(t('Cache clear'));
  $this
    ->assertText('Cache cleared.');
  $this
    ->assertUrl($url);
  $this
    ->drupalGet($url);
  $this
    ->assertLink(t('Run cron'));
  $this
    ->clickLink(t('Run cron'));
  $this
    ->assertText(t('Cron ran successfully.'));
  $this
    ->assertUrl($url);
}