abstract class RdfMappingResourceTestBase in Drupal 10
Same name and namespace in other branches
- 8 core/modules/rdf/tests/src/Functional/Rest/RdfMappingResourceTestBase.php \Drupal\Tests\rdf\Functional\Rest\RdfMappingResourceTestBase
- 9 core/modules/rdf/tests/src/Functional/Rest/RdfMappingResourceTestBase.php \Drupal\Tests\rdf\Functional\Rest\RdfMappingResourceTestBase
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\rest\Functional\ResourceTestBase
- class \Drupal\Tests\rest\Functional\EntityResource\EntityResourceTestBase
- class \Drupal\Tests\rest\Functional\EntityResource\ConfigEntityResourceTestBase
- class \Drupal\Tests\rdf\Functional\Rest\RdfMappingResourceTestBase
- class \Drupal\Tests\rest\Functional\EntityResource\ConfigEntityResourceTestBase
- class \Drupal\Tests\rest\Functional\EntityResource\EntityResourceTestBase
- class \Drupal\Tests\rest\Functional\ResourceTestBase
Expanded class hierarchy of RdfMappingResourceTestBase
File
- core/
modules/ rdf/ tests/ src/ Functional/ Rest/ RdfMappingResourceTestBase.php, line 9
Namespace
Drupal\Tests\rdf\Functional\RestView source
abstract class RdfMappingResourceTestBase extends ConfigEntityResourceTestBase {
/**
* {@inheritdoc}
*/
protected static $modules = [
'node',
'rdf',
];
/**
* {@inheritdoc}
*/
protected static $entityTypeId = 'rdf_mapping';
/**
* @var \Drupal\rdf\RdfMappingInterface
*/
protected $entity;
/**
* {@inheritdoc}
*/
protected function setUpAuthorization($method) {
$this
->grantPermissionsToTestedRole([
'administer site configuration',
]);
}
/**
* {@inheritdoc}
*/
protected function createEntity() {
// Create a "Camelids" node type.
$camelids = NodeType::create([
'name' => 'Camelids',
'type' => 'camelids',
]);
$camelids
->save();
// Create the RDF mapping.
$llama = RdfMapping::create([
'targetEntityType' => 'node',
'bundle' => 'camelids',
]);
$llama
->setBundleMapping([
'types' => [
'sioc:Item',
'foaf:Document',
],
])
->setFieldMapping('title', [
'properties' => [
'dc:title',
],
])
->setFieldMapping('created', [
'properties' => [
'dc:date',
'dc:created',
],
'datatype' => 'xsd:dateTime',
'datatype_callback' => [
'callable' => 'Drupal\\rdf\\CommonDataConverter::dateIso8601Value',
],
])
->save();
return $llama;
}
/**
* {@inheritdoc}
*/
protected function getExpectedNormalizedEntity() {
return [
'bundle' => 'camelids',
'dependencies' => [
'config' => [
'node.type.camelids',
],
'module' => [
'node',
],
],
'fieldMappings' => [
'title' => [
'properties' => [
'dc:title',
],
],
'created' => [
'properties' => [
'dc:date',
'dc:created',
],
'datatype' => 'xsd:dateTime',
'datatype_callback' => [
'callable' => 'Drupal\\rdf\\CommonDataConverter::dateIso8601Value',
],
],
],
'id' => 'node.camelids',
'langcode' => 'en',
'status' => TRUE,
'targetEntityType' => 'node',
'types' => [
'sioc:Item',
'foaf:Document',
],
'uuid' => $this->entity
->uuid(),
];
}
/**
* {@inheritdoc}
*/
protected function getNormalizedPostEntity() {
// @todo Update in https://www.drupal.org/node/2300677.
return [];
}
/**
* {@inheritdoc}
*/
protected function getExpectedCacheContexts() {
return [
'user.permissions',
];
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
RdfMappingResourceTestBase:: |
protected | property | ||
RdfMappingResourceTestBase:: |
protected static | property | ||
RdfMappingResourceTestBase:: |
protected static | property | 2 | |
RdfMappingResourceTestBase:: |
protected | function | ||
RdfMappingResourceTestBase:: |
protected | function | ||
RdfMappingResourceTestBase:: |
protected | function | ||
RdfMappingResourceTestBase:: |
protected | function | ||
RdfMappingResourceTestBase:: |
protected | function |