protected function LinkFieldTest::getEntitiesDataArray in Entity Share 8.3
Same name and namespace in other branches
- 8.2 modules/entity_share_client/tests/src/Functional/LinkFieldTest.php \Drupal\Tests\entity_share_client\Functional\LinkFieldTest::getEntitiesDataArray()
Helper function to get a mapping of the entities data.
Used to create the entities for the test and to test that it has been recreated properly.
Overrides EntityShareClientFunctionalTestBase::getEntitiesDataArray
File
- modules/
entity_share_client/ tests/ src/ Functional/ LinkFieldTest.php, line 72
Class
- LinkFieldTest
- Functional test class for link field.
Namespace
Drupal\Tests\entity_share_client\FunctionalCode
protected function getEntitiesDataArray() {
return [
'node' => [
'en' => [
// Used for internal linked.
'es_test' => $this
->getCompleteNodeInfos([
'status' => [
'value' => NodeInterface::PUBLISHED,
'checker_callback' => 'getValue',
],
]),
// Link: external.
'es_test_link_external' => $this
->getCompleteNodeInfos([
'field_es_test_link' => [
'value' => [
[
'uri' => $this->faker->url,
'title' => $this->faker
->text(255),
],
],
'checker_callback' => 'getFilteredStructureValues',
],
]),
// Link: external without text.
'es_test_link_external_without_text' => $this
->getCompleteNodeInfos([
'field_es_test_link' => [
'value' => [
[
'uri' => $this->faker->url,
],
],
'checker_callback' => 'getFilteredStructureValues',
],
]),
// Link: external with options.
'es_test_link_external_with_options' => $this
->getCompleteNodeInfos([
'field_es_test_link' => [
'value' => [
[
'uri' => $this->faker->url,
'title' => $this->faker
->text(255),
'options' => [
'attributes' => [
'class' => [
$this->faker
->text(20),
$this->faker
->text(20),
$this->faker
->text(20),
],
],
],
],
],
'checker_callback' => 'getFilteredStructureValues',
],
]),
// Link: internal.
'es_test_link_internal' => $this
->getCompleteNodeInfos([
'field_es_test_link' => [
'value_callback' => function () {
return [
[
'uri' => 'entity:node/' . $this
->getEntityId('node', 'es_test'),
],
];
},
'checker_callback' => 'getExpectedInternalLinkValue',
],
]),
],
],
];
}