You are here

protected function SearchApiSolrTest::regressionTest2888629 in Search API Solr 4.x

Same name and namespace in other branches
  1. 8.3 tests/src/Kernel/SearchApiSolrTest.php \Drupal\Tests\search_api_solr\Kernel\SearchApiSolrTest::regressionTest2888629()
  2. 8 tests/src/Kernel/SearchApiSolrTest.php \Drupal\Tests\search_api_solr\Kernel\SearchApiSolrTest::regressionTest2888629()
  3. 8.2 tests/src/Kernel/SearchApiSolrTest.php \Drupal\Tests\search_api_solr\Kernel\SearchApiSolrTest::regressionTest2888629()

Regression tests for #2888629.

1 call to SearchApiSolrTest::regressionTest2888629()
SearchApiSolrTest::backendSpecificRegressionTests in tests/src/Kernel/SearchApiSolrTest.php

File

tests/src/Kernel/SearchApiSolrTest.php, line 163

Class

SearchApiSolrTest
Tests index and search capabilities using the Solr search backend.

Namespace

Drupal\Tests\search_api_solr\Kernel

Code

protected function regressionTest2888629() {
  $query = $this
    ->buildSearch();
  $query
    ->addCondition('category', NULL);
  $results = $query
    ->execute();
  $this
    ->assertResults([
    3,
  ], $results, 'comparing against NULL');
  $query = $this
    ->buildSearch();
  $conditions = $query
    ->createConditionGroup('OR');
  $conditions
    ->addCondition('category', 'article_category', '<>');
  $conditions
    ->addCondition('category', NULL);
  $query
    ->addConditionGroup($conditions);
  $results = $query
    ->execute();
  $this
    ->assertResults([
    1,
    2,
    3,
  ], $results, 'group comparing against category NOT article_category OR category NULL');
  $query = $this
    ->buildSearch();
  $conditions = $query
    ->createConditionGroup('AND');
  $conditions
    ->addCondition('body', NULL, '<>');
  $conditions
    ->addCondition('category', 'article_category', '<>');
  $conditions
    ->addCondition('category', NULL, '<>');
  $query
    ->addConditionGroup($conditions);
  $results = $query
    ->execute();
  $this
    ->assertResults([
    1,
    2,
  ], $results, 'group comparing against body NOT NULL AND category NOT article_category AND category NOT NULL');
}