SearchKeywordsConditionsTest.php in Zircon Profile 8
File
core/modules/search/src/Tests/SearchKeywordsConditionsTest.php
View source
<?php
namespace Drupal\search\Tests;
use Drupal\Component\Utility\Html;
class SearchKeywordsConditionsTest extends SearchTestBase {
public static $modules = array(
'comment',
'search_extra_type',
'test_page_test',
);
protected $searchingUser;
protected function setUp() {
parent::setUp();
$this->searchingUser = $this
->drupalCreateUser(array(
'search content',
'access content',
'access comments',
'skip comment approval',
));
$this
->drupalLogin($this->searchingUser);
}
function testSearchKeywordsConditions() {
$this
->drupalGet('search/dummy_path');
$this
->assertNoText('Dummy search snippet to display');
$keys = 'bike shed ' . $this
->randomMachineName();
$this
->drupalGet("search/dummy_path", array(
'query' => array(
'keys' => $keys,
),
));
$this
->assertText("Dummy search snippet to display. Keywords: {$keys}");
$keys = 'blue drop ' . $this
->randomMachineName();
$this
->drupalGet("search/dummy_path", array(
'query' => array(
'keys' => $keys,
),
));
$this
->assertText("Dummy search snippet to display. Keywords: {$keys}");
$keys = 'moving drop ' . $this
->randomMachineName();
$this
->drupalGet("search/dummy_path", array(
'query' => array(
'keys' => 'bike',
'search_conditions' => $keys,
),
));
$this
->assertText("Dummy search snippet to display.");
$this
->assertRaw(Html::escape(print_r(array(
'keys' => 'bike',
'search_conditions' => $keys,
), TRUE)));
}
}