You are here

public function DevelEntityTypeInfoTest::testEntityTypeDetail in Devel 8

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

Tests entity type detail page.

File

tests/src/Functional/DevelEntityTypeInfoTest.php, line 138

Class

DevelEntityTypeInfoTest
Tests entity type info pages and links.

Namespace

Drupal\Tests\devel\Functional

Code

public function testEntityTypeDetail() {
  $entity_type_id = 'date_format';

  // Ensures that the page works as expected.
  $this
    ->drupalGet("/devel/entity/info/{$entity_type_id}");
  $this
    ->assertSession()
    ->statusCodeEquals(200);
  $this
    ->assertSession()
    ->pageTextContains("Entity type {$entity_type_id}");

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

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