protected function ResourceTest::setUp in Drupal 9
Same name and namespace in other branches
- 8 core/modules/rest/tests/src/Functional/ResourceTest.php \Drupal\Tests\rest\Functional\ResourceTest::setUp()
Overrides BrowserTestBase::setUp
File
- core/
modules/ rest/ tests/ src/ Functional/ ResourceTest.php, line 43
Class
- ResourceTest
- Tests the structure of a REST resource.
Namespace
Drupal\Tests\rest\FunctionalCode
protected function setUp() : void {
parent::setUp();
// Create an entity programmatic.
$this->entity = EntityTest::create([
'name' => $this
->randomMachineName(),
'user_id' => 1,
'field_test_text' => [
0 => [
'value' => $this
->randomString(),
'format' => 'plain_text',
],
],
]);
$this->entity
->save();
Role::load(AccountInterface::ANONYMOUS_ROLE)
->grantPermission('view test entity')
->save();
}