protected function BackendTestBase::regressionTest2767609 in Search API 8
Regression test for conditions with empty strings as values.
See also
https://www.drupal.org/node/2767609
1 call to BackendTestBase::regressionTest2767609()
- BackendTestBase::regressionTests in tests/
src/ Kernel/ BackendTestBase.php - Executes regression tests for issues that were already fixed.
File
- tests/
src/ Kernel/ BackendTestBase.php, line 828
Class
- BackendTestBase
- Provides a base class for backend tests.
Namespace
Drupal\Tests\search_api\KernelCode
protected function regressionTest2767609() {
$results = $this
->buildSearch(NULL, [
'type,',
])
->execute();
$this
->assertResults([], $results, 'Search for empty-string type');
$results = $this
->buildSearch(NULL, [
'category,',
])
->execute();
$this
->assertResults([], $results, 'Search for empty-string category');
$results = $this
->buildSearch()
->addCondition('category', '', '<>')
->execute();
$this
->assertResults([
1,
2,
3,
4,
5,
], $results, 'Search for items with category not an empty string');
// It's not clear what the results for "category < ''" should be, but in
// combination with the BETWEEN this should never return results.
$results = $this
->buildSearch()
->addCondition('category', '', '<')
->addCondition('category', [
'',
'foo',
], 'BETWEEN')
->addCondition('category', [
'',
'a',
'b',
], 'NOT IN')
->execute();
$this
->assertResults([], $results, 'Search with various empty-string filters');
}