You are here

public function LoadTest::testLoad in External Link Pop-up 8

Test some pages.

File

tests/src/Functional/LoadTest.php, line 46

Class

LoadTest
Simple test to ensure that main page loads with module enabled.

Namespace

Drupal\Tests\external_link_popup\Functional

Code

public function testLoad() {

  // Test that the home page loads with a 200 response.
  $this
    ->drupalGet(Url::fromRoute('<front>'));
  $this
    ->assertSession()
    ->statusCodeEquals(200);

  // Visit the settings page.
  $url = Url::fromRoute('external_link_popup.settings');
  $this
    ->drupalGet($url);
  $this
    ->assertSession()
    ->statusCodeEquals(200);

  // Test that the page contains a known label.
  $this
    ->assertSession()
    ->pageTextContains('Trusted domains');

  // Visit the popup collection page.
  $url = Url::fromRoute('entity.external_link_popup.collection');
  $this
    ->drupalGet($url);
  $this
    ->assertSession()
    ->statusCodeEquals(200);

  // Test that the page contains the Default popup.
  $this
    ->assertSession()
    ->pageTextContains('Default');

  // Visit the popup add form page.
  $url = Url::fromRoute('entity.external_link_popup.add_form');
  $this
    ->drupalGet($url);
  $this
    ->assertSession()
    ->statusCodeEquals(200);

  // Test that the page contains a known label.
  $this
    ->assertSession()
    ->pageTextContains('Yes button');
}