You are here

public function SearchPageRepositoryTest::testGetDefaultSearchPageWithInactiveDefault in Drupal 8

Same name and namespace in other branches
  1. 9 core/modules/search/tests/src/Unit/SearchPageRepositoryTest.php \Drupal\Tests\search\Unit\SearchPageRepositoryTest::testGetDefaultSearchPageWithInactiveDefault()

Tests the getDefaultSearchPage() method when the default is inactive.

File

core/modules/search/tests/src/Unit/SearchPageRepositoryTest.php, line 192
Contains \Drupal\Tests\search\Unit\SearchPageRepositoryTest.

Class

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

Namespace

Drupal\Tests\search\Unit

Code

public function testGetDefaultSearchPageWithInactiveDefault() {
  $this->query
    ->expects($this
    ->once())
    ->method('condition')
    ->with('status', TRUE)
    ->will($this
    ->returnValue($this->query));
  $this->query
    ->expects($this
    ->once())
    ->method('execute')
    ->will($this
    ->returnValue([
    'test' => 'test',
  ]));
  $config = $this
    ->getMockBuilder('Drupal\\Core\\Config\\Config')
    ->disableOriginalConstructor()
    ->getMock();
  $config
    ->expects($this
    ->once())
    ->method('get')
    ->with('default_page')
    ->will($this
    ->returnValue('other_test'));
  $this->configFactory
    ->expects($this
    ->once())
    ->method('get')
    ->with('search.settings')
    ->will($this
    ->returnValue($config));
  $this
    ->assertSame('test', $this->searchPageRepository
    ->getDefaultSearchPage());
}