update
This commit is contained in:
@@ -35,7 +35,12 @@ class SearchAdvancedSearchFormTest extends BrowserTestBase {
|
||||
$this->drupalCreateContentType(['type' => 'article', 'name' => 'Article']);
|
||||
|
||||
// Create and log in user.
|
||||
$test_user = $this->drupalCreateUser(['access content', 'search content', 'use advanced search', 'administer nodes']);
|
||||
$test_user = $this->drupalCreateUser([
|
||||
'access content',
|
||||
'search content',
|
||||
'use advanced search',
|
||||
'administer nodes',
|
||||
]);
|
||||
$this->drupalLogin($test_user);
|
||||
|
||||
// Create initial node.
|
||||
|
||||
@@ -134,7 +134,7 @@ class SearchBlockTest extends BrowserTestBase {
|
||||
$name = $this->adminUser->getAccountName();
|
||||
$email = $this->adminUser->getEmail();
|
||||
$this->drupalPostForm('node', ['keys' => $name], t('Search'));
|
||||
$this->assertLink($name);
|
||||
$this->assertSession()->linkExists($name);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -52,7 +52,13 @@ class SearchCommentCountToggleTest extends BrowserTestBase {
|
||||
$this->drupalCreateContentType(['type' => 'article', 'name' => 'Article']);
|
||||
|
||||
// Create searching user.
|
||||
$this->searchingUser = $this->drupalCreateUser(['search content', 'access content', 'access comments', 'post comments', 'skip comment approval']);
|
||||
$this->searchingUser = $this->drupalCreateUser([
|
||||
'search content',
|
||||
'access content',
|
||||
'access comments',
|
||||
'post comments',
|
||||
'skip comment approval',
|
||||
]);
|
||||
|
||||
// Log in with sufficient privileges.
|
||||
$this->drupalLogin($this->searchingUser);
|
||||
|
||||
@@ -173,7 +173,7 @@ class SearchCommentTest extends BrowserTestBase {
|
||||
// Verify that comment is rendered using proper format.
|
||||
$this->assertText($comment_body, 'Comment body text found in search results.');
|
||||
$this->assertNoRaw(t('n/a'), 'HTML in comment body is not hidden.');
|
||||
$this->assertNoEscaped($edit_comment['comment_body[0][value]'], 'HTML in comment body is not escaped.');
|
||||
$this->assertNoEscaped($edit_comment['comment_body[0][value]']);
|
||||
|
||||
// Search for the evil script comment subject.
|
||||
$edit = [
|
||||
|
||||
@@ -52,7 +52,16 @@ class SearchConfigSettingsFormTest extends BrowserTestBase {
|
||||
$this->drupalCreateContentType(['type' => 'page', 'name' => 'Basic page']);
|
||||
|
||||
// Log in as a user that can create and search content.
|
||||
$this->searchUser = $this->drupalCreateUser(['search content', 'administer search', 'administer nodes', 'bypass node access', 'access user profiles', 'administer users', 'administer blocks', 'access site reports']);
|
||||
$this->searchUser = $this->drupalCreateUser([
|
||||
'search content',
|
||||
'administer search',
|
||||
'administer nodes',
|
||||
'bypass node access',
|
||||
'access user profiles',
|
||||
'administer users',
|
||||
'administer blocks',
|
||||
'access site reports',
|
||||
]);
|
||||
$this->drupalLogin($this->searchUser);
|
||||
|
||||
// Add a single piece of content and index it.
|
||||
@@ -104,7 +113,7 @@ class SearchConfigSettingsFormTest extends BrowserTestBase {
|
||||
$text = $this->randomMachineName(5);
|
||||
$this->drupalPostForm('search/node', ['keys' => $text], t('Search'));
|
||||
$this->drupalGet('admin/reports/dblog');
|
||||
$this->assertNoLink('Searched Content for ' . $text . '.', 'Search was not logged');
|
||||
$this->assertSession()->linkNotExists('Searched Content for ' . $text . '.', 'Search was not logged');
|
||||
|
||||
// Turn on logging.
|
||||
$edit = ['logging' => TRUE];
|
||||
@@ -112,7 +121,7 @@ class SearchConfigSettingsFormTest extends BrowserTestBase {
|
||||
$text = $this->randomMachineName(5);
|
||||
$this->drupalPostForm('search/node', ['keys' => $text], t('Search'));
|
||||
$this->drupalGet('admin/reports/dblog');
|
||||
$this->assertLink('Searched Content for ' . $text . '.', 0, 'Search was logged');
|
||||
$this->assertSession()->linkExists('Searched Content for ' . $text . '.', 0, 'Search was logged');
|
||||
|
||||
}
|
||||
|
||||
@@ -314,7 +323,7 @@ class SearchConfigSettingsFormTest extends BrowserTestBase {
|
||||
// Disable the first search page.
|
||||
$this->clickLink(t('Disable'));
|
||||
$this->assertSession()->statusCodeEquals(200);
|
||||
$this->assertNoLink(t('Disable'));
|
||||
$this->assertSession()->linkNotExists(t('Disable'));
|
||||
$this->verifySearchPageOperations($first_id, TRUE, TRUE, FALSE, TRUE);
|
||||
$this->verifySearchPageOperations($second_id, TRUE, FALSE, FALSE, FALSE);
|
||||
|
||||
|
||||
@@ -33,7 +33,15 @@ class SearchDateIntervalTest extends BrowserTestBase {
|
||||
$this->drupalCreateContentType(['type' => 'page', 'name' => 'Basic page']);
|
||||
|
||||
// Create and log in user.
|
||||
$test_user = $this->drupalCreateUser(['access content', 'search content', 'use advanced search', 'administer nodes', 'administer languages', 'access administration pages', 'administer site configuration']);
|
||||
$test_user = $this->drupalCreateUser([
|
||||
'access content',
|
||||
'search content',
|
||||
'use advanced search',
|
||||
'administer nodes',
|
||||
'administer languages',
|
||||
'access administration pages',
|
||||
'administer site configuration',
|
||||
]);
|
||||
$this->drupalLogin($test_user);
|
||||
|
||||
// Add a new language.
|
||||
@@ -78,8 +86,8 @@ class SearchDateIntervalTest extends BrowserTestBase {
|
||||
|
||||
// The nodes must have the same node ID but the created date is different.
|
||||
// So only the Spanish translation must appear.
|
||||
$this->assertLink('Node ES', 0, 'Spanish translation found in search results');
|
||||
$this->assertNoLink('Node EN', 'Search results do not contain English node');
|
||||
$this->assertSession()->linkExists('Node ES', 0, 'Spanish translation found in search results');
|
||||
$this->assertSession()->linkNotExists('Node EN', 'Search results do not contain English node');
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -41,7 +41,11 @@ class SearchEmbedFormTest extends BrowserTestBase {
|
||||
$this->drupalCreateContentType(['type' => 'page', 'name' => 'Basic page']);
|
||||
|
||||
// Create a user and a node, and update the search index.
|
||||
$test_user = $this->drupalCreateUser(['access content', 'search content', 'administer nodes']);
|
||||
$test_user = $this->drupalCreateUser([
|
||||
'access content',
|
||||
'search content',
|
||||
'administer nodes',
|
||||
]);
|
||||
$this->drupalLogin($test_user);
|
||||
|
||||
$this->node = $this->drupalCreateNode();
|
||||
|
||||
@@ -42,7 +42,12 @@ class SearchKeywordsConditionsTest extends BrowserTestBase {
|
||||
parent::setUp();
|
||||
|
||||
// Create searching user.
|
||||
$this->searchingUser = $this->drupalCreateUser(['search content', 'access content', 'access comments', 'skip comment approval']);
|
||||
$this->searchingUser = $this->drupalCreateUser([
|
||||
'search content',
|
||||
'access content',
|
||||
'access comments',
|
||||
'skip comment approval',
|
||||
]);
|
||||
// Log in with sufficient privileges.
|
||||
$this->drupalLogin($this->searchingUser);
|
||||
}
|
||||
|
||||
@@ -37,7 +37,15 @@ class SearchLanguageTest extends BrowserTestBase {
|
||||
$this->drupalCreateContentType(['type' => 'page', 'name' => 'Basic page']);
|
||||
|
||||
// Create and log in user.
|
||||
$test_user = $this->drupalCreateUser(['access content', 'search content', 'use advanced search', 'administer nodes', 'administer languages', 'access administration pages', 'administer site configuration']);
|
||||
$test_user = $this->drupalCreateUser([
|
||||
'access content',
|
||||
'search content',
|
||||
'use advanced search',
|
||||
'administer nodes',
|
||||
'administer languages',
|
||||
'access administration pages',
|
||||
'administer site configuration',
|
||||
]);
|
||||
$this->drupalLogin($test_user);
|
||||
|
||||
// Add a new language.
|
||||
@@ -121,12 +129,12 @@ class SearchLanguageTest extends BrowserTestBase {
|
||||
$edit = ['keys' => 'node', 'language[es]' => TRUE];
|
||||
$this->drupalPostForm('search/node', $edit, 'edit-submit--2');
|
||||
// Check for Spanish results.
|
||||
$this->assertLink('Second node this is the Spanish title', 0, 'Second node Spanish title found in search results');
|
||||
$this->assertLink('Third node es', 0, 'Third node Spanish found in search results');
|
||||
$this->assertSession()->linkExists('Second node this is the Spanish title', 0, 'Second node Spanish title found in search results');
|
||||
$this->assertSession()->linkExists('Third node es', 0, 'Third node Spanish found in search results');
|
||||
// Ensure that results don't contain other language nodes.
|
||||
$this->assertNoLink('First node en', 'Search results do not contain first English node');
|
||||
$this->assertNoLink('Second node en', 'Search results do not contain second English node');
|
||||
$this->assertNoLink('Third node en', 'Search results do not contain third English node');
|
||||
$this->assertSession()->linkNotExists('First node en', 'Search results do not contain first English node');
|
||||
$this->assertSession()->linkNotExists('Second node en', 'Search results do not contain second English node');
|
||||
$this->assertSession()->linkNotExists('Third node en', 'Search results do not contain third English node');
|
||||
|
||||
// Change the default language and delete English.
|
||||
$path = 'admin/config/regional/language';
|
||||
|
||||
@@ -52,7 +52,14 @@ class SearchMultilingualEntityTest extends BrowserTestBase {
|
||||
|
||||
// Create a user who can administer search, do searches, see the status
|
||||
// report, and administer cron. Log in.
|
||||
$user = $this->drupalCreateUser(['administer search', 'search content', 'use advanced search', 'access content', 'access site reports', 'administer site configuration']);
|
||||
$user = $this->drupalCreateUser([
|
||||
'administer search',
|
||||
'search content',
|
||||
'use advanced search',
|
||||
'access content',
|
||||
'access site reports',
|
||||
'administer site configuration',
|
||||
]);
|
||||
$this->drupalLogin($user);
|
||||
|
||||
// Set up the search plugin.
|
||||
|
||||
@@ -36,7 +36,12 @@ class SearchNodeDiacriticsTest extends BrowserTestBase {
|
||||
node_access_rebuild();
|
||||
|
||||
// Create a test user and log in.
|
||||
$this->testUser = $this->drupalCreateUser(['access content', 'search content', 'use advanced search', 'access user profiles']);
|
||||
$this->testUser = $this->drupalCreateUser([
|
||||
'access content',
|
||||
'search content',
|
||||
'use advanced search',
|
||||
'access user profiles',
|
||||
]);
|
||||
$this->drupalLogin($this->testUser);
|
||||
}
|
||||
|
||||
|
||||
@@ -35,7 +35,12 @@ class SearchNodePunctuationTest extends BrowserTestBase {
|
||||
|
||||
node_access_rebuild();
|
||||
// Create a test user and log in.
|
||||
$this->testUser = $this->drupalCreateUser(['access content', 'search content', 'use advanced search', 'access user profiles']);
|
||||
$this->testUser = $this->drupalCreateUser([
|
||||
'access content',
|
||||
'search content',
|
||||
'use advanced search',
|
||||
'access user profiles',
|
||||
]);
|
||||
$this->drupalLogin($this->testUser);
|
||||
}
|
||||
|
||||
@@ -59,7 +64,7 @@ class SearchNodePunctuationTest extends BrowserTestBase {
|
||||
|
||||
// Check if the author is linked correctly to the user profile page.
|
||||
$username = $node->getOwner()->getAccountName();
|
||||
$this->assertLink($username);
|
||||
$this->assertSession()->linkExists($username);
|
||||
|
||||
// Search for "&" and verify entities are not broken up in the output.
|
||||
$edit = ['keys' => '&'];
|
||||
|
||||
@@ -36,7 +36,10 @@ class SearchNodeUpdateAndDeletionTest extends BrowserTestBase {
|
||||
$this->drupalCreateContentType(['type' => 'page', 'name' => 'Basic page']);
|
||||
|
||||
// Create a test user and log in.
|
||||
$this->testUser = $this->drupalCreateUser(['access content', 'search content']);
|
||||
$this->testUser = $this->drupalCreateUser([
|
||||
'access content',
|
||||
'search content',
|
||||
]);
|
||||
$this->drupalLogin($this->testUser);
|
||||
}
|
||||
|
||||
|
||||
@@ -65,7 +65,12 @@ class SearchNumberMatchingTest extends BrowserTestBase {
|
||||
|
||||
$this->drupalCreateContentType(['type' => 'page', 'name' => 'Basic page']);
|
||||
|
||||
$this->testUser = $this->drupalCreateUser(['search content', 'access content', 'administer nodes', 'access site reports']);
|
||||
$this->testUser = $this->drupalCreateUser([
|
||||
'search content',
|
||||
'access content',
|
||||
'administer nodes',
|
||||
'access site reports',
|
||||
]);
|
||||
$this->drupalLogin($this->testUser);
|
||||
|
||||
foreach ($this->numbers as $num) {
|
||||
|
||||
@@ -71,7 +71,12 @@ class SearchNumbersTest extends BrowserTestBase {
|
||||
|
||||
$this->drupalCreateContentType(['type' => 'page', 'name' => 'Basic page']);
|
||||
|
||||
$this->testUser = $this->drupalCreateUser(['search content', 'access content', 'administer nodes', 'access site reports']);
|
||||
$this->testUser = $this->drupalCreateUser([
|
||||
'search content',
|
||||
'access content',
|
||||
'administer nodes',
|
||||
'access site reports',
|
||||
]);
|
||||
$this->drupalLogin($this->testUser);
|
||||
|
||||
foreach ($this->numbers as $doc => $num) {
|
||||
|
||||
@@ -53,7 +53,10 @@ class SearchPageCacheTagsTest extends BrowserTestBase {
|
||||
$this->drupalCreateContentType(['type' => 'page', 'name' => 'Basic page']);
|
||||
|
||||
// Create user.
|
||||
$this->searchingUser = $this->drupalCreateUser(['search content', 'access user profiles']);
|
||||
$this->searchingUser = $this->drupalCreateUser([
|
||||
'search content',
|
||||
'access user profiles',
|
||||
]);
|
||||
|
||||
// Create a node and update the search index.
|
||||
$this->node = $this->drupalCreateNode(['title' => 'bike shed shop']);
|
||||
|
||||
@@ -35,7 +35,10 @@ class SearchPageOverrideTest extends BrowserTestBase {
|
||||
parent::setUp();
|
||||
|
||||
// Log in as a user that can create and search content.
|
||||
$this->searchUser = $this->drupalCreateUser(['search content', 'administer search']);
|
||||
$this->searchUser = $this->drupalCreateUser([
|
||||
'search content',
|
||||
'administer search',
|
||||
]);
|
||||
$this->drupalLogin($this->searchUser);
|
||||
}
|
||||
|
||||
|
||||
@@ -39,7 +39,11 @@ class SearchPageTextTest extends BrowserTestBase {
|
||||
$this->drupalCreateContentType(['type' => 'page', 'name' => 'Basic page']);
|
||||
|
||||
// Create user.
|
||||
$this->searchingUser = $this->drupalCreateUser(['search content', 'access user profiles', 'use advanced search']);
|
||||
$this->searchingUser = $this->drupalCreateUser([
|
||||
'search content',
|
||||
'access user profiles',
|
||||
'use advanced search',
|
||||
]);
|
||||
$this->drupalPlaceBlock('local_tasks_block');
|
||||
$this->drupalPlaceBlock('page_title_block');
|
||||
}
|
||||
|
||||
@@ -29,7 +29,10 @@ class SearchQueryAlterTest extends BrowserTestBase {
|
||||
$this->drupalCreateContentType(['type' => 'article', 'name' => 'Article']);
|
||||
|
||||
// Log in with sufficient privileges.
|
||||
$this->drupalLogin($this->drupalCreateUser(['create page content', 'search content']));
|
||||
$this->drupalLogin($this->drupalCreateUser([
|
||||
'create page content',
|
||||
'search content',
|
||||
]));
|
||||
|
||||
// Create a node and an article with the same keyword. The query alter
|
||||
// test module will alter the query so only articles should be returned.
|
||||
|
||||
@@ -49,7 +49,12 @@ class SearchRankingTest extends BrowserTestBase {
|
||||
$this->nodeSearch = SearchPage::load('node_search');
|
||||
|
||||
// Log in with sufficient privileges.
|
||||
$this->drupalLogin($this->drupalCreateUser(['post comments', 'skip comment approval', 'create page content', 'administer search']));
|
||||
$this->drupalLogin($this->drupalCreateUser([
|
||||
'post comments',
|
||||
'skip comment approval',
|
||||
'create page content',
|
||||
'administer search',
|
||||
]));
|
||||
}
|
||||
|
||||
public function testRankings() {
|
||||
|
||||
Reference in New Issue
Block a user