You are here

public function AssetRefreshManagerTest::providerTestNonInterruptedFetch in Media: Acquia DAM 8

Provides test data for not-interrupted fetches (normal) related tests.

Return value

array Test data (request query options, response, expected asset ids).

File

tests/src/Unit/AssetRefreshManagerTest.php, line 279

Class

AssetRefreshManagerTest
AssetRefreshManager Service test.

Namespace

Drupal\Tests\media_acquiadam\Unit

Code

public function providerTestNonInterruptedFetch() {
  return [
    [
      [
        'limit' => 3,
        'offset' => 0,
        'starttime' => self::LAST_READ_TIMESTAMP,
        'endtime' => self::REQUEST_TIME,
      ],
      [
        'total' => 3,
        'notifications' => [
          [
            'action' => 'asset_property',
            'source' => [
              'type' => 'asset',
              'id' => 10,
            ],
          ],
          [
            'action' => 'asset_version',
            'source' => [
              'type' => 'asset',
              'id' => 1000,
            ],
          ],
          [
            'action' => 'asset_delete',
            'source' => [
              'type' => 'folder',
              'id' => 100,
            ],
            'subitems' => [
              [
                'type' => 'asset',
                'id' => 1,
              ],
              [
                'type' => 'asset',
                'id' => 2,
              ],
              [
                'type' => 'asset',
                'id' => 3,
              ],
              [
                'type' => 'asset',
                'id' => 4,
              ],
            ],
          ],
        ],
      ],
      [
        10,
        1000,
        1,
        2,
        3,
        4,
      ],
      6,
    ],
    // Un-tracked action types.
    [
      [
        'limit' => 3,
        'offset' => 0,
        'starttime' => self::LAST_READ_TIMESTAMP,
        'endtime' => self::REQUEST_TIME,
      ],
      [
        'total' => 3,
        'notifications' => [
          [
            'action' => 'asset_property_foo',
            'source' => [
              'type' => 'asset',
              'id' => 10,
            ],
          ],
          [
            'action' => 'asset_version_bar',
            'source' => [
              'type' => 'asset',
              'id' => 1000,
            ],
          ],
          [
            'action' => 'asset_delete',
            'source' => [
              'type' => 'folder',
              'id' => 100,
            ],
            'subitems' => [
              [
                'type' => 'asset',
                'id' => 1,
              ],
              [
                'type' => 'asset',
                'id' => 2,
              ],
              [
                'type' => 'asset',
                'id' => 3,
              ],
              [
                'type' => 'asset',
                'id' => 4,
              ],
            ],
          ],
        ],
      ],
      [
        1,
        2,
        3,
        4,
      ],
      4,
    ],
    // Un-tracked item types.
    [
      [
        'limit' => 3,
        'offset' => 0,
        'starttime' => self::LAST_READ_TIMESTAMP,
        'endtime' => self::REQUEST_TIME,
      ],
      [
        'total' => 3,
        'notifications' => [
          [
            'action' => 'asset_property',
            'source' => [
              'type' => 'asset',
              'id' => 10,
            ],
          ],
          [
            'action' => 'asset_version',
            'source' => [
              'type' => 'asset_foo',
              'id' => 1000,
            ],
          ],
          [
            'action' => 'asset_delete',
            'source' => [
              'type' => 'folder',
              'id' => 100,
            ],
            'subitems' => [
              [
                'type' => 'image',
                'id' => 1,
              ],
              [
                'type' => 'asset_bar',
                'id' => 2,
              ],
              [
                'type_foo' => 'bar',
              ],
              [
                'type' => 'image',
                'id' => 1,
              ],
              [
                'type' => 'asset',
                'id' => 3,
              ],
              [
                'type' => 'asset',
                'id' => 4,
              ],
            ],
          ],
        ],
      ],
      [
        10,
        1,
        3,
        4,
      ],
      4,
    ],
    // No results.
    [
      [
        'limit' => 3,
        'offset' => 0,
        'starttime' => self::LAST_READ_TIMESTAMP,
        'endtime' => self::REQUEST_TIME,
      ],
      [
        'total' => 0,
        'notifications' => [],
      ],
      [],
      0,
    ],
  ];
}