public function SearchApiBackendUnitTest::addIndexFieldDataProvider in Search API Solr 8.2
Same name and namespace in other branches
- 8.3 tests/src/Unit/SearchApiBackendUnitTest.php \Drupal\Tests\search_api_solr\Unit\SearchApiBackendUnitTest::addIndexFieldDataProvider()
- 8 tests/src/Unit/SearchApiBackendUnitTest.php \Drupal\Tests\search_api_solr\Unit\SearchApiBackendUnitTest::addIndexFieldDataProvider()
- 4.x tests/src/Unit/SearchApiBackendUnitTest.php \Drupal\Tests\search_api_solr\Unit\SearchApiBackendUnitTest::addIndexFieldDataProvider()
Data provider for testIndexField method. Set of values can be extended to check other field types and values.
Return value
array
File
- tests/
src/ Unit/ SearchApiBackendUnitTest.php, line 106
Class
- SearchApiBackendUnitTest
- Tests functionality of the backend.
Namespace
Drupal\Tests\search_api_solr\UnitCode
public function addIndexFieldDataProvider() {
return [
// addIndexField() should be called.
[
'0',
'boolean',
'false',
],
[
'1',
'boolean',
'true',
],
[
0,
'boolean',
'false',
],
[
1,
'boolean',
'true',
],
[
FALSE,
'boolean',
'false',
],
[
TRUE,
'boolean',
'true',
],
[
'2016-05-25T14:00:00+10',
'date',
'2016-05-25T04:00:00Z',
],
[
'1465819200',
'date',
'2016-06-13T12:00:00Z',
],
[
new DateRangeValue('2016-05-25T14:00:00+10', '2017-05-25T14:00:00+10'),
'solr_date_range',
'[2016-05-25T04:00:00Z TO 2017-05-25T04:00:00Z]',
],
[
-1,
'integer',
-1,
],
[
0,
'integer',
0,
],
[
1,
'integer',
1,
],
[
-1.0,
'decimal',
-1.0,
],
[
0.0,
'decimal',
0.0,
],
[
1.3,
'decimal',
1.3,
],
[
'foo',
'string',
'foo',
],
[
new TextValue('foo bar'),
'text',
'foo bar',
],
[
(new TextValue(''))
->setTokens([
new TextToken('bar'),
]),
'text',
[
'bar',
1,
],
],
// addIndexField() should not be called.
[
NULL,
'boolean',
NULL,
],
[
NULL,
'date',
NULL,
],
[
NULL,
'solr_date_range',
NULL,
],
[
NULL,
'integer',
NULL,
],
[
NULL,
'decimal',
NULL,
],
[
NULL,
'string',
NULL,
],
[
'',
'string',
NULL,
],
[
new TextValue(''),
'text',
NULL,
],
[
(new TextValue(''))
->setTokens([
new TextToken(''),
]),
'text',
NULL,
],
];
}