You are here

protected function ImportFromFiltersTest::responsesStackById in Acquia Content Hub 8.2

Contains responses map.

Parameters

string $id: Responses stack ID.

Return value

mixed Responses.

1 call to ImportFromFiltersTest::responsesStackById()
ImportFromFiltersTest::alterContentHubMockPostCallback in tests/src/Kernel/ImportFromFiltersTest.php
Alters ContentHub client mock.

File

tests/src/Kernel/ImportFromFiltersTest.php, line 205

Class

ImportFromFiltersTest
Tests that imports from filters work properly.

Namespace

Drupal\Tests\acquia_contenthub\Kernel

Code

protected function responsesStackById(string $id) {
  $responses = [
    'one_filter' => [
      // Start scrolling.
      $this
        ->buildSearchResultResponse(3),
      // Continue scrolling.
      $this
        ->buildSearchResultResponse(3),
      // Final page.
      $this
        ->buildSearchResultResponse(0),
      $this
        ->returnEmptyResponse(),
    ],
    'multiple_filters' => [
      // 1 filter. Start scrolling.
      $this
        ->buildSearchResultResponse(3),
      // 1 filter. Continue scroll.
      $this
        ->buildSearchResultResponse(3),
      // 1 filter. Final page.
      $this
        ->buildSearchResultResponse(0),
      // 2 filter. Start scrolling.
      $this
        ->buildSearchResultResponse(3),
      $this
        ->buildSearchResultResponse(3),
      $this
        ->buildSearchResultResponse(0),
      $this
        ->returnEmptyResponse(),
    ],
    'empty_filter' => [
      $this
        ->buildSearchResultResponse(0),
      $this
        ->returnEmptyResponse(),
    ],
    'filters_chunk_1' => [
      $this
        ->buildSearchResultResponse(49),
      $this
        ->buildSearchResultResponse(0),
      $this
        ->returnEmptyResponse(),
    ],
    'filters_chunk_2' => [
      $this
        ->buildSearchResultResponse(50),
      $this
        ->buildSearchResultResponse(0),
      $this
        ->returnEmptyResponse(),
    ],
    'filters_chunk_3' => [
      $this
        ->buildSearchResultResponse(10),
      $this
        ->buildSearchResultResponse(10),
      $this
        ->buildSearchResultResponse(10),
      $this
        ->buildSearchResultResponse(10),
      $this
        ->buildSearchResultResponse(10),
      $this
        ->buildSearchResultResponse(1),
      $this
        ->buildSearchResultResponse(0),
      $this
        ->returnEmptyResponse(),
    ],
  ];
  return $responses[$id];
}