From 9fd145fcb39d40ed4abc6b5dc10ff030eb9fbac9 Mon Sep 17 00:00:00 2001 From: Alex Pott <alex.a.pott@googlemail.com> Date: Thu, 15 Jan 2015 11:39:48 +0000 Subject: [PATCH] Issue #2396687 by hussainweb: Clean-up image module test members - ensure property definition and use of camelCase naming convention --- .../modules/image/src/Tests/ImageFieldDisplayTest.php | 4 ++-- core/modules/image/src/Tests/ImageFieldTestBase.php | 11 ++++++++--- .../src/Tests/ResponsiveImageFieldDisplayTest.php | 6 +++--- 3 files changed, 13 insertions(+), 8 deletions(-) diff --git a/core/modules/image/src/Tests/ImageFieldDisplayTest.php b/core/modules/image/src/Tests/ImageFieldDisplayTest.php index fc6854b6f2ef..f0b04cbfdef8 100644 --- a/core/modules/image/src/Tests/ImageFieldDisplayTest.php +++ b/core/modules/image/src/Tests/ImageFieldDisplayTest.php @@ -58,7 +58,7 @@ function _testImageFieldFormatters($scheme) { $this->assertLinkByHref(\Drupal::url('image.style_list'), 0, 'Link to image styles configuration is found'); // Remove 'administer image styles' permission from testing admin user. - $admin_user_roles = $this->admin_user->getRoles(TRUE); + $admin_user_roles = $this->adminUser->getRoles(TRUE); user_role_change_permissions(reset($admin_user_roles), array('administer image styles' => FALSE)); // Go to manage display page again. @@ -127,7 +127,7 @@ function _testImageFieldFormatters($scheme) { $this->assertResponse('403', 'Access denied to original image as anonymous user.'); // Log in again. - $this->drupalLogin($this->admin_user); + $this->drupalLogin($this->adminUser); } // Test the image linked to content formatter. diff --git a/core/modules/image/src/Tests/ImageFieldTestBase.php b/core/modules/image/src/Tests/ImageFieldTestBase.php index 2b8a648fc2dc..d8bee126dc58 100644 --- a/core/modules/image/src/Tests/ImageFieldTestBase.php +++ b/core/modules/image/src/Tests/ImageFieldTestBase.php @@ -34,7 +34,12 @@ abstract class ImageFieldTestBase extends WebTestBase { */ public static $modules = array('node', 'image', 'field_ui', 'image_module_test'); - protected $admin_user; + /** + * An user with permissions to administer content types and image styles. + * + * @var \Drupal\user\UserInterface + */ + protected $adminUser; protected function setUp() { parent::setUp(); @@ -45,8 +50,8 @@ protected function setUp() { $this->drupalCreateContentType(array('type' => 'article', 'name' => 'Article')); } - $this->admin_user = $this->drupalCreateUser(array('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->admin_user); + $this->adminUser = $this->drupalCreateUser(array('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); } /** diff --git a/core/modules/responsive_image/src/Tests/ResponsiveImageFieldDisplayTest.php b/core/modules/responsive_image/src/Tests/ResponsiveImageFieldDisplayTest.php index 09efc576b1e7..b09a9e5f87e8 100644 --- a/core/modules/responsive_image/src/Tests/ResponsiveImageFieldDisplayTest.php +++ b/core/modules/responsive_image/src/Tests/ResponsiveImageFieldDisplayTest.php @@ -40,7 +40,7 @@ protected function setUp() { parent::setUp(); // Create user. - $this->admin_user = $this->drupalCreateUser(array( + $this->adminUser = $this->drupalCreateUser(array( 'administer responsive images', 'access content', 'access administration pages', @@ -53,7 +53,7 @@ protected function setUp() { 'delete any article content', 'administer image styles' )); - $this->drupalLogin($this->admin_user); + $this->drupalLogin($this->adminUser); // Add responsive image mapping. $this->responsiveImgMapping = entity_create('responsive_image_mapping', array( 'id' => 'mapping_one', @@ -180,7 +180,7 @@ protected function doTestResponsiveImageFieldFormatters($scheme, $empty_styles = $this->assertResponse('403', 'Access denied to original image as anonymous user.'); // Log in again. - $this->drupalLogin($this->admin_user); + $this->drupalLogin($this->adminUser); } // Use the responsive image formatter with a responsive image mapping. -- GitLab