5a614e30383b85449e08f0702b946bfcfc599e37
[yaffs-website] / web / core / modules / search / tests / src / Functional / SearchPageOverrideTest.php
1 <?php
2
3 namespace Drupal\Tests\search\Functional;
4
5 use Drupal\Tests\BrowserTestBase;
6
7 /**
8  * Tests if the result page can be overridden.
9  *
10  * Verifies that a plugin can override the buildResults() method to
11  * control what the search results page looks like.
12  *
13  * @group search
14  */
15 class SearchPageOverrideTest extends BrowserTestBase {
16
17   /**
18    * {@inheritdoc}
19    */
20   protected static $modules = ['search', 'search_extra_type'];
21
22   /**
23    * A user with permission to administer search.
24    *
25    * @var \Drupal\user\UserInterface
26    */
27   public $searchUser;
28
29   protected function setUp() {
30     parent::setUp();
31
32     // Log in as a user that can create and search content.
33     $this->searchUser = $this->drupalCreateUser(['search content', 'administer search']);
34     $this->drupalLogin($this->searchUser);
35   }
36
37   public function testSearchPageHook() {
38     $keys = 'bike shed ' . $this->randomMachineName();
39     $this->drupalGet("search/dummy_path", ['query' => ['keys' => $keys]]);
40     $this->assertText('Dummy search snippet', 'Dummy search snippet is shown');
41     $this->assertText('Test page text is here', 'Page override is working');
42   }
43
44 }