function SearchPageRepositoryTest::testIsSearchActive

Same name in other branches
  1. 9 core/modules/search/tests/src/Unit/SearchPageRepositoryTest.php \Drupal\Tests\search\Unit\SearchPageRepositoryTest::testIsSearchActive()
  2. 8.9.x core/modules/search/tests/src/Unit/SearchPageRepositoryTest.php \Drupal\Tests\search\Unit\SearchPageRepositoryTest::testIsSearchActive()
  3. 11.x core/modules/search/tests/src/Unit/SearchPageRepositoryTest.php \Drupal\Tests\search\Unit\SearchPageRepositoryTest::testIsSearchActive()

Tests the isSearchActive() method.

File

core/modules/search/tests/src/Unit/SearchPageRepositoryTest.php, line 97

Class

SearchPageRepositoryTest
@coversDefaultClass \Drupal\search\SearchPageRepository @group search

Namespace

Drupal\Tests\search\Unit

Code

public function testIsSearchActive() : void {
    $this->query
        ->expects($this->once())
        ->method('condition')
        ->with('status', TRUE)
        ->willReturn($this->query);
    $this->query
        ->expects($this->once())
        ->method('range')
        ->with(0, 1)
        ->willReturn($this->query);
    $this->query
        ->expects($this->once())
        ->method('execute')
        ->willReturn([
        'test' => 'test',
    ]);
    $this->assertTrue($this->searchPageRepository
        ->isSearchActive());
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.