You are here

public function JsonTest::jsonBaseDataProvider in Migrate Plus 8.5

Same name and namespace in other branches
  1. 8.4 tests/src/Kernel/Plugin/migrate_plus/data_parser/JsonTest.php \Drupal\Tests\migrate_plus\Kernel\Plugin\migrate_plus\data_parser\JsonTest::jsonBaseDataProvider()

Provides multiple test cases for the testMissingProperty method.

Return value

array The test cases.

File

tests/src/Kernel/Plugin/migrate_plus/data_parser/JsonTest.php, line 72

Class

JsonTest
Test of the data_parser Json migrate_plus plugin.

Namespace

Drupal\Tests\migrate_plus\Kernel\Plugin\migrate_plus\data_parser

Code

public function jsonBaseDataProvider() : array {
  return [
    'missing properties' => [
      'file' => 'missing_properties.json',
      'ids' => [
        'id' => [
          'type' => 'integer',
        ],
      ],
      'fields' => [
        [
          'name' => 'id',
          'label' => 'Id',
          'selector' => '/id',
        ],
        [
          'name' => 'title',
          'label' => 'Title',
          'selector' => '/title',
        ],
        [
          'name' => 'video_url',
          'label' => 'Video url',
          'selector' => '/video/url',
        ],
      ],
      'expected' => [
        [
          'id' => '1',
          'title' => 'Title',
          'video_url' => 'https://localhost/',
        ],
        [
          'id' => '2',
          'title' => '',
          'video_url' => 'https://localhost/',
        ],
        [
          'id' => '3',
          'title' => 'Title 3',
          'video_url' => '',
        ],
      ],
    ],
  ];
}