protected function JsonApiDocumentTopLevelNormalizerTest::denormalizeUuidProviderBuilder in Drupal 8
We cannot use a PHPUnit data provider because our data depends on $this.
Parameters
array $options: Options for how to construct test data.
Return value
array The test data.
1 call to JsonApiDocumentTopLevelNormalizerTest::denormalizeUuidProviderBuilder()
- JsonApiDocumentTopLevelNormalizerTest::testDenormalizeUuid in core/
modules/ jsonapi/ tests/ src/ Kernel/ Normalizer/ JsonApiDocumentTopLevelNormalizerTest.php - Try to POST a node and check if it exists afterwards.
File
- core/
modules/ jsonapi/ tests/ src/ Kernel/ Normalizer/ JsonApiDocumentTopLevelNormalizerTest.php, line 630
Class
- JsonApiDocumentTopLevelNormalizerTest
- @coversDefaultClass \Drupal\jsonapi\Normalizer\JsonApiDocumentTopLevelNormalizer @group jsonapi
Namespace
Drupal\Tests\jsonapi\Kernel\NormalizerCode
protected function denormalizeUuidProviderBuilder(array $options) {
list($input, $expected) = $options;
list($input_tag_uuids, $input_user_uuid) = $input;
list($expected_tag_ids, $expected_user_id) = $expected;
$node = [
[
'data' => [
'type' => 'node--article',
'attributes' => [
'title' => 'Testing article',
],
'relationships' => [
'uid' => [
'data' => [
'type' => 'user--user',
'id' => $input_user_uuid,
],
],
'field_tags' => [
'data' => [],
],
],
],
],
[
'tag_ids' => $expected_tag_ids,
'user_id' => $expected_user_id,
],
];
if (isset($input_tag_uuids[0])) {
$node[0]['data']['relationships']['field_tags']['data'][0] = [
'type' => 'taxonomy_term--tags',
'id' => $input_tag_uuids[0],
];
}
if (isset($input_tag_uuids[1])) {
$node[0]['data']['relationships']['field_tags']['data'][1] = [
'type' => 'taxonomy_term--tags',
'id' => $input_tag_uuids[1],
];
}
return $node;
}