Mercurial > hg > isophonics-drupal-site
diff core/modules/search/tests/src/Functional/SearchPageOverrideTest.php @ 0:4c8ae668cc8c
Initial import (non-working)
author | Chris Cannam |
---|---|
date | Wed, 29 Nov 2017 16:09:58 +0000 |
parents | |
children | 129ea1e6d783 |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/core/modules/search/tests/src/Functional/SearchPageOverrideTest.php Wed Nov 29 16:09:58 2017 +0000 @@ -0,0 +1,44 @@ +<?php + +namespace Drupal\Tests\search\Functional; + +/** + * Tests if the result page can be overridden. + * + * Verifies that a plugin can override the buildResults() method to + * control what the search results page looks like. + * + * @group search + */ +class SearchPageOverrideTest extends SearchTestBase { + + /** + * Modules to enable. + * + * @var array + */ + public static $modules = ['search_extra_type']; + + /** + * A user with permission to administer search. + * + * @var \Drupal\user\UserInterface + */ + public $searchUser; + + protected function setUp() { + parent::setUp(); + + // Log in as a user that can create and search content. + $this->searchUser = $this->drupalCreateUser(['search content', 'administer search']); + $this->drupalLogin($this->searchUser); + } + + public function testSearchPageHook() { + $keys = 'bike shed ' . $this->randomMachineName(); + $this->drupalGet("search/dummy_path", ['query' => ['keys' => $keys]]); + $this->assertText('Dummy search snippet', 'Dummy search snippet is shown'); + $this->assertText('Test page text is here', 'Page override is working'); + } + +}