class BlockContentTypeTest in Drupal 10
Same name in this branch
- 10 core/modules/jsonapi/tests/src/Functional/BlockContentTypeTest.php \Drupal\Tests\jsonapi\Functional\BlockContentTypeTest
- 10 core/modules/block_content/tests/src/Functional/BlockContentTypeTest.php \Drupal\Tests\block_content\Functional\BlockContentTypeTest
Same name and namespace in other branches
- 8 core/modules/jsonapi/tests/src/Functional/BlockContentTypeTest.php \Drupal\Tests\jsonapi\Functional\BlockContentTypeTest
- 9 core/modules/jsonapi/tests/src/Functional/BlockContentTypeTest.php \Drupal\Tests\jsonapi\Functional\BlockContentTypeTest
JSON:API integration test for the "BlockContentType" config entity type.
@group jsonapi
Hierarchy
- class \Drupal\Tests\BrowserTestBase extends \PHPUnit\Framework\TestCase uses \Drupal\Tests\PhpUnitCompatibilityTrait, \Symfony\Bridge\PhpUnit\ExpectDeprecationTrait, FunctionalTestSetupTrait, TestSetupTrait, BlockCreationTrait, ConfigTestTrait, ExtensionListTestTrait, ContentTypeCreationTrait, NodeCreationTrait, RandomGeneratorTrait, TestRequirementsTrait, PhpUnitWarnings, UiHelperTrait, UserCreationTrait, XdebugRequestTrait
- class \Drupal\Tests\jsonapi\Functional\ResourceTestBase uses ContentModerationTestTrait, JsonApiRequestTestTrait, ResourceResponseTestTrait
- class \Drupal\Tests\jsonapi\Functional\ConfigEntityResourceTestBase
- class \Drupal\Tests\jsonapi\Functional\BlockContentTypeTest
- class \Drupal\Tests\jsonapi\Functional\ConfigEntityResourceTestBase
- class \Drupal\Tests\jsonapi\Functional\ResourceTestBase uses ContentModerationTestTrait, JsonApiRequestTestTrait, ResourceResponseTestTrait
Expanded class hierarchy of BlockContentTypeTest
File
- core/
modules/ jsonapi/ tests/ src/ Functional/ BlockContentTypeTest.php, line 13
Namespace
Drupal\Tests\jsonapi\FunctionalView source
class BlockContentTypeTest extends ConfigEntityResourceTestBase {
/**
* {@inheritdoc}
*/
protected static $modules = [
'block_content',
];
/**
* {@inheritdoc}
*/
protected static $entityTypeId = 'block_content_type';
/**
* {@inheritdoc}
*/
protected static $resourceTypeName = 'block_content_type--block_content_type';
/**
* {@inheritdoc}
*
* @var \Drupal\block_content\BlockContentTypeInterface
*/
protected $entity;
/**
* {@inheritdoc}
*/
protected $defaultTheme = 'stark';
/**
* {@inheritdoc}
*/
protected function setUpAuthorization($method) {
$this
->grantPermissionsToTestedRole([
'administer blocks',
]);
}
/**
* {@inheritdoc}
*/
protected function createEntity() {
$block_content_type = BlockContentType::create([
'id' => 'pascal',
'label' => 'Pascal',
'revision' => FALSE,
'description' => 'Provides a competitive alternative to the "basic" type',
]);
$block_content_type
->save();
return $block_content_type;
}
/**
* {@inheritdoc}
*/
protected function getExpectedDocument() {
$self_url = Url::fromUri('base:/jsonapi/block_content_type/block_content_type/' . $this->entity
->uuid())
->setAbsolute()
->toString(TRUE)
->getGeneratedUrl();
return [
'jsonapi' => [
'meta' => [
'links' => [
'self' => [
'href' => 'http://jsonapi.org/format/1.0/',
],
],
],
'version' => '1.0',
],
'links' => [
'self' => [
'href' => $self_url,
],
],
'data' => [
'id' => $this->entity
->uuid(),
'type' => 'block_content_type--block_content_type',
'links' => [
'self' => [
'href' => $self_url,
],
],
'attributes' => [
'dependencies' => [],
'description' => 'Provides a competitive alternative to the "basic" type',
'label' => 'Pascal',
'langcode' => 'en',
'revision' => 0,
'status' => TRUE,
'drupal_internal__id' => 'pascal',
],
],
];
}
/**
* {@inheritdoc}
*/
protected function getPostDocument() {
// @todo Update in https://www.drupal.org/node/2300677.
return [];
}
}