function EntityViewControllerTest::testEntityViewController in Zircon Profile 8
Same name and namespace in other branches
- 8.0 core/modules/system/src/Tests/Entity/EntityViewControllerTest.php \Drupal\system\Tests\Entity\EntityViewControllerTest::testEntityViewController()
Tests EntityViewController.
File
- core/
modules/ system/ src/ Tests/ Entity/ EntityViewControllerTest.php, line 48 - Contains \Drupal\system\Tests\Entity\EntityViewControllerTest.
Class
- EntityViewControllerTest
- Tests EntityViewController functionality.
Namespace
Drupal\system\Tests\EntityCode
function testEntityViewController() {
$get_label_markup = function ($label) {
return '<h1 class="page-title">
<div class="field field--name-name field--type-string field--label-hidden field__item">' . $label . '</div>
</h1>';
};
foreach ($this->entities as $entity) {
$this
->drupalGet('entity_test/' . $entity
->id());
$this
->assertRaw($entity
->label());
$this
->assertRaw($get_label_markup($entity
->label()));
$this
->assertRaw('full');
$this
->drupalGet('entity_test_converter/' . $entity
->id());
$this
->assertRaw($entity
->label());
$this
->assertRaw('full');
$this
->drupalGet('entity_test_no_view_mode/' . $entity
->id());
$this
->assertRaw($entity
->label());
$this
->assertRaw('full');
}
// As entity_test IDs must be integers, make sure requests for non-integer
// IDs return a page not found error.
$this
->drupalGet('entity_test/invalid');
$this
->assertResponse(404);
}