You are here

public function JsonApiDocumentTopLevelNormalizerTest::denormalizeProvider in JSON:API 8

Same name and namespace in other branches
  1. 8.2 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

tests/src/Unit/Normalizer/JsonApiDocumentTopLevelNormalizerTest.php, line 108

Class

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

Namespace

Drupal\Tests\jsonapi\Unit\Normalizer

Code

public 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,
          ],
        ],
      ],
    ],
  ];
}