You are here

public function DevelElementInfoTest::testElementDetail in Devel 8.3

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

Tests element detail page.

File

tests/src/Functional/DevelElementInfoTest.php, line 115

Class

DevelElementInfoTest
Tests element info pages and links.

Namespace

Drupal\Tests\devel\Functional

Code

public function testElementDetail() {
  $element_name = 'button';

  // Ensures that the page works as expected.
  $this
    ->drupalGet("/devel/elements/{$element_name}");
  $this
    ->assertSession()
    ->statusCodeEquals(200);
  $this
    ->assertSession()
    ->pageTextContains("Element {$element_name}");

  // Ensures that the page returns a 404 error if the requested element is
  // not defined.
  $this
    ->drupalGet('/devel/elements/not_exists');
  $this
    ->assertSession()
    ->statusCodeEquals(404);

  // Ensures that the page is accessible ony to users with the adequate
  // permissions.
  $this
    ->drupalLogout();
  $this
    ->drupalGet("/devel/elements/{$element_name}");
  $this
    ->assertSession()
    ->statusCodeEquals(403);
}