function DevelControllerTest::setUp
Same name in other branches
- 4.x tests/src/Functional/DevelControllerTest.php \Drupal\Tests\devel\Functional\DevelControllerTest::setUp()
- 5.x tests/src/Functional/DevelControllerTest.php \Drupal\Tests\devel\Functional\DevelControllerTest::setUp()
File
-
tests/
src/ Functional/ DevelControllerTest.php, line 24
Class
- DevelControllerTest
- Tests Devel controller.
Namespace
Drupal\Tests\devel\FunctionalCode
protected function setUp() {
parent::setUp();
// Create a test entity.
$random_label = $this->randomMachineName();
$data = [
'type' => 'entity_test',
'name' => $random_label,
];
$this->entity = entity_create('entity_test', $data);
$this->entity
->save();
// Create a test entity with only canonical route.
$random_label = $this->randomMachineName();
$data = [
'type' => 'devel_entity_test_canonical',
'name' => $random_label,
];
$this->entity_canonical = entity_create('devel_entity_test_canonical', $data);
$this->entity_canonical
->save();
// Create a test entity with only edit route.
$random_label = $this->randomMachineName();
$data = [
'type' => 'devel_entity_test_edit',
'name' => $random_label,
];
$this->entity_edit = entity_create('devel_entity_test_edit', $data);
$this->entity_edit
->save();
// Create a test entity with no routes.
$random_label = $this->randomMachineName();
$data = [
'type' => 'devel_entity_test_no_links',
'name' => $random_label,
];
$this->entity_no_links = entity_create('devel_entity_test_no_links', $data);
$this->entity_no_links
->save();
$this->drupalPlaceBlock('local_tasks_block');
$web_user = $this->drupalCreateUser([
'view test entity',
'administer entity_test content',
'access devel information',
]);
$this->drupalLogin($web_user);
}