protected function RelationTestBase::createRelationTypes in Relation 8.2
Same name and namespace in other branches
- 8 src/Tests/RelationTestBase.php \Drupal\relation\Tests\RelationTestBase::createRelationTypes()
Creates a set of standard relation types.
1 call to RelationTestBase::createRelationTypes()
- RelationTestBase::setUp in src/
Tests/ RelationTestBase.php - Sets up a Drupal site for running functional and integration tests.
File
- src/
Tests/ RelationTestBase.php, line 127
Class
- RelationTestBase
- Provides common helper methods for Taxonomy module tests.
Namespace
Drupal\relation\TestsCode
protected function createRelationTypes() {
$this->relation_types['symmetric'] = [
'id' => 'symmetric',
'label' => 'symmetric',
'source_bundles' => [
'node:article',
'node:page',
'taxonomy_term:*',
'user:*',
],
];
$this->relation_types['directional'] = [
'id' => 'directional',
'label' => 'directional',
'reverse_label' => 'reverse_directional',
'directional' => TRUE,
'source_bundles' => [
'node:*',
],
'target_bundles' => [
'node:page',
],
];
$this->relation_types['directional_entitysame'] = [
'id' => 'directional_entitysame',
'label' => 'directional_entitysame',
'directional' => TRUE,
'source_bundles' => [
'node:page',
],
'target_bundles' => [
'node:page',
],
];
$this->relation_types['directional_entitydifferent'] = [
'id' => 'directional_entitydifferent',
'label' => 'directional_entitydifferent',
'directional' => TRUE,
'source_bundles' => [
'user:*',
],
'target_bundles' => [
'node:page',
],
];
$this->relation_types['octopus'] = [
'id' => 'octopus',
'label' => 'octopus',
'min_arity' => 3,
'max_arity' => 5,
'source_bundles' => [
'node:article',
'node:page',
],
];
$this->relation_types['unary'] = [
'id' => 'unary',
'label' => 'unary',
'min_arity' => 1,
'max_arity' => 1,
'source_bundles' => [
'node:page',
],
];
foreach ($this->relation_types as $values) {
$relation_type = RelationType::create($values);
$relation_type
->save();
}
}