function DevelMenuLinksTest::testRedirectDestinationLinks

Same name in other branches
  1. 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() : void {
    // 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');
    $this->drupalGet($url);
    $this->assertSession()
        ->linkExists('Reinstall Modules');
    $this->clickLink('Reinstall Modules');
    $this->assertSession()
        ->addressEquals('devel/reinstall');
    $this->drupalGet($url);
    $this->assertSession()
        ->linkExists('Rebuild Menu');
    $this->clickLink('Rebuild Menu');
    $this->assertSession()
        ->addressEquals('devel/menu/reset');
    $this->drupalGet($url);
    $this->assertSession()
        ->linkExists('Cache clear');
    $this->clickLink('Cache clear');
    $this->assertSession()
        ->pageTextContains('Cache cleared.');
    $this->assertSession()
        ->addressEquals($url->toString());
    $this->drupalGet($url);
    $this->assertSession()
        ->linkExists('Run cron');
    $this->clickLink('Run cron');
    $this->assertSession()
        ->pageTextContains('Cron ran successfully.');
    $this->assertSession()
        ->addressEquals($url->toString());
}