searchingUser = $this->drupalCreateUser(['search content', 'access content', 'access comments', 'skip comment approval']); // Log in with sufficient privileges. $this->drupalLogin($this->searchingUser); } /** * Verify the keywords are captured and conditions respected. */ public function testSearchKeywordsConditions() { // No keys, not conditions - no results. $this->drupalGet('search/dummy_path'); $this->assertNoText('Dummy search snippet to display'); // With keys - get results. $keys = 'bike shed ' . $this->randomMachineName(); $this->drupalGet("search/dummy_path", ['query' => ['keys' => $keys]]); $this->assertText("Dummy search snippet to display. Keywords: {$keys}"); $keys = 'blue drop ' . $this->randomMachineName(); $this->drupalGet("search/dummy_path", ['query' => ['keys' => $keys]]); $this->assertText("Dummy search snippet to display. Keywords: {$keys}"); // Add some conditions and keys. $keys = 'moving drop ' . $this->randomMachineName(); $this->drupalGet("search/dummy_path", ['query' => ['keys' => 'bike', 'search_conditions' => $keys]]); $this->assertText("Dummy search snippet to display."); $this->assertRaw(Html::escape(print_r(['keys' => 'bike', 'search_conditions' => $keys], TRUE))); } }