function JsonApiDocumentTopLevelNormalizerTest::denormalizeProvider

Same name in other branches
  1. 9 core/modules/jsonapi/tests/src/Unit/Normalizer/JsonApiDocumentTopLevelNormalizerTest.php \Drupal\Tests\jsonapi\Unit\Normalizer\JsonApiDocumentTopLevelNormalizerTest::denormalizeProvider()
  2. 8.9.x core/modules/jsonapi/tests/src/Unit/Normalizer/JsonApiDocumentTopLevelNormalizerTest.php \Drupal\Tests\jsonapi\Unit\Normalizer\JsonApiDocumentTopLevelNormalizerTest::denormalizeProvider()
  3. 10 core/modules/jsonapi/tests/src/Unit/Normalizer/JsonApiDocumentTopLevelNormalizerTest.php \Drupal\Tests\jsonapi\Unit\Normalizer\JsonApiDocumentTopLevelNormalizerTest::denormalizeProvider()

Data provider for the denormalize test.

Return value

array The data for the test method.

File

core/modules/jsonapi/tests/src/Unit/Normalizer/JsonApiDocumentTopLevelNormalizerTest.php, line 106

Class

JsonApiDocumentTopLevelNormalizerTest
@coversDefaultClass \Drupal\jsonapi\Normalizer\JsonApiDocumentTopLevelNormalizer @group jsonapi

Namespace

Drupal\Tests\jsonapi\Unit\Normalizer

Code

public static function denormalizeProvider() {
    return [
        [
            [
                'data' => [
                    'type' => 'lorem',
                    'id' => 'e1a613f6-f2b9-4e17-9d33-727eb6509d8b',
                    'attributes' => [
                        'title' => 'dummy_title',
                    ],
                ],
            ],
            [
                'title' => 'dummy_title',
                'uuid' => 'e1a613f6-f2b9-4e17-9d33-727eb6509d8b',
            ],
        ],
        [
            [
                'data' => [
                    'type' => 'lorem',
                    'id' => '0676d1bf-55b3-4bbc-9fbc-3df10f4599d5',
                    'relationships' => [
                        'field_dummy' => [
                            'data' => [
                                'type' => 'node',
                                'id' => '76dd5c18-ea1b-4150-9e75-b21958a2b836',
                            ],
                        ],
                    ],
                ],
            ],
            [
                'uuid' => '0676d1bf-55b3-4bbc-9fbc-3df10f4599d5',
                'field_dummy' => [
                    [
                        'target_id' => 1,
                    ],
                ],
            ],
        ],
        [
            [
                'data' => [
                    'type' => 'lorem',
                    'id' => '535ba297-8d79-4fc1-b0d6-dc2f047765a1',
                    'relationships' => [
                        'field_dummy' => [
                            'data' => [
                                [
                                    'type' => 'node',
                                    'id' => '76dd5c18-ea1b-4150-9e75-b21958a2b836',
                                ],
                                [
                                    'type' => 'node',
                                    'id' => 'fcce1b61-258e-4054-ae36-244d25a9e04c',
                                ],
                            ],
                        ],
                    ],
                ],
            ],
            [
                'uuid' => '535ba297-8d79-4fc1-b0d6-dc2f047765a1',
                'field_dummy' => [
                    [
                        'target_id' => 1,
                    ],
                    [
                        'target_id' => 2,
                    ],
                ],
            ],
        ],
        [
            [
                'data' => [
                    'type' => 'lorem',
                    'id' => '535ba297-8d79-4fc1-b0d6-dc2f047765a1',
                    'relationships' => [
                        'field_dummy' => [
                            'data' => [
                                [
                                    'type' => 'node',
                                    'id' => '76dd5c18-ea1b-4150-9e75-b21958a2b836',
                                    'meta' => [
                                        'foo' => 'bar',
                                    ],
                                ],
                                [
                                    'type' => 'node',
                                    'id' => 'fcce1b61-258e-4054-ae36-244d25a9e04c',
                                ],
                            ],
                        ],
                    ],
                ],
            ],
            [
                'uuid' => '535ba297-8d79-4fc1-b0d6-dc2f047765a1',
                'field_dummy' => [
                    [
                        'target_id' => 1,
                        'foo' => 'bar',
                    ],
                    [
                        'target_id' => 2,
                    ],
                ],
            ],
        ],
    ];
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.