You are here

public function SearchPageRepositoryTest::testIsSearchActive in Drupal 9

Same name and namespace in other branches
  1. 8 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
Contains \Drupal\Tests\search\Unit\SearchPageRepositoryTest.

Class

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

Namespace

Drupal\Tests\search\Unit

Code

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