function ResourceTestBase::setUp
Same name in this branch
- 10 core/modules/rest/tests/src/Functional/ResourceTestBase.php \Drupal\Tests\rest\Functional\ResourceTestBase::setUp()
Same name in other branches
- 9 core/modules/jsonapi/tests/src/Functional/ResourceTestBase.php \Drupal\Tests\jsonapi\Functional\ResourceTestBase::setUp()
- 9 core/modules/rest/tests/src/Functional/ResourceTestBase.php \Drupal\Tests\rest\Functional\ResourceTestBase::setUp()
- 8.9.x core/modules/jsonapi/tests/src/Functional/ResourceTestBase.php \Drupal\Tests\jsonapi\Functional\ResourceTestBase::setUp()
- 8.9.x core/modules/rest/tests/src/Functional/ResourceTestBase.php \Drupal\Tests\rest\Functional\ResourceTestBase::setUp()
- 11.x core/modules/jsonapi/tests/src/Functional/ResourceTestBase.php \Drupal\Tests\jsonapi\Functional\ResourceTestBase::setUp()
- 11.x core/modules/rest/tests/src/Functional/ResourceTestBase.php \Drupal\Tests\rest\Functional\ResourceTestBase::setUp()
Overrides BrowserTestBase::setUp
3 calls to ResourceTestBase::setUp()
- CommentExtrasTest::setUp in core/
modules/ jsonapi/ tests/ src/ Functional/ CommentExtrasTest.php - ConfigEntityResourceTestBase::setUp in core/
modules/ jsonapi/ tests/ src/ Functional/ ConfigEntityResourceTestBase.php - FileUploadTest::setUp in core/
modules/ jsonapi/ tests/ src/ Functional/ FileUploadTest.php
3 methods override ResourceTestBase::setUp()
- CommentExtrasTest::setUp in core/
modules/ jsonapi/ tests/ src/ Functional/ CommentExtrasTest.php - ConfigEntityResourceTestBase::setUp in core/
modules/ jsonapi/ tests/ src/ Functional/ ConfigEntityResourceTestBase.php - FileUploadTest::setUp in core/
modules/ jsonapi/ tests/ src/ Functional/ FileUploadTest.php
File
-
core/
modules/ jsonapi/ tests/ src/ Functional/ ResourceTestBase.php, line 225
Class
- ResourceTestBase
- Subclass this for every JSON:API resource type.
Namespace
Drupal\Tests\jsonapi\FunctionalCode
protected function setUp() : void {
parent::setUp();
$this->serializer = $this->container
->get('jsonapi.serializer');
$this->config('system.logging')
->set('error_level', ERROR_REPORTING_HIDE)
->save();
$this->revokePermissions();
// Create an account, which tests will use. Also ensure the @current_user
// service this account, to ensure certain access check logic in tests works
// as expected.
$this->account = $this->createUser();
$this->container
->get('current_user')
->setAccount($this->account);
// Create an entity.
$entity_type_manager = $this->container
->get('entity_type.manager');
$this->entityStorage = $entity_type_manager->getStorage(static::$entityTypeId);
$this->uuidKey = $entity_type_manager->getDefinition(static::$entityTypeId)
->getKey('uuid');
$this->entity = $this->setUpFields($this->createEntity(), $this->account);
$this->resourceType = $this->container
->get('jsonapi.resource_type.repository')
->getByTypeName(static::$resourceTypeName);
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.