function DevelElementInfoTest::testElementDetail
Same name in other branches
- 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\FunctionalCode
public function testElementDetail() : void {
$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);
}