function SearchPageRepositoryTest::testSetDefaultSearchPage
Same name in other branches
- 9 core/modules/search/tests/src/Unit/SearchPageRepositoryTest.php \Drupal\Tests\search\Unit\SearchPageRepositoryTest::testSetDefaultSearchPage()
- 8.9.x core/modules/search/tests/src/Unit/SearchPageRepositoryTest.php \Drupal\Tests\search\Unit\SearchPageRepositoryTest::testSetDefaultSearchPage()
- 11.x core/modules/search/tests/src/Unit/SearchPageRepositoryTest.php \Drupal\Tests\search\Unit\SearchPageRepositoryTest::testSetDefaultSearchPage()
Tests the setDefaultSearchPage() method.
File
-
core/
modules/ search/ tests/ src/ Unit/ SearchPageRepositoryTest.php, line 219
Class
- SearchPageRepositoryTest
- @coversDefaultClass \Drupal\search\SearchPageRepository @group search
Namespace
Drupal\Tests\search\UnitCode
public function testSetDefaultSearchPage() : void {
$id = 'bananas';
$config = $this->getMockBuilder('Drupal\\Core\\Config\\Config')
->disableOriginalConstructor()
->getMock();
$config->expects($this->once())
->method('set')
->with('default_page', $id)
->willReturn($config);
$config->expects($this->once())
->method('save')
->willReturn($config);
$this->configFactory
->expects($this->once())
->method('getEditable')
->with('search.settings')
->willReturn($config);
$search_page = $this->createMock('Drupal\\search\\SearchPageInterface');
$search_page->expects($this->once())
->method('id')
->willReturn($id);
$search_page->expects($this->once())
->method('enable')
->willReturn($search_page);
$search_page->expects($this->once())
->method('save')
->willReturn($search_page);
$this->searchPageRepository
->setDefaultSearchPage($search_page);
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.