You are here

public function AggregatedFieldsTest::aggregationTestsDataProvider in Search API 8

Provides test data for aggregation tests.

Return value

array An array containing test data sets, with each being an array of arguments to pass to the test method.

See also

static::testAggregation()

File

tests/src/Unit/Processor/AggregatedFieldsTest.php, line 213

Class

AggregatedFieldsTest
Tests the "Aggregated fields" processor.

Namespace

Drupal\Tests\search_api\Unit\Processor

Code

public function aggregationTestsDataProvider() {
  return [
    '"Union" aggregation' => [
      'union',
      [
        [
          'foo',
          'bar',
          'baz',
        ],
        [
          'foobar',
        ],
        [],
      ],
    ],
    '"Concatenation" aggregation' => [
      'concat',
      [
        [
          "foo\n\nbar\n\nbaz",
        ],
        [
          'foobar',
        ],
        [
          '',
        ],
      ],
    ],
    '"Sum" aggregation' => [
      'sum',
      [
        [
          22,
        ],
        [
          7,
        ],
        [
          0,
        ],
      ],
      TRUE,
    ],
    '"Count" aggregation' => [
      'count',
      [
        [
          3,
        ],
        [
          1,
        ],
        [
          0,
        ],
      ],
    ],
    '"Maximum" aggregation' => [
      'max',
      [
        [
          16,
        ],
        [
          7,
        ],
        [],
      ],
      TRUE,
    ],
    '"Minimum" aggregation' => [
      'min',
      [
        [
          2,
        ],
        [
          7,
        ],
        [],
      ],
      TRUE,
    ],
    '"First" aggregation' => [
      'first',
      [
        [
          'foo',
        ],
        [
          'foobar',
        ],
        [],
      ],
    ],
    '"Last" aggregation' => [
      'last',
      [
        [
          'baz',
        ],
        [
          'foobar',
        ],
        [],
      ],
    ],
    '"First letter" aggregation' => [
      'first_char',
      [
        [
          'F',
        ],
        [
          'F',
        ],
        [],
      ],
    ],
  ];
}