public function SearchPageRepositoryTest::testGetDefaultSearchPageWithActiveDefault in Drupal 9
Same name and namespace in other branches
- 8 core/modules/search/tests/src/Unit/SearchPageRepositoryTest.php \Drupal\Tests\search\Unit\SearchPageRepositoryTest::testGetDefaultSearchPageWithActiveDefault()
Tests the getDefaultSearchPage() method when the default is active.
File
- core/
modules/ search/ tests/ src/ Unit/ SearchPageRepositoryTest.php, line 165 - Contains \Drupal\Tests\search\Unit\SearchPageRepositoryTest.
Class
- SearchPageRepositoryTest
- @coversDefaultClass \Drupal\search\SearchPageRepository @group search
Namespace
Drupal\Tests\search\UnitCode
public function testGetDefaultSearchPageWithActiveDefault() {
$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',
'other_test' => 'other_test',
]));
$config = $this
->getMockBuilder('Drupal\\Core\\Config\\Config')
->disableOriginalConstructor()
->getMock();
$config
->expects($this
->once())
->method('get')
->with('default_page')
->will($this
->returnValue('test'));
$this->configFactory
->expects($this
->once())
->method('get')
->with('search.settings')
->will($this
->returnValue($config));
$this
->assertSame('test', $this->searchPageRepository
->getDefaultSearchPage());
}