comparison core/modules/search/tests/src/Functional/SearchPageOverrideTest.php @ 0:c75dbcec494b

Initial commit from drush-created site
author Chris Cannam
date Thu, 05 Jul 2018 14:24:15 +0000
parents
children a9cd425dd02b
comparison
equal deleted inserted replaced
-1:000000000000 0:c75dbcec494b
1 <?php
2
3 namespace Drupal\Tests\search\Functional;
4
5 /**
6 * Tests if the result page can be overridden.
7 *
8 * Verifies that a plugin can override the buildResults() method to
9 * control what the search results page looks like.
10 *
11 * @group search
12 */
13 class SearchPageOverrideTest extends SearchTestBase {
14
15 /**
16 * Modules to enable.
17 *
18 * @var array
19 */
20 public static $modules = ['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 }