Commit b1f378f5 authored by alexpott's avatar alexpott

Issue #2394421 by hussainweb: Clean-up filter module test members - ensure...

Issue #2394421 by hussainweb: Clean-up filter module test members - ensure property definition and use of camelCase naming convention
parent cd880e62
......@@ -23,6 +23,20 @@ class FilterAdminTest extends WebTestBase {
*/
public static $modules = array('filter', 'node');
/**
* An user with administration permissions.
*
* @var \Drupal\user\UserInterface
*/
protected $adminUser;
/**
* An user with permissions to create pages.
*
* @var \Drupal\user\UserInterface
*/
protected $webUser;
/**
* {@inheritdoc}
*/
......@@ -79,17 +93,17 @@ protected function setUp() {
));
$full_html_format->save();
$this->admin_user = $this->drupalCreateUser(array(
$this->adminUser = $this->drupalCreateUser(array(
'administer filters',
$basic_html_format->getPermissionName(),
$restricted_html_format->getPermissionName(),
$full_html_format->getPermissionName(),
));
$this->web_user = $this->drupalCreateUser(array('create page content', 'edit own page content'));
$this->webUser = $this->drupalCreateUser(array('create page content', 'edit own page content'));
user_role_grant_permissions('authenticated', array($basic_html_format->getPermissionName()));
user_role_grant_permissions('anonymous', array($restricted_html_format->getPermissionName()));
$this->drupalLogin($this->admin_user);
$this->drupalLogin($this->adminUser);
}
/**
......@@ -188,8 +202,8 @@ function testFilterAdmin() {
// Verify access permissions to Full HTML format.
$full_format = entity_load('filter_format', $full);
$this->assertTrue($full_format->access('use', $this->admin_user), 'Admin user may use Full HTML.');
$this->assertFalse($full_format->access('use', $this->web_user), 'Web user may not use Full HTML.');
$this->assertTrue($full_format->access('use', $this->adminUser), 'Admin user may use Full HTML.');
$this->assertFalse($full_format->access('use', $this->webUser), 'Web user may not use Full HTML.');
// Add an additional tag.
$edit = array();
......@@ -264,7 +278,7 @@ function testFilterAdmin() {
$this->assertRaw(t('The text format %format has been updated.', array('%format' => $format->label())), 'Full HTML format successfully updated.');
// Switch user.
$this->drupalLogin($this->web_user);
$this->drupalLogin($this->webUser);
$this->drupalGet('node/add/page');
$this->assertRaw('<option value="' . $full . '">Full HTML</option>', 'Full HTML filter accessible.');
......@@ -303,7 +317,7 @@ function testFilterAdmin() {
->save();
// Switch user.
$this->drupalLogin($this->admin_user);
$this->drupalLogin($this->adminUser);
// Clean up.
// Allowed tags.
......
......@@ -24,6 +24,13 @@ class FilterHtmlImageSecureTest extends WebTestBase {
*/
public static $modules = array('filter', 'node', 'comment');
/**
* An authenticated user.
*
* @var \Drupal\user\UserInterface
*/
protected $webUser;
protected function setUp() {
parent::setUp();
......@@ -49,14 +56,14 @@ protected function setUp() {
$filtered_html_format->save();
// Setup users.
$this->web_user = $this->drupalCreateUser(array(
$this->webUser = $this->drupalCreateUser(array(
'access content',
'access comments',
'post comments',
'skip comment approval',
$filtered_html_format->getPermissionName(),
));
$this->drupalLogin($this->web_user);
$this->drupalLogin($this->webUser);
// Setup a node to comment and test on.
$this->drupalCreateContentType(array('type' => 'page', 'name' => 'Basic page'));
......
......@@ -29,9 +29,9 @@ class FilterSecurityTest extends WebTestBase {
/**
* A user with administrative permissions.
*
* @var object
* @var \Drupal\user\UserInterface
*/
protected $admin_user;
protected $adminUser;
protected function setUp() {
parent::setUp();
......@@ -44,8 +44,8 @@ protected function setUp() {
$filtered_html_permission = $filtered_html_format->getPermissionName();
user_role_grant_permissions(DRUPAL_ANONYMOUS_RID, array($filtered_html_permission));
$this->admin_user = $this->drupalCreateUser(array('administer modules', 'administer filters', 'administer site configuration'));
$this->drupalLogin($this->admin_user);
$this->adminUser = $this->drupalCreateUser(array('administer modules', 'administer filters', 'administer site configuration'));
$this->drupalLogin($this->adminUser);
}
/**
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment