Issue #3133033 by munish.kumar, xjm, Hardik_Patel_12, daffie, swatichouhan012: Fix Drupal.Array.Array.LongLineDeclaration coding standard for instances of the drupalCreateUser() test method

(cherry picked from commit de32f3ca2d)
merge-requests/64/head
xjm 2020-06-21 16:39:19 -05:00
parent 6293597536
commit f1f335a795
253 changed files with 1645 additions and 321 deletions

View File

@ -46,7 +46,12 @@ abstract class AggregatorTestBase extends BrowserTestBase {
$this->drupalCreateContentType(['type' => 'article', 'name' => 'Article']);
}
$this->adminUser = $this->drupalCreateUser(['access administration pages', 'administer news feeds', 'access news feeds', 'create article content']);
$this->adminUser = $this->drupalCreateUser([
'access administration pages',
'administer news feeds',
'access news feeds',
'create article content',
]);
$this->drupalLogin($this->adminUser);
$this->drupalPlaceBlock('local_tasks_block');
}

View File

@ -55,7 +55,13 @@ class FeedLanguageTest extends AggregatorTestBase {
* Tests creation of feeds with a language.
*/
public function testFeedLanguage() {
$admin_user = $this->drupalCreateUser(['administer languages', 'access administration pages', 'administer news feeds', 'access news feeds', 'create article content']);
$admin_user = $this->drupalCreateUser([
'administer languages',
'access administration pages',
'administer news feeds',
'access news feeds',
'create article content',
]);
$this->drupalLogin($admin_user);
// Enable language selection for feeds.

View File

@ -29,7 +29,12 @@ class ImportOpmlTest extends AggregatorTestBase {
protected function setUp() {
parent::setUp();
$admin_user = $this->drupalCreateUser(['administer news feeds', 'access news feeds', 'create article content', 'administer blocks']);
$admin_user = $this->drupalCreateUser([
'administer news feeds',
'access news feeds',
'create article content',
'administer blocks',
]);
$this->drupalLogin($admin_user);
}

View File

@ -28,7 +28,10 @@ class BlockAdminThemeTest extends BrowserTestBase {
*/
public function testAdminTheme() {
// Create administrative user.
$admin_user = $this->drupalCreateUser(['administer blocks', 'administer themes']);
$admin_user = $this->drupalCreateUser([
'administer blocks',
'administer themes',
]);
$this->drupalLogin($admin_user);
// Ensure that access to block admin page is denied when theme is not

View File

@ -56,7 +56,10 @@ class BlockCacheTest extends BrowserTestBase {
parent::setUp();
// Create an admin user, log in and enable test blocks.
$this->adminUser = $this->drupalCreateUser(['administer blocks', 'access administration pages']);
$this->adminUser = $this->drupalCreateUser([
'administer blocks',
'access administration pages',
]);
$this->drupalLogin($this->adminUser);
// Create additional users to test caching modes.

View File

@ -28,7 +28,10 @@ class BlockDemoTest extends BrowserTestBase {
*/
public function testBlockDemo() {
// Create administrative user.
$admin_user = $this->drupalCreateUser(['administer blocks', 'administer themes']);
$admin_user = $this->drupalCreateUser([
'administer blocks',
'administer themes',
]);
$this->drupalLogin($admin_user);
// Confirm we have access to the block demo page for the default theme.

View File

@ -33,7 +33,10 @@ class BlockLanguageTest extends BrowserTestBase {
protected function setUp() {
parent::setUp();
$this->adminUser = $this->drupalCreateUser(['administer blocks', 'administer languages']);
$this->adminUser = $this->drupalCreateUser([
'administer blocks',
'administer languages',
]);
$this->drupalLogin($this->adminUser);
// Add predefined language.

View File

@ -32,7 +32,10 @@ class BlockXssTest extends BrowserTestBase {
* Tests that nothing is escaped other than the blocks explicitly tested.
*/
public function testNoUnexpectedEscaping() {
$this->drupalLogin($this->drupalCreateUser(['administer blocks', 'access administration pages']));
$this->drupalLogin($this->drupalCreateUser([
'administer blocks',
'access administration pages',
]));
$this->drupalGet(Url::fromRoute('block.admin_display'));
$this->clickLink('Place block');
$this->assertNoEscaped('<');
@ -49,7 +52,10 @@ class BlockXssTest extends BrowserTestBase {
$this->drupalGet('');
$this->assertNoRaw('<script>alert("XSS label");</script>', 'The block title was properly sanitized when rendered.');
$this->drupalLogin($this->drupalCreateUser(['administer blocks', 'access administration pages']));
$this->drupalLogin($this->drupalCreateUser([
'administer blocks',
'access administration pages',
]));
$default_theme = $this->config('system.theme')->get('default');
$this->drupalGet('admin/structure/block/list/' . $default_theme);
$this->assertNoRaw("<script>alert('XSS subject');</script>", 'The block title was properly sanitized in Block Plugin UI Admin page.');
@ -61,7 +67,10 @@ class BlockXssTest extends BrowserTestBase {
public function testXssInCategory() {
$this->container->get('module_installer')->install(['block_test']);
$this->drupalPlaceBlock('test_xss_title');
$this->drupalLogin($this->drupalCreateUser(['administer blocks', 'access administration pages']));
$this->drupalLogin($this->drupalCreateUser([
'administer blocks',
'access administration pages',
]));
$this->drupalGet(Url::fromRoute('block.admin_display'));
$this->clickLink('Place block');
$this->assertNoRaw("<script>alert('XSS category');</script>");

View File

@ -36,7 +36,10 @@ class NonDefaultBlockAdminTest extends BrowserTestBase {
* Test non-default theme admin.
*/
public function testNonDefaultBlockAdmin() {
$admin_user = $this->drupalCreateUser(['administer blocks', 'administer themes']);
$admin_user = $this->drupalCreateUser([
'administer blocks',
'administer themes',
]);
$this->drupalLogin($admin_user);
$new_theme = 'bartik';
\Drupal::service('theme_installer')->install([$new_theme]);

View File

@ -65,7 +65,10 @@ class DisplayBlockTest extends ViewTestBase {
* Tests default and custom block categories.
*/
public function testBlockCategory() {
$this->drupalLogin($this->drupalCreateUser(['administer views', 'administer blocks']));
$this->drupalLogin($this->drupalCreateUser([
'administer views',
'administer blocks',
]));
// Create a new view in the UI.
$edit = [];
@ -368,7 +371,11 @@ class DisplayBlockTest extends ViewTestBase {
* Tests the contextual links on a Views block.
*/
public function testBlockContextualLinks() {
$this->drupalLogin($this->drupalCreateUser(['administer views', 'access contextual links', 'administer blocks']));
$this->drupalLogin($this->drupalCreateUser([
'administer views',
'access contextual links',
'administer blocks',
]));
$block = $this->drupalPlaceBlock('views_block:test_view_block-block_1');
$cached_block = $this->drupalPlaceBlock('views_block:test_view_block-block_1');
$this->drupalGet('test-page');

View File

@ -31,7 +31,10 @@ class BlockContentListTest extends BlockContentTestBase {
* Tests the custom block listing page.
*/
public function testListing() {
$this->drupalLogin($this->drupalCreateUser(['administer blocks', 'translate configuration']));
$this->drupalLogin($this->drupalCreateUser([
'administer blocks',
'translate configuration',
]));
$this->drupalGet('admin/structure/block/block-content');
// Test for the page title.

View File

@ -34,7 +34,10 @@ class BlockContentListViewsTest extends BlockContentTestBase {
* Tests the custom block listing page.
*/
public function testListing() {
$this->drupalLogin($this->drupalCreateUser(['administer blocks', 'translate configuration']));
$this->drupalLogin($this->drupalCreateUser([
'administer blocks',
'translate configuration',
]));
$this->drupalGet('admin/structure/block/block-content');
// Test for the page title.

View File

@ -53,8 +53,24 @@ class BookBreadcrumbTest extends BrowserTestBase {
$this->drupalPlaceBlock('page_title_block');
// Create users.
$this->bookAuthor = $this->drupalCreateUser(['create new books', 'create book content', 'edit own book content', 'add content to books']);
$this->adminUser = $this->drupalCreateUser(['create new books', 'create book content', 'edit any book content', 'delete any book content', 'add content to books', 'administer blocks', 'administer permissions', 'administer book outlines', 'administer content types', 'administer site configuration']);
$this->bookAuthor = $this->drupalCreateUser([
'create new books',
'create book content',
'edit own book content',
'add content to books',
]);
$this->adminUser = $this->drupalCreateUser([
'create new books',
'create book content',
'edit any book content',
'delete any book content',
'add content to books',
'administer blocks',
'administer permissions',
'administer book outlines',
'administer content types',
'administer site configuration',
]);
}
/**

View File

@ -46,7 +46,16 @@ class BookContentModerationTest extends BrowserTestBase {
$workflow->save();
// We need a user with additional content moderation permissions.
$this->bookAuthor = $this->drupalCreateUser(['create new books', 'create book content', 'edit own book content', 'add content to books', 'access printer-friendly version', 'view any unpublished content', 'use editorial transition create_new_draft', 'use editorial transition publish']);
$this->bookAuthor = $this->drupalCreateUser([
'create new books',
'create book content',
'edit own book content',
'add content to books',
'access printer-friendly version',
'view any unpublished content',
'use editorial transition create_new_draft',
'use editorial transition publish',
]);
}
/**

View File

@ -61,10 +61,32 @@ class BookTest extends BrowserTestBase {
node_access_rebuild();
// Create users.
$this->bookAuthor = $this->drupalCreateUser(['create new books', 'create book content', 'edit own book content', 'add content to books']);
$this->webUser = $this->drupalCreateUser(['access printer-friendly version', 'node test view']);
$this->webUserWithoutNodeAccess = $this->drupalCreateUser(['access printer-friendly version']);
$this->adminUser = $this->drupalCreateUser(['create new books', 'create book content', 'edit any book content', 'delete any book content', 'add content to books', 'administer blocks', 'administer permissions', 'administer book outlines', 'node test view', 'administer content types', 'administer site configuration']);
$this->bookAuthor = $this->drupalCreateUser([
'create new books',
'create book content',
'edit own book content',
'add content to books',
]);
$this->webUser = $this->drupalCreateUser([
'access printer-friendly version',
'node test view',
]);
$this->webUserWithoutNodeAccess = $this->drupalCreateUser([
'access printer-friendly version',
]);
$this->adminUser = $this->drupalCreateUser([
'create new books',
'create book content',
'edit any book content',
'delete any book content',
'add content to books',
'administer blocks',
'administer permissions',
'administer book outlines',
'node test view',
'administer content types',
'administer site configuration',
]);
}
/**
@ -557,7 +579,11 @@ class BookTest extends BrowserTestBase {
$this->createBook();
// Create administrator user.
$administratorUser = $this->drupalCreateUser(['administer blocks', 'administer nodes', 'bypass node access']);
$administratorUser = $this->drupalCreateUser([
'administer blocks',
'administer nodes',
'bypass node access',
]);
$this->drupalLogin($administratorUser);
// Enable the block with "Show block only on book pages" mode.

View File

@ -72,8 +72,16 @@ class CKEditorLoadingTest extends BrowserTestBase {
'name' => 'Article',
]);
$this->untrustedUser = $this->drupalCreateUser(['create article content', 'edit any article content']);
$this->normalUser = $this->drupalCreateUser(['create article content', 'edit any article content', 'use text format filtered_html', 'use text format full_html']);
$this->untrustedUser = $this->drupalCreateUser([
'create article content',
'edit any article content',
]);
$this->normalUser = $this->drupalCreateUser([
'create article content',
'edit any article content',
'use text format filtered_html',
'use text format full_html',
]);
}
/**

View File

@ -57,7 +57,10 @@ class CKEditorStylesComboTranslationTest extends BrowserTestBase {
]);
$editor->save();
$this->adminUser = $this->drupalCreateUser(['administer filters', 'translate configuration']);
$this->adminUser = $this->drupalCreateUser([
'administer filters',
'translate configuration',
]);
ConfigurableLanguage::createFromLangcode('de')->save();
}

View File

@ -60,7 +60,11 @@ class CommentBookTest extends BrowserTestBase {
]);
$comment->save();
$commenting_user = $this->drupalCreateUser(['access printer-friendly version', 'access comments', 'post comments']);
$commenting_user = $this->drupalCreateUser([
'access printer-friendly version',
'access comments',
'post comments',
]);
$this->drupalLogin($commenting_user);
$this->drupalGet('node/' . $book_node->id());

View File

@ -191,7 +191,10 @@ class CommentFieldsTest extends CommentTestBase {
*/
public function testCommentInstallAfterContentModule() {
// Create a user to do module administration.
$this->adminUser = $this->drupalCreateUser(['access administration pages', 'administer modules']);
$this->adminUser = $this->drupalCreateUser([
'access administration pages',
'administer modules',
]);
$this->drupalLogin($this->adminUser);
// Drop default comment field added in CommentTestBase::setup().
@ -233,7 +236,12 @@ class CommentFieldsTest extends CommentTestBase {
// Try to post a comment on each node. A failure will be triggered if the
// comment body is missing on one of these forms, due to postComment()
// asserting that the body is actually posted correctly.
$this->webUser = $this->drupalCreateUser(['access content', 'access comments', 'post comments', 'skip comment approval']);
$this->webUser = $this->drupalCreateUser([
'access content',
'access comments',
'post comments',
'skip comment approval',
]);
$this->drupalLogin($this->webUser);
$this->postComment($book_node, $this->randomMachineName(), $this->randomMachineName());
}

View File

@ -45,7 +45,17 @@ class CommentLanguageTest extends BrowserTestBase {
$this->drupalCreateContentType(['type' => 'article', 'name' => 'Article']);
// Create and log in user.
$admin_user = $this->drupalCreateUser(['administer site configuration', 'administer languages', 'access administration pages', 'administer content types', 'administer comments', 'create article content', 'access comments', 'post comments', 'skip comment approval']);
$admin_user = $this->drupalCreateUser([
'administer site configuration',
'administer languages',
'access administration pages',
'administer content types',
'administer comments',
'create article content',
'access comments',
'post comments',
'skip comment approval',
]);
$this->drupalLogin($admin_user);
// Add language.

View File

@ -128,7 +128,12 @@ class CommentPreviewTest extends CommentTestBase {
* Tests comment edit, preview, and save.
*/
public function testCommentEditPreviewSave() {
$web_user = $this->drupalCreateUser(['access comments', 'post comments', 'skip comment approval', 'edit own comments']);
$web_user = $this->drupalCreateUser([
'access comments',
'post comments',
'skip comment approval',
'edit own comments',
]);
$this->drupalLogin($this->adminUser);
$this->setCommentPreview(DRUPAL_OPTIONAL);
$this->setCommentForm(TRUE);

View File

@ -35,7 +35,9 @@ class ConfigDependencyWebTest extends BrowserTestBase {
* @see \Drupal\Core\Config\Entity\ConfigDependencyDeleteFormTrait
*/
public function testConfigDependencyDeleteFormTrait() {
$this->drupalLogin($this->drupalCreateUser(['administer site configuration']));
$this->drupalLogin($this->drupalCreateUser([
'administer site configuration',
]));
/** @var \Drupal\Core\Config\Entity\ConfigEntityStorage $storage */
$storage = $this->container->get('entity_type.manager')->getStorage('config_test');

View File

@ -25,7 +25,9 @@ class ConfigEntityFormOverrideTest extends BrowserTestBase {
* Tests that overrides do not affect forms or listing screens.
*/
public function testFormsWithOverrides() {
$this->drupalLogin($this->drupalCreateUser(['administer site configuration']));
$this->drupalLogin($this->drupalCreateUser([
'administer site configuration',
]));
$original_label = 'Default';
$overridden_label = 'Overridden label';

View File

@ -41,7 +41,10 @@ class ConfigEntityListMultilingualTest extends BrowserTestBase {
*/
public function testListUI() {
// Log in as an administrative user to access the full menu trail.
$this->drupalLogin($this->drupalCreateUser(['access administration pages', 'administer site configuration']));
$this->drupalLogin($this->drupalCreateUser([
'access administration pages',
'administer site configuration',
]));
// Get the list page.
$this->drupalGet('admin/structure/config_test');

View File

@ -156,7 +156,10 @@ class ConfigEntityListTest extends BrowserTestBase {
*/
public function testListUI() {
// Log in as an administrative user to access the full menu trail.
$this->drupalLogin($this->drupalCreateUser(['access administration pages', 'administer site configuration']));
$this->drupalLogin($this->drupalCreateUser([
'access administration pages',
'administer site configuration',
]));
// Get the list callback page.
$this->drupalGet('admin/structure/config_test');
@ -254,7 +257,9 @@ class ConfigEntityListTest extends BrowserTestBase {
* Test paging.
*/
public function testPager() {
$this->drupalLogin($this->drupalCreateUser(['administer site configuration']));
$this->drupalLogin($this->drupalCreateUser([
'administer site configuration',
]));
$storage = \Drupal::service('entity_type.manager')->getListBuilder('config_test')->getStorage();

View File

@ -27,7 +27,9 @@ class ConfigEntityStatusUITest extends BrowserTestBase {
* Tests status operations.
*/
public function testCRUD() {
$this->drupalLogin($this->drupalCreateUser(['administer site configuration']));
$this->drupalLogin($this->drupalCreateUser([
'administer site configuration',
]));
$id = strtolower($this->randomMachineName());
$edit = [

View File

@ -236,7 +236,9 @@ class ConfigEntityTest extends BrowserTestBase {
* Tests CRUD operations through the UI.
*/
public function testCRUDUI() {
$this->drupalLogin($this->drupalCreateUser(['administer site configuration']));
$this->drupalLogin($this->drupalCreateUser([
'administer site configuration',
]));
$id = strtolower($this->randomMachineName());
$label1 = $this->randomMachineName();

View File

@ -21,7 +21,10 @@ class ConfigFormOverrideTest extends BrowserTestBase {
* Tests that overrides do not affect forms.
*/
public function testFormsWithOverrides() {
$this->drupalLogin($this->drupalCreateUser(['access administration pages', 'administer site configuration']));
$this->drupalLogin($this->drupalCreateUser([
'access administration pages',
'administer site configuration',
]));
$overridden_name = 'Site name global conf override';

View File

@ -34,7 +34,11 @@ class ConfigInstallWebTest extends BrowserTestBase {
protected function setUp() {
parent::setUp();
$this->adminUser = $this->drupalCreateUser(['administer modules', 'administer themes', 'administer site configuration']);
$this->adminUser = $this->drupalCreateUser([
'administer modules',
'administer themes',
'administer site configuration',
]);
// Ensure the global variable being asserted by this test does not exist;
// a previous test executed in this request/process might have set it.

View File

@ -40,7 +40,10 @@ class ConfigLanguageOverrideWebTest extends BrowserTestBase {
* Tests translating the site name.
*/
public function testSiteNameTranslation() {
$adminUser = $this->drupalCreateUser(['administer site configuration', 'administer languages']);
$adminUser = $this->drupalCreateUser([
'administer site configuration',
'administer languages',
]);
$this->drupalLogin($adminUser);
// Add a custom language.

View File

@ -25,7 +25,9 @@ class ConfigEntityTest extends WebDriverTestBase {
* Tests ajax operations through the UI on 'Add' page.
*/
public function testAjaxOnAddPage() {
$this->drupalLogin($this->drupalCreateUser(['administer site configuration']));
$this->drupalLogin($this->drupalCreateUser([
'administer site configuration',
]));
$page = $this->getSession()->getPage();
$assert_session = $this->assertSession();

View File

@ -57,11 +57,19 @@ class ContactPersonalTest extends BrowserTestBase {
parent::setUp();
// Create an admin user.
$this->adminUser = $this->drupalCreateUser(['administer contact forms', 'administer users', 'administer account settings', 'access site reports']);
$this->adminUser = $this->drupalCreateUser([
'administer contact forms',
'administer users',
'administer account settings',
'access site reports',
]);
// Create some normal users with their contact forms enabled by default.
$this->config('contact.settings')->set('user_default_enabled', TRUE)->save();
$this->webUser = $this->drupalCreateUser(['access user profiles', 'access user contact forms']);
$this->webUser = $this->drupalCreateUser([
'access user profiles',
'access user contact forms',
]);
$this->contactUser = $this->drupalCreateUser();
}

View File

@ -59,7 +59,9 @@ class ContactSitewideTest extends BrowserTestBase {
*/
public function testSiteWideContact() {
// Tests name and email fields for authenticated and anonymous users.
$this->drupalLogin($this->drupalCreateUser(['access site-wide contact form']));
$this->drupalLogin($this->drupalCreateUser([
'access site-wide contact form',
]));
$this->drupalGet('contact');
// Ensure that there is no textfield for name.

View File

@ -54,7 +54,12 @@ class ModeratedContentViewTest extends BrowserTestBase {
$workflow->getTypePlugin()->addEntityTypeAndBundle('node', 'article');
$workflow->save();
$this->adminUser = $this->drupalCreateUser(['access administration pages', 'view any unpublished content', 'administer nodes', 'bypass node access']);
$this->adminUser = $this->drupalCreateUser([
'access administration pages',
'view any unpublished content',
'administer nodes',
'bypass node access',
]);
}
/**

View File

@ -66,7 +66,10 @@ class ViewsModerationStateFilterTest extends ViewTestBase {
$new_workflow->getTypePlugin()->addEntityTypeAndBundle('node', 'example_c');
$new_workflow->save();
$this->drupalLogin($this->drupalCreateUser(['administer workflows', 'administer views']));
$this->drupalLogin($this->drupalCreateUser([
'administer workflows',
'administer views',
]));
$this->container->get('module_installer')->install(['content_moderation_test_views']);

View File

@ -26,7 +26,12 @@ class ContentTranslationEntityBundleUITest extends BrowserTestBase {
protected function setUp() {
parent::setUp();
$user = $this->drupalCreateUser(['access administration pages', 'administer languages', 'administer content translation', 'administer content types']);
$user = $this->drupalCreateUser([
'access administration pages',
'administer languages',
'administer content translation',
'administer content types',
]);
$this->drupalLogin($user);
}

View File

@ -64,7 +64,12 @@ class ContentTranslationOperationsTest extends NodeTestBase {
\Drupal::service('router.builder')->rebuild();
$this->baseUser1 = $this->drupalCreateUser(['access content overview']);
$this->baseUser2 = $this->drupalCreateUser(['access content overview', 'create content translations', 'update content translations', 'delete content translations']);
$this->baseUser2 = $this->drupalCreateUser([
'access content overview',
'create content translations',
'update content translations',
'delete content translations',
]);
}
/**

View File

@ -49,7 +49,17 @@ class ContentTranslationSettingsTest extends BrowserTestBase {
$this->addDefaultCommentField('node', 'article', 'comment_article', CommentItemInterface::OPEN, 'comment_article');
$this->addDefaultCommentField('node', 'page', 'comment_page');
$admin_user = $this->drupalCreateUser(['access administration pages', 'administer languages', 'administer content translation', 'administer content types', 'administer node fields', 'administer comment fields', 'administer comments', 'administer comment types', 'administer account settings']);
$admin_user = $this->drupalCreateUser([
'access administration pages',
'administer languages',
'administer content translation',
'administer content types',
'administer node fields',
'administer comment fields',
'administer comments',
'administer comment types',
'administer account settings',
]);
$this->drupalLogin($admin_user);
}

View File

@ -125,7 +125,11 @@ class ContentTranslationWorkflowsTest extends ContentTranslationTestBase {
$ops = ['create' => t('Add'), 'update' => t('Edit'), 'delete' => t('Delete')];
$translations_url = $this->entity->toUrl('drupal:content-translation-overview');
foreach ($ops as $current_op => $item) {
$user = $this->drupalCreateUser([$this->getTranslatePermission(), "$current_op content translations", 'view test entity']);
$user = $this->drupalCreateUser([
$this->getTranslatePermission(),
"$current_op content translations",
'view test entity',
]);
$this->drupalLogin($user);
$this->drupalGet($translations_url);

View File

@ -66,8 +66,15 @@ class ContextualDynamicContextTest extends BrowserTestBase {
ConfigurableLanguage::createFromLangcode('it')->save();
$this->rebuildContainer();
$this->editorUser = $this->drupalCreateUser(['access content', 'access contextual links', 'edit any article content']);
$this->authenticatedUser = $this->drupalCreateUser(['access content', 'access contextual links']);
$this->editorUser = $this->drupalCreateUser([
'access content',
'access contextual links',
'edit any article content',
]);
$this->authenticatedUser = $this->drupalCreateUser([
'access content',
'access contextual links',
]);
$this->anonymousUser = $this->drupalCreateUser(['access content']);
}

View File

@ -64,7 +64,12 @@ class DbLogTest extends BrowserTestBase {
$this->drupalPlaceBlock('page_title_block');
// Create users with specific permissions.
$this->adminUser = $this->drupalCreateUser(['administer site configuration', 'access administration pages', 'access site reports', 'administer users']);
$this->adminUser = $this->drupalCreateUser([
'administer site configuration',
'access administration pages',
'access site reports',
'administer users',
]);
$this->webUser = $this->drupalCreateUser([]);
}

View File

@ -105,9 +105,23 @@ class EditorLoadingTest extends BrowserTestBase {
->save();
// Create 3 users, each with access to different text formats.
$this->untrustedUser = $this->drupalCreateUser(['create article content', 'edit any article content']);
$this->normalUser = $this->drupalCreateUser(['create article content', 'edit any article content', 'use text format filtered_html']);
$this->privilegedUser = $this->drupalCreateUser(['create article content', 'edit any article content', 'create page content', 'edit any page content', 'use text format filtered_html', 'use text format full_html']);
$this->untrustedUser = $this->drupalCreateUser([
'create article content',
'edit any article content',
]);
$this->normalUser = $this->drupalCreateUser([
'create article content',
'edit any article content',
'use text format filtered_html',
]);
$this->privilegedUser = $this->drupalCreateUser([
'create article content',
'edit any article content',
'create page content',
'edit any page content',
'use text format filtered_html',
'use text format full_html',
]);
}
/**

View File

@ -66,7 +66,10 @@ class EditorUploadImageScaleTest extends BrowserTestBase {
])->save();
// Create admin user.
$this->adminUser = $this->drupalCreateUser(['administer filters', 'use text format basic_html']);
$this->adminUser = $this->drupalCreateUser([
'administer filters',
'use text format basic_html',
]);
$this->drupalLogin($this->adminUser);
}

View File

@ -50,7 +50,14 @@ class BooleanFormatterSettingsTest extends BrowserTestBase {
$type = $this->drupalCreateContentType(['name' => $type_name, 'type' => $type_name]);
$this->bundle = $type->id();
$admin_user = $this->drupalCreateUser(['access content', 'administer content types', 'administer node fields', 'administer node display', 'bypass node access', 'administer nodes']);
$admin_user = $this->drupalCreateUser([
'access content',
'administer content types',
'administer node fields',
'administer node display',
'bypass node access',
'administer nodes',
]);
$this->drupalLogin($admin_user);
$this->fieldName = mb_strtolower($this->randomMachineName(8));

View File

@ -92,7 +92,10 @@ class EntityReferenceAutoCreateTest extends BrowserTestBase {
])
->save();
$account = $this->drupalCreateUser(['access content', "create $this->referencingType content"]);
$account = $this->drupalCreateUser([
'access content',
"create $this->referencingType content",
]);
$this->drupalLogin($account);
}

View File

@ -44,7 +44,13 @@ class EntityReferenceFieldDefaultValueTest extends BrowserTestBase {
$this->drupalCreateContentType(['type' => 'referenced_content']);
// Create admin user.
$this->adminUser = $this->drupalCreateUser(['access content', 'administer content types', 'administer node fields', 'administer node form display', 'bypass node access']);
$this->adminUser = $this->drupalCreateUser([
'access content',
'administer content types',
'administer node fields',
'administer node form display',
'bypass node access',
]);
$this->drupalLogin($this->adminUser);
}

View File

@ -147,7 +147,9 @@ class EntityReferenceFieldTranslatedReferenceViewTest extends BrowserTestBase {
$this->setUpEntityReferenceField();
$this->createContent();
$this->webUser = $this->drupalCreateUser(['edit any ' . $this->referrerType->id() . ' content']);
$this->webUser = $this->drupalCreateUser([
'edit any ' . $this->referrerType->id() . ' content',
]);
}
/**

View File

@ -121,7 +121,10 @@ class EntityReferenceFileUploadTest extends BrowserTestBase {
* Tests that the autocomplete input element does not cause ajax fatal.
*/
public function testFileUpload() {
$user1 = $this->drupalCreateUser(['access content', "create $this->referencingType content"]);
$user1 = $this->drupalCreateUser([
'access content',
"create $this->referencingType content",
]);
$this->drupalLogin($user1);
$test_file = current($this->getTestFiles('text'));

View File

@ -59,7 +59,11 @@ class EntityReferenceIntegrationTest extends BrowserTestBase {
parent::setUp();
// Create a test user.
$web_user = $this->drupalCreateUser(['administer entity_test content', 'administer entity_test fields', 'view test entity']);
$web_user = $this->drupalCreateUser([
'administer entity_test content',
'administer entity_test fields',
'view test entity',
]);
$this->drupalLogin($web_user);
}

View File

@ -35,7 +35,10 @@ class FieldHelpTest extends BrowserTestBase {
parent::setUp();
// Create the admin user.
$this->adminUser = $this->drupalCreateUser(['access administration pages', 'view the administration theme']);
$this->adminUser = $this->drupalCreateUser([
'access administration pages',
'view the administration theme',
]);
}
/**

View File

@ -69,7 +69,10 @@ class FormTest extends FieldTestBase {
protected function setUp() {
parent::setUp();
$web_user = $this->drupalCreateUser(['view test entity', 'administer entity_test content']);
$web_user = $this->drupalCreateUser([
'view test entity',
'administer entity_test content',
]);
$this->drupalLogin($web_user);
$this->fieldStorageSingle = [

View File

@ -28,7 +28,10 @@ class NestedFormTest extends FieldTestBase {
protected function setUp() {
parent::setUp();
$web_user = $this->drupalCreateUser(['view test entity', 'administer entity_test content']);
$web_user = $this->drupalCreateUser([
'view test entity',
'administer entity_test content',
]);
$this->drupalLogin($web_user);
$this->fieldStorageSingle = [

View File

@ -96,7 +96,10 @@ class ReEnableModuleFieldTest extends BrowserTestBase {
// Test that the module can't be uninstalled from the UI while there is data
// for its fields.
$admin_user = $this->drupalCreateUser(['access administration pages', 'administer modules']);
$admin_user = $this->drupalCreateUser([
'access administration pages',
'administer modules',
]);
$this->drupalLogin($admin_user);
$this->drupalGet('admin/modules/uninstall');
$this->assertText("The Telephone number field type is used in the following field: node.field_telephone");

View File

@ -37,7 +37,11 @@ class StringFieldTest extends BrowserTestBase {
protected function setUp() {
parent::setUp();
$this->webUser = $this->drupalCreateUser(['view test entity', 'administer entity_test content', 'access content']);
$this->webUser = $this->drupalCreateUser([
'view test entity',
'administer entity_test content',
'access content',
]);
$this->drupalLogin($this->webUser);
}

View File

@ -92,7 +92,10 @@ class TranslationWebTest extends FieldTestBase {
* Tests field translations when creating a new revision.
*/
public function testFieldFormTranslationRevisions() {
$web_user = $this->drupalCreateUser(['view test entity', 'administer entity_test content']);
$web_user = $this->drupalCreateUser([
'view test entity',
'administer entity_test content',
]);
$this->drupalLogin($web_user);
// Prepare the field translations.

View File

@ -54,7 +54,17 @@ class FieldUIDeleteTest extends BrowserTestBase {
$this->drupalPlaceBlock('page_title_block');
// Create a test user.
$admin_user = $this->drupalCreateUser(['access content', 'administer content types', 'administer node fields', 'administer node form display', 'administer node display', 'administer users', 'administer account settings', 'administer user display', 'bypass node access']);
$admin_user = $this->drupalCreateUser([
'access content',
'administer content types',
'administer node fields',
'administer node form display',
'administer node display',
'administer users',
'administer account settings',
'administer user display',
'bypass node access',
]);
$this->drupalLogin($admin_user);
}

View File

@ -30,7 +30,11 @@ class FieldUIIndentationTest extends BrowserTestBase {
parent::setUp();
// Create a test user.
$admin_user = $this->drupalCreateUser(['access content', 'administer content types', 'administer node display']);
$admin_user = $this->drupalCreateUser([
'access content',
'administer content types',
'administer node display',
]);
$this->drupalLogin($admin_user);
// Create Basic page node type.

View File

@ -49,7 +49,20 @@ class ManageDisplayTest extends BrowserTestBase {
$this->drupalPlaceBlock('local_tasks_block');
// Create a test user.
$admin_user = $this->drupalCreateUser(['access content', 'administer content types', 'administer node fields', 'administer node form display', 'administer node display', 'administer taxonomy', 'administer taxonomy_term fields', 'administer taxonomy_term display', 'administer users', 'administer account settings', 'administer user display', 'bypass node access']);
$admin_user = $this->drupalCreateUser([
'access content',
'administer content types',
'administer node fields',
'administer node form display',
'administer node display',
'administer taxonomy',
'administer taxonomy_term fields',
'administer taxonomy_term display',
'administer users',
'administer account settings',
'administer user display',
'bypass node access',
]);
$this->drupalLogin($admin_user);
// Create content type, with underscores.

View File

@ -81,7 +81,20 @@ class ManageFieldsFunctionalTest extends BrowserTestBase {
$this->drupalPlaceBlock('page_title_block');
// Create a test user.
$admin_user = $this->drupalCreateUser(['access content', 'administer content types', 'administer node fields', 'administer node form display', 'administer node display', 'administer taxonomy', 'administer taxonomy_term fields', 'administer taxonomy_term display', 'administer users', 'administer account settings', 'administer user display', 'bypass node access']);
$admin_user = $this->drupalCreateUser([
'access content',
'administer content types',
'administer node fields',
'administer node form display',
'administer node display',
'administer taxonomy',
'administer taxonomy_term fields',
'administer taxonomy_term display',
'administer users',
'administer account settings',
'administer user display',
'bypass node access',
]);
$this->drupalLogin($admin_user);
// Create content type, with underscores.

View File

@ -51,7 +51,17 @@ class ManageDisplayTest extends WebDriverTestBase {
$this->drupalPlaceBlock('system_breadcrumb_block');
// Create a test user.
$admin_user = $this->drupalCreateUser(['access content', 'administer content types', 'administer node fields', 'administer node form display', 'administer node display', 'administer users', 'administer account settings', 'administer user display', 'bypass node access']);
$admin_user = $this->drupalCreateUser([
'access content',
'administer content types',
'administer node fields',
'administer node form display',
'administer node display',
'administer users',
'administer account settings',
'administer user display',
'bypass node access',
]);
$this->drupalLogin($admin_user);
// Create content type, with underscores.

View File

@ -46,7 +46,18 @@ abstract class FileFieldTestBase extends BrowserTestBase {
*/
protected function setUp() {
parent::setUp();
$this->adminUser = $this->drupalCreateUser(['access content', 'access administration pages', 'administer site configuration', 'administer users', 'administer permissions', 'administer content types', 'administer node fields', 'administer node display', 'administer nodes', 'bypass node access']);
$this->adminUser = $this->drupalCreateUser([
'access content',
'access administration pages',
'administer site configuration',
'administer users',
'administer permissions',
'administer content types',
'administer node fields',
'administer node display',
'administer nodes',
'bypass node access',
]);
$this->drupalLogin($this->adminUser);
$this->drupalCreateContentType(['type' => 'article', 'name' => 'Article']);
}

View File

@ -40,7 +40,10 @@ class FileListingTest extends FileFieldTestBase {
->set('make_unused_managed_files_temporary', TRUE)
->save();
$this->adminUser = $this->drupalCreateUser(['access files overview', 'bypass node access']);
$this->adminUser = $this->drupalCreateUser([
'access files overview',
'bypass node access',
]);
$this->baseUser = $this->drupalCreateUser();
$this->createFileField('file', 'node', 'article', [], ['file_extensions' => 'txt png']);
}

View File

@ -42,7 +42,18 @@ class FileFieldWidgetTest extends WebDriverTestBase {
*/
protected function setUp() {
parent::setUp();
$this->adminUser = $this->drupalCreateUser(['access content', 'access administration pages', 'administer site configuration', 'administer users', 'administer permissions', 'administer content types', 'administer node fields', 'administer node display', 'administer nodes', 'bypass node access']);
$this->adminUser = $this->drupalCreateUser([
'access content',
'access administration pages',
'administer site configuration',
'administer users',
'administer permissions',
'administer content types',
'administer node fields',
'administer node display',
'administer nodes',
'bypass node access',
]);
$this->drupalLogin($this->adminUser);
$this->drupalCreateContentType(['type' => 'article', 'name' => 'Article']);
}

View File

@ -33,7 +33,18 @@ class FileManagedFileElementTest extends WebDriverTestBase {
*/
protected function setUp() {
parent::setUp();
$this->adminUser = $this->drupalCreateUser(['access content', 'access administration pages', 'administer site configuration', 'administer users', 'administer permissions', 'administer content types', 'administer node fields', 'administer node display', 'administer nodes', 'bypass node access']);
$this->adminUser = $this->drupalCreateUser([
'access content',
'access administration pages',
'administer site configuration',
'administer users',
'administer permissions',
'administer content types',
'administer node fields',
'administer node display',
'administer nodes',
'bypass node access',
]);
$this->drupalLogin($this->adminUser);
$this->drupalCreateContentType(['type' => 'article', 'name' => 'Article']);
}

View File

@ -111,7 +111,10 @@ class FilterAdminTest extends BrowserTestBase {
'access site reports',
]);
$this->webUser = $this->drupalCreateUser(['create page content', 'edit own page content']);
$this->webUser = $this->drupalCreateUser([
'create page content',
'edit own page content',
]);
user_role_grant_permissions('authenticated', [$basic_html_format->getPermissionName()]);
user_role_grant_permissions('anonymous', [$restricted_html_format->getPermissionName()]);
$this->drupalLogin($this->adminUser);

View File

@ -44,7 +44,10 @@ class FilterDefaultFormatTest extends BrowserTestBase {
}
list($first_format, $second_format) = $formats;
$second_format_permission = $second_format->getPermissionName();
$first_user = $this->drupalCreateUser([$first_format->getPermissionName(), $second_format_permission]);
$first_user = $this->drupalCreateUser([
$first_format->getPermissionName(),
$second_format_permission,
]);
$second_user = $this->drupalCreateUser([$second_format_permission]);
// Adjust the weights so that the first and second formats (in that order)

View File

@ -36,7 +36,11 @@ class FilterHooksTest extends BrowserTestBase {
$type = $this->drupalCreateContentType(['name' => $type_name, 'type' => $type_name]);
$node_permission = "create $type_name content";
$admin_user = $this->drupalCreateUser(['administer filters', 'administer nodes', $node_permission]);
$admin_user = $this->drupalCreateUser([
'administer filters',
'administer nodes',
$node_permission,
]);
$this->drupalLogin($admin_user);
// Add a text format.

View File

@ -46,7 +46,11 @@ class FilterSecurityTest extends BrowserTestBase {
$filtered_html_permission = $filtered_html_format->getPermissionName();
user_role_grant_permissions(RoleInterface::ANONYMOUS_ID, [$filtered_html_permission]);
$this->adminUser = $this->drupalCreateUser(['administer modules', 'administer filters', 'administer site configuration']);
$this->adminUser = $this->drupalCreateUser([
'administer modules',
'administer filters',
'administer site configuration',
]);
$this->drupalLogin($this->adminUser);
}

View File

@ -27,7 +27,13 @@ class ForumIndexTest extends BrowserTestBase {
parent::setUp();
// Create a test user.
$web_user = $this->drupalCreateUser(['create forum content', 'edit own forum content', 'edit any forum content', 'administer nodes', 'administer forums']);
$web_user = $this->drupalCreateUser([
'create forum content',
'edit own forum content',
'edit any forum content',
'administer nodes',
'administer forums',
]);
$this->drupalLogin($web_user);
}

View File

@ -49,7 +49,12 @@ class ForumNodeAccessTest extends BrowserTestBase {
// Create some users.
$access_user = $this->drupalCreateUser(['node test view']);
$no_access_user = $this->drupalCreateUser();
$admin_user = $this->drupalCreateUser(['access administration pages', 'administer modules', 'administer blocks', 'create forum content']);
$admin_user = $this->drupalCreateUser([
'access administration pages',
'administer modules',
'administer blocks',
'create forum content',
]);
$this->drupalLogin($admin_user);

View File

@ -224,7 +224,11 @@ class ForumTest extends BrowserTestBase {
$this->assertEquals('6', $elements[0]->getText(), 'Number of posts found.');
// Test loading multiple forum nodes on the front page.
$this->drupalLogin($this->drupalCreateUser(['administer content types', 'create forum content', 'post comments']));
$this->drupalLogin($this->drupalCreateUser([
'administer content types',
'create forum content',
'post comments',
]));
$this->drupalPostForm('admin/structure/types/manage/forum', ['options[promote]' => 'promote'], t('Save content type'));
$this->createForumTopic($this->forum, FALSE);
$this->createForumTopic($this->forum, FALSE);

View File

@ -32,7 +32,13 @@ class ForumUninstallTest extends BrowserTestBase {
* Tests if forum module uninstallation properly deletes the field.
*/
public function testForumUninstallWithField() {
$this->drupalLogin($this->drupalCreateUser(['administer taxonomy', 'administer nodes', 'administer modules', 'delete any forum content', 'administer content types']));
$this->drupalLogin($this->drupalCreateUser([
'administer taxonomy',
'administer nodes',
'administer modules',
'delete any forum content',
'administer content types',
]));
// Ensure that the field exists before uninstallation.
$field_storage = FieldStorageConfig::loadByName('node', 'taxonomy_forums');
$this->assertNotNull($field_storage, 'The taxonomy_forums field storage exists.');

View File

@ -49,7 +49,11 @@ class HelpTest extends BrowserTestBase {
parent::setUp();
// Create users.
$this->adminUser = $this->drupalCreateUser(['access administration pages', 'view the administration theme', 'administer permissions']);
$this->adminUser = $this->drupalCreateUser([
'access administration pages',
'view the administration theme',
'administer permissions',
]);
$this->anyUser = $this->drupalCreateUser([]);
}

View File

@ -47,7 +47,10 @@ class HistoryTest extends BrowserTestBase {
$this->drupalCreateContentType(['type' => 'page', 'name' => 'Basic page']);
$this->user = $this->drupalCreateUser(['create page content', 'access content']);
$this->user = $this->drupalCreateUser([
'create page content',
'access content',
]);
$this->drupalLogin($this->user);
$this->testNode = $this->drupalCreateNode(['type' => 'page', 'uid' => $this->user->id()]);
}

View File

@ -49,7 +49,19 @@ abstract class ImageFieldTestBase extends BrowserTestBase {
$this->drupalCreateContentType(['type' => 'article', 'name' => 'Article']);
}
$this->adminUser = $this->drupalCreateUser(['access content', 'access administration pages', 'administer site configuration', 'administer content types', 'administer node fields', 'administer nodes', 'create article content', 'edit any article content', 'delete any article content', 'administer image styles', 'administer node display']);
$this->adminUser = $this->drupalCreateUser([
'access content',
'access administration pages',
'administer site configuration',
'administer content types',
'administer node fields',
'administer nodes',
'create article content',
'edit any article content',
'delete any article content',
'administer image styles',
'administer node display',
]);
$this->drupalLogin($this->adminUser);
}

View File

@ -1029,7 +1029,10 @@ class JsonApiRegressionTest extends JsonApiFunctionalTestBase {
$this->assertInstanceOf(TranslatableInterface::class, $entity);
$this->assertFalse($entity->isTranslatable());
// Set up a test user with permission to view and update the test entity.
$user = $this->drupalCreateUser(['view test entity', 'administer entity_test content']);
$user = $this->drupalCreateUser([
'view test entity',
'administer entity_test content',
]);
$request_options[RequestOptions::HEADERS]['Accept'] = 'application/vnd.api+json';
$request_options[RequestOptions::AUTH] = [
$user->getAccountName(),

View File

@ -19,7 +19,11 @@ class LanguageBlockSettingsVisibilityTest extends BrowserTestBase {
protected $defaultTheme = 'stark';
public function testUnnecessaryLanguageSettingsVisibility() {
$admin_user = $this->drupalCreateUser(['administer languages', 'access administration pages', 'administer blocks']);
$admin_user = $this->drupalCreateUser([
'administer languages',
'access administration pages',
'administer blocks',
]);
$this->drupalLogin($admin_user);
$this->drupalPostForm('admin/config/regional/language/add', ['predefined_langcode' => 'hu'], t('Add language'));
$this->drupalGet('admin/structure/block/add/system_menu_block:admin/stark');

View File

@ -25,7 +25,10 @@ class LanguageBrowserDetectionTest extends BrowserTestBase {
*/
public function testUIBrowserLanguageMappings() {
// User to manage languages.
$admin_user = $this->drupalCreateUser(['administer languages', 'access administration pages']);
$admin_user = $this->drupalCreateUser([
'administer languages',
'access administration pages',
]);
$this->drupalLogin($admin_user);
// Check that the configure link exists.

View File

@ -35,7 +35,11 @@ class LanguageConfigurationElementTest extends BrowserTestBase {
protected function setUp() {
parent::setUp();
$user = $this->drupalCreateUser(['access administration pages', 'administer languages', 'administer content types']);
$user = $this->drupalCreateUser([
'access administration pages',
'administer languages',
'administer content types',
]);
$this->drupalLogin($user);
}

View File

@ -36,7 +36,10 @@ class LanguageConfigurationTest extends BrowserTestBase {
$this->assertEqual(ConfigurableLanguage::load('en')->getWeight(), 0, 'The English language has a weight of 0.');
// User to add and remove language.
$admin_user = $this->drupalCreateUser(['administer languages', 'access administration pages']);
$admin_user = $this->drupalCreateUser([
'administer languages',
'access administration pages',
]);
$this->drupalLogin($admin_user);
// Check if the Default English language has no path prefix.
@ -157,7 +160,10 @@ class LanguageConfigurationTest extends BrowserTestBase {
*/
public function testLanguageConfigurationWeight() {
// User to add and remove language.
$admin_user = $this->drupalCreateUser(['administer languages', 'access administration pages']);
$admin_user = $this->drupalCreateUser([
'administer languages',
'access administration pages',
]);
$this->drupalLogin($admin_user);
$this->checkConfigurableLanguageWeight();

View File

@ -32,7 +32,10 @@ class LanguageCustomLanguageConfigurationTest extends BrowserTestBase {
public function testLanguageConfiguration() {
// Create user with permissions to add and remove languages.
$admin_user = $this->drupalCreateUser(['administer languages', 'access administration pages']);
$admin_user = $this->drupalCreateUser([
'administer languages',
'access administration pages',
]);
$this->drupalLogin($admin_user);
// Add custom language.

View File

@ -30,7 +30,10 @@ class LanguageListModuleInstallTest extends BrowserTestBase {
public function testModuleInstallLanguageList() {
// Since LanguageManager::getLanguages() uses static caches we need to do
// this by enabling the module using the UI.
$admin_user = $this->drupalCreateUser(['access administration pages', 'administer modules']);
$admin_user = $this->drupalCreateUser([
'access administration pages',
'administer modules',
]);
$this->drupalLogin($admin_user);
$edit = [];
$edit['modules[language][enable]'] = 'language';

View File

@ -33,7 +33,10 @@ class LanguageListTest extends BrowserTestBase {
public function testLanguageList() {
// User to add and remove language.
$admin_user = $this->drupalCreateUser(['administer languages', 'access administration pages']);
$admin_user = $this->drupalCreateUser([
'administer languages',
'access administration pages',
]);
$this->drupalLogin($admin_user);
// Get the weight of the last language.

View File

@ -38,7 +38,10 @@ class LanguageLocaleListTest extends BrowserTestBase {
*/
public function testLanguageLocaleList() {
// User to add and remove language.
$admin_user = $this->drupalCreateUser(['administer languages', 'access administration pages']);
$admin_user = $this->drupalCreateUser([
'administer languages',
'access administration pages',
]);
$this->drupalLogin($admin_user);
// Add predefined language.

View File

@ -31,7 +31,12 @@ class LanguageNegotiationInfoTest extends BrowserTestBase {
*/
protected function setUp() {
parent::setUp();
$admin_user = $this->drupalCreateUser(['administer languages', 'access administration pages', 'view the administration theme', 'administer modules']);
$admin_user = $this->drupalCreateUser([
'administer languages',
'access administration pages',
'view the administration theme',
'administer modules',
]);
$this->drupalLogin($admin_user);
$this->drupalPostForm('admin/config/regional/language/add', ['predefined_langcode' => 'it'], t('Add language'));
}

View File

@ -27,7 +27,11 @@ class LanguagePathMonolingualTest extends BrowserTestBase {
parent::setUp();
// Create and log in user.
$web_user = $this->drupalCreateUser(['administer languages', 'access administration pages', 'administer site configuration']);
$web_user = $this->drupalCreateUser([
'administer languages',
'access administration pages',
'administer site configuration',
]);
$this->drupalLogin($web_user);
// Enable French language.

View File

@ -38,7 +38,11 @@ class LanguageSwitchingTest extends BrowserTestBase {
parent::setUp();
// Create and log in user.
$admin_user = $this->drupalCreateUser(['administer blocks', 'administer languages', 'access administration pages']);
$admin_user = $this->drupalCreateUser([
'administer blocks',
'administer languages',
'access administration pages',
]);
$this->drupalLogin($admin_user);
}

View File

@ -35,7 +35,10 @@ class LanguageTourTest extends TourTestBase {
*/
protected function setUp() {
parent::setUp();
$this->adminUser = $this->drupalCreateUser(['administer languages', 'access tour']);
$this->adminUser = $this->drupalCreateUser([
'administer languages',
'access tour',
]);
$this->drupalLogin($this->adminUser);
$this->drupalPlaceBlock('local_actions_block');
}

View File

@ -74,7 +74,12 @@ class LanguageUILanguageNegotiationTest extends BrowserTestBase {
protected function setUp() {
parent::setUp();
$this->adminUser = $this->drupalCreateUser(['administer languages', 'translate interface', 'access administration pages', 'administer blocks']);
$this->adminUser = $this->drupalCreateUser([
'administer languages',
'translate interface',
'access administration pages',
'administer blocks',
]);
$this->drupalLogin($this->adminUser);
}

View File

@ -39,7 +39,10 @@ class LanguageUrlRewritingTest extends BrowserTestBase {
parent::setUp();
// Create and log in user.
$this->webUser = $this->drupalCreateUser(['administer languages', 'access administration pages']);
$this->webUser = $this->drupalCreateUser([
'administer languages',
'access administration pages',
]);
$this->drupalLogin($this->webUser);
// Install French language.

View File

@ -189,7 +189,12 @@ class LayoutBuilderAccessTest extends BrowserTestBase {
$this->drupalGet('user/' . $non_editable_user->id() . '/layout');
$this->assertExpectedAccess($non_editable_access);
$non_viewable_user = $this->drupalCreateUser([], 'bad person', FALSE, ['status' => 0]);
$non_viewable_user = $this->drupalCreateUser(
[],
'bad person',
FALSE,
['status' => 0]
);
$this->drupalGet($non_viewable_user->toUrl());
$this->assertExpectedAccess(FALSE);
$this->drupalGet($non_viewable_user->toUrl('edit-form'));

View File

@ -68,8 +68,14 @@ class LinkFieldUITest extends BrowserTestBase {
$this->firstContentType = $this->drupalCreateContentType();
$this->secondContentType = $this->drupalCreateContentType();
$this->adminUser = $this->drupalCreateUser(['administer content types', 'administer node fields', 'administer node display']);
$this->helpTextUser = $this->drupalCreateUser(['create ' . $this->secondContentType->id() . ' content']);
$this->adminUser = $this->drupalCreateUser([
'administer content types',
'administer node fields',
'administer node display',
]);
$this->helpTextUser = $this->drupalCreateUser([
'create ' . $this->secondContentType->id() . ' content',
]);
$this->drupalPlaceBlock('system_breadcrumb_block');
}

View File

@ -36,7 +36,13 @@ class LocaleConfigTranslationImportTest extends BrowserTestBase {
* Test update changes configuration translations if enabled after language.
*/
public function testConfigTranslationImport() {
$admin_user = $this->drupalCreateUser(['administer modules', 'administer site configuration', 'administer languages', 'access administration pages', 'administer permissions']);
$admin_user = $this->drupalCreateUser([
'administer modules',
'administer site configuration',
'administer languages',
'access administration pages',
'administer permissions',
]);
$this->drupalLogin($admin_user);
// Add a language. The Afrikaans translation file of locale_test_translate
@ -90,7 +96,14 @@ class LocaleConfigTranslationImportTest extends BrowserTestBase {
// import. Test that this override is in place.
$this->assertFalse($this->config('locale.settings')->get('translation.import_enabled'), 'Translations imports are disabled by default in the Testing profile.');
$admin_user = $this->drupalCreateUser(['administer modules', 'administer site configuration', 'administer languages', 'access administration pages', 'administer permissions', 'translate configuration']);
$admin_user = $this->drupalCreateUser([
'administer modules',
'administer site configuration',
'administer languages',
'access administration pages',
'administer permissions',
'translate configuration',
]);
$this->drupalLogin($admin_user);
// Enable import of translations. By default this is disabled for automated
@ -149,7 +162,14 @@ class LocaleConfigTranslationImportTest extends BrowserTestBase {
$this->container->get('module_installer')->install(['locale']);
$this->resetAll();
$admin_user = $this->drupalCreateUser(['administer modules', 'administer site configuration', 'administer languages', 'access administration pages', 'administer permissions', 'translate interface']);
$admin_user = $this->drupalCreateUser([
'administer modules',
'administer site configuration',
'administer languages',
'access administration pages',
'administer permissions',
'translate interface',
]);
$this->drupalLogin($admin_user);
// Enable import of translations. By default this is disabled for automated
@ -187,7 +207,14 @@ class LocaleConfigTranslationImportTest extends BrowserTestBase {
$this->container->get('module_installer')->install(['locale']);
$this->resetAll();
$admin_user = $this->drupalCreateUser(['administer modules', 'administer site configuration', 'administer languages', 'access administration pages', 'administer permissions', 'translate interface']);
$admin_user = $this->drupalCreateUser([
'administer modules',
'administer site configuration',
'administer languages',
'access administration pages',
'administer permissions',
'translate interface',
]);
$this->drupalLogin($admin_user);
// Enable import of translations. By default this is disabled for automated

View File

@ -48,7 +48,15 @@ class LocaleConfigTranslationTest extends BrowserTestBase {
// Add custom language.
$this->langcode = 'xx';
$admin_user = $this->drupalCreateUser(['administer languages', 'access administration pages', 'translate interface', 'administer modules', 'access site-wide contact form', 'administer contact forms', 'administer site configuration']);
$admin_user = $this->drupalCreateUser([
'administer languages',
'access administration pages',
'translate interface',
'administer modules',
'access site-wide contact form',
'administer contact forms',
'administer site configuration',
]);
$this->drupalLogin($admin_user);
$name = $this->randomMachineName(16);
$edit = [

View File

@ -31,7 +31,12 @@ class LocaleContentTest extends BrowserTestBase {
*/
public function testMachineNameLTR() {
// User to add and remove language.
$admin_user = $this->drupalCreateUser(['administer languages', 'administer content types', 'access administration pages', 'administer site configuration']);
$admin_user = $this->drupalCreateUser([
'administer languages',
'administer content types',
'access administration pages',
'administer site configuration',
]);
// Log in as admin.
$this->drupalLogin($admin_user);
@ -63,9 +68,17 @@ class LocaleContentTest extends BrowserTestBase {
$type2 = $this->drupalCreateContentType();
// User to add and remove language.
$admin_user = $this->drupalCreateUser(['administer languages', 'administer content types', 'access administration pages']);
$admin_user = $this->drupalCreateUser([
'administer languages',
'administer content types',
'access administration pages',
]);
// User to create a node.
$web_user = $this->drupalCreateUser(["create {$type1->id()} content", "create {$type2->id()} content", "edit any {$type2->id()} content"]);
$web_user = $this->drupalCreateUser([
"create {$type1->id()} content",
"create {$type2->id()} content",
"edit any {$type2->id()} content",
]);
// Add custom language.
$this->drupalLogin($admin_user);
@ -140,9 +153,16 @@ class LocaleContentTest extends BrowserTestBase {
$type = $this->drupalCreateContentType();
// User to add and remove language.
$admin_user = $this->drupalCreateUser(['administer languages', 'administer content types', 'access administration pages']);
$admin_user = $this->drupalCreateUser([
'administer languages',
'administer content types',
'access administration pages',
]);
// User to create a node.
$web_user = $this->drupalCreateUser(["create {$type->id()} content", "edit own {$type->id()} content"]);
$web_user = $this->drupalCreateUser([
"create {$type->id()} content",
"edit own {$type->id()} content",
]);
// Log in as admin.
$this->drupalLogin($admin_user);

View File

@ -35,7 +35,11 @@ class LocaleExportTest extends BrowserTestBase {
protected function setUp() {
parent::setUp();
$this->adminUser = $this->drupalCreateUser(['administer languages', 'translate interface', 'access administration pages']);
$this->adminUser = $this->drupalCreateUser([
'administer languages',
'translate interface',
'access administration pages',
]);
$this->drupalLogin($this->adminUser);
// Copy test po files to the translations directory.

View File

@ -55,8 +55,17 @@ class LocaleImportFunctionalTest extends BrowserTestBase {
$file_system->copy(__DIR__ . '/../../../tests/test.de.po', 'translations://', FileSystemInterface::EXISTS_REPLACE);
$file_system->copy(__DIR__ . '/../../../tests/test.xx.po', 'translations://', FileSystemInterface::EXISTS_REPLACE);
$this->adminUser = $this->drupalCreateUser(['administer languages', 'translate interface', 'access administration pages']);
$this->adminUserAccessSiteReports = $this->drupalCreateUser(['administer languages', 'translate interface', 'access administration pages', 'access site reports']);
$this->adminUser = $this->drupalCreateUser([
'administer languages',
'translate interface',
'access administration pages',
]);
$this->adminUserAccessSiteReports = $this->drupalCreateUser([
'administer languages',
'translate interface',
'access administration pages',
'access site reports',
]);
$this->drupalLogin($this->adminUser);
// Enable import of translations. By default this is disabled for automated

View File

@ -116,7 +116,11 @@ class LocaleJavascriptTranslationTest extends BrowserTestBase {
*/
public function testLocaleTranslationJsDependencies() {
// User to add and remove language.
$admin_user = $this->drupalCreateUser(['administer languages', 'access administration pages', 'translate interface']);
$admin_user = $this->drupalCreateUser([
'administer languages',
'access administration pages',
'translate interface',
]);
// Add custom language.
$this->drupalLogin($admin_user);

View File

@ -44,7 +44,14 @@ class LocalePathTest extends BrowserTestBase {
*/
public function testPathLanguageConfiguration() {
// User to add and remove language.
$admin_user = $this->drupalCreateUser(['administer languages', 'create page content', 'administer url aliases', 'create url aliases', 'access administration pages', 'access content overview']);
$admin_user = $this->drupalCreateUser([
'administer languages',
'create page content',
'administer url aliases',
'create url aliases',
'access administration pages',
'access content overview',
]);
// Add custom language.
$this->drupalLogin($admin_user);

View File

@ -39,7 +39,11 @@ class LocalePluralFormatTest extends BrowserTestBase {
protected function setUp() {
parent::setUp();
$this->adminUser = $this->drupalCreateUser(['administer languages', 'translate interface', 'access administration pages']);
$this->adminUser = $this->drupalCreateUser([
'administer languages',
'translate interface',
'access administration pages',
]);
$this->drupalLogin($this->adminUser);
}

Some files were not shown because too many files have changed in this diff Show More