Commit 09b496ec authored by alexpott's avatar alexpott

Issue #2380023 by tibbsa, subhojit777, rpayanm: Clean-up Comment module Test...

Issue #2380023 by tibbsa, subhojit777, rpayanm: Clean-up Comment module Test members - ensure property definition and use of camelCase naming convention
parent 0fd38d53
......@@ -27,7 +27,7 @@ class CommentActionsTest extends CommentTestBase {
* Tests comment publish and unpublish actions.
*/
function testCommentPublishUnpublishActions() {
$this->drupalLogin($this->web_user);
$this->drupalLogin($this->webUser);
$comment_text = $this->randomMachineName();
$subject = $this->randomMachineName();
$comment = $this->postComment($this->node, $comment_text, $subject);
......@@ -47,7 +47,7 @@ function testCommentPublishUnpublishActions() {
* Tests the unpublish comment by keyword action.
*/
function testCommentUnpublishByKeyword() {
$this->drupalLogin($this->admin_user);
$this->drupalLogin($this->adminUser);
$keyword_1 = $this->randomMachineName();
$keyword_2 = $this->randomMachineName();
$action = entity_create('action', array(
......
......@@ -23,7 +23,7 @@ function testApprovalAdminInterface() {
'post comments' => TRUE,
'skip comment approval' => FALSE,
));
$this->drupalLogin($this->admin_user);
$this->drupalLogin($this->adminUser);
$this->setCommentAnonymous('0'); // Ensure that doesn't require contact info.
// Test that the comments page loads correctly when there are no comments
......@@ -39,7 +39,7 @@ function testApprovalAdminInterface() {
$this->assertText(t('Your comment has been queued for review by site administrators and will be published after approval.'), 'Comment requires approval.');
// Get unapproved comment id.
$this->drupalLogin($this->admin_user);
$this->drupalLogin($this->adminUser);
$anonymous_comment4 = $this->getUnapprovedComment($subject);
$anonymous_comment4 = entity_create('comment', array(
'cid' => $anonymous_comment4,
......@@ -54,7 +54,7 @@ function testApprovalAdminInterface() {
$this->assertFalse($this->commentExists($anonymous_comment4), 'Anonymous comment was not published.');
// Approve comment.
$this->drupalLogin($this->admin_user);
$this->drupalLogin($this->adminUser);
$this->performCommentOperation($anonymous_comment4, 'publish', TRUE);
$this->drupalLogout();
......@@ -66,7 +66,7 @@ function testApprovalAdminInterface() {
$comments[] = $this->postComment($this->node, $this->randomMachineName(), $this->randomMachineName(), TRUE);
// Publish multiple comments in one operation.
$this->drupalLogin($this->admin_user);
$this->drupalLogin($this->adminUser);
$this->drupalGet('admin/content/comment/approval');
$this->assertText(t('Unapproved comments (@count)', array('@count' => 2)), 'Two unapproved comments waiting for approval.');
$edit = array(
......@@ -105,7 +105,7 @@ function testApprovalNodeInterface() {
'post comments' => TRUE,
'skip comment approval' => FALSE,
));
$this->drupalLogin($this->admin_user);
$this->drupalLogin($this->adminUser);
$this->setCommentAnonymous('0'); // Ensure that doesn't require contact info.
$this->drupalLogout();
......@@ -116,7 +116,7 @@ function testApprovalNodeInterface() {
$this->assertText(t('Your comment has been queued for review by site administrators and will be published after approval.'), 'Comment requires approval.');
// Get unapproved comment id.
$this->drupalLogin($this->admin_user);
$this->drupalLogin($this->adminUser);
$anonymous_comment4 = $this->getUnapprovedComment($subject);
$anonymous_comment4 = entity_create('comment', array(
'cid' => $anonymous_comment4,
......@@ -131,7 +131,7 @@ function testApprovalNodeInterface() {
$this->assertFalse($this->commentExists($anonymous_comment4), 'Anonymous comment was not published.');
// Approve comment.
$this->drupalLogin($this->admin_user);
$this->drupalLogin($this->adminUser);
$this->drupalGet('comment/1/approve');
$this->assertResponse(403, 'Forged comment approval was denied.');
$this->drupalGet('comment/1/approve', array('query' => array('token' => 'forged')));
......@@ -151,7 +151,7 @@ function testApprovalNodeInterface() {
*/
public function testCommentAdmin() {
// Login.
$this->drupalLogin($this->admin_user);
$this->drupalLogin($this->adminUser);
// Browse to comment bundle overview.
$this->drupalGet('admin/structure/comment');
$this->assertResponse(200);
......
......@@ -34,7 +34,7 @@ protected function setUp() {
* Tests anonymous comment functionality.
*/
function testAnonymous() {
$this->drupalLogin($this->admin_user);
$this->drupalLogin($this->adminUser);
$this->setCommentAnonymous('0'); // Ensure that doesn't require contact info.
$this->drupalLogout();
......@@ -43,7 +43,7 @@ function testAnonymous() {
$this->assertTrue($this->commentExists($anonymous_comment1), 'Anonymous comment without contact info found.');
// Allow contact info.
$this->drupalLogin($this->admin_user);
$this->drupalLogin($this->adminUser);
$this->setCommentAnonymous('1');
// Attempt to edit anonymous comment.
......@@ -61,7 +61,7 @@ function testAnonymous() {
// Ensure anonymous users cannot post in the name of registered users.
$edit = array(
'name' => $this->admin_user->getUsername(),
'name' => $this->adminUser->getUsername(),
'mail' => $this->randomMachineName() . '@example.com',
'subject[0][value]' => $this->randomMachineName(),
'comment_body[0][value]' => $this->randomMachineName(),
......@@ -70,7 +70,7 @@ function testAnonymous() {
$this->assertText(t('The name you used belongs to a registered user.'));
// Require contact info.
$this->drupalLogin($this->admin_user);
$this->drupalLogin($this->adminUser);
$this->setCommentAnonymous('2');
$this->drupalLogout();
......@@ -90,7 +90,7 @@ function testAnonymous() {
$this->assertTrue($this->commentExists($anonymous_comment3), 'Anonymous comment with contact info (required) found.');
// Make sure the user data appears correctly when editing the comment.
$this->drupalLogin($this->admin_user);
$this->drupalLogin($this->adminUser);
$this->drupalGet('comment/' . $anonymous_comment3->id() . '/edit');
$this->assertRaw($author_name, "The anonymous user's name is correct when editing the comment.");
$this->assertRaw($author_mail, "The anonymous user's email address is correct when editing the comment.");
......
......@@ -25,7 +25,7 @@ class CommentBlockTest extends CommentTestBase {
protected function setUp() {
parent::setUp();
// Update admin user to have the 'administer blocks' permission.
$this->admin_user = $this->drupalCreateUser(array(
$this->adminUser = $this->drupalCreateUser(array(
'administer content types',
'administer comments',
'skip comment approval',
......@@ -40,7 +40,7 @@ protected function setUp() {
* Tests the recent comments block.
*/
function testRecentCommentBlock() {
$this->drupalLogin($this->admin_user);
$this->drupalLogin($this->adminUser);
$block = $this->drupalPlaceBlock('views_block:comments_recent-block_1');
// Add some test comments, with and without subjects. Because the 10 newest
......@@ -64,7 +64,7 @@ function testRecentCommentBlock() {
// Test that a user with the 'access comments' permission can see the
// block.
$this->drupalLogin($this->web_user);
$this->drupalLogin($this->webUser);
$this->drupalGet('');
$this->assertText(t('Recent comments'));
......
......@@ -33,8 +33,8 @@ protected function setUp() {
function testCommentClasses() {
// Create all permutations for comments, users, and nodes.
$parameters = array(
'node_uid' => array(0, $this->web_user->id()),
'comment_uid' => array(0, $this->web_user->id(), $this->admin_user->id()),
'node_uid' => array(0, $this->webUser->id()),
'comment_uid' => array(0, $this->webUser->id(), $this->adminUser->id()),
'comment_status' => array(CommentInterface::PUBLISHED, CommentInterface::NOT_PUBLISHED),
'user' => array('anonymous', 'authenticated', 'admin'),
);
......@@ -68,13 +68,13 @@ function testCommentClasses() {
break;
case 'authenticated':
$this->drupalLogin($this->web_user);
$case['user_uid'] = $this->web_user->id();
$this->drupalLogin($this->webUser);
$case['user_uid'] = $this->webUser->id();
break;
case 'admin':
$this->drupalLogin($this->admin_user);
$case['user_uid'] = $this->admin_user->id();
$this->drupalLogin($this->adminUser);
$case['user_uid'] = $this->adminUser->id();
break;
}
// Request the node with the comment.
......
......@@ -80,7 +80,7 @@ public function testCommentFieldDelete() {
'type' => 'test_node_type',
));
$this->drupalLogin($this->web_user);
$this->drupalLogin($this->webUser);
$this->drupalGet('node/' . $node->nid->value);
$elements = $this->cssSelect('.field-type-comment');
......@@ -98,8 +98,8 @@ public function testCommentFieldDelete() {
*/
function testCommentInstallAfterContentModule() {
// Create a user to do module administration.
$this->admin_user = $this->drupalCreateUser(array('access administration pages', 'administer modules'));
$this->drupalLogin($this->admin_user);
$this->adminUser = $this->drupalCreateUser(array('access administration pages', 'administer modules'));
$this->drupalLogin($this->adminUser);
// Drop default comment field added in CommentTestBase::setup().
FieldStorageConfig::loadByName('node', 'comment')->delete();
......@@ -140,8 +140,8 @@ function testCommentInstallAfterContentModule() {
// 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->web_user = $this->drupalCreateUser(array('access content', 'access comments', 'post comments', 'skip comment approval'));
$this->drupalLogin($this->web_user);
$this->webUser = $this->drupalCreateUser(array('access content', 'access comments', 'post comments', 'skip comment approval'));
$this->drupalLogin($this->webUser);
$this->postComment($book_node, $this->randomMachineName(), $this->randomMachineName());
}
......
......@@ -23,7 +23,7 @@ class CommentInterfaceTest extends CommentTestBase {
*/
function testCommentInterface() {
// Set comments to have subject and preview disabled.
$this->drupalLogin($this->admin_user);
$this->drupalLogin($this->adminUser);
$this->setCommentPreview(DRUPAL_DISABLED);
$this->setCommentForm(TRUE);
$this->setCommentSubject(FALSE);
......@@ -31,20 +31,20 @@ function testCommentInterface() {
$this->drupalLogout();
// Post comment #1 without subject or preview.
$this->drupalLogin($this->web_user);
$this->drupalLogin($this->webUser);
$comment_text = $this->randomMachineName();
$comment = $this->postComment($this->node, $comment_text);
$this->assertTrue($this->commentExists($comment), 'Comment found.');
// Set comments to have subject and preview to required.
$this->drupalLogout();
$this->drupalLogin($this->admin_user);
$this->drupalLogin($this->adminUser);
$this->setCommentSubject(TRUE);
$this->setCommentPreview(DRUPAL_REQUIRED);
$this->drupalLogout();
// Create comment #2 that allows subject and requires preview.
$this->drupalLogin($this->web_user);
$this->drupalLogin($this->webUser);
$subject_text = $this->randomMachineName();
$comment_text = $this->randomMachineName();
$comment = $this->postComment($this->node, $comment_text, $subject_text, TRUE);
......@@ -58,14 +58,14 @@ function testCommentInterface() {
$anonymous_comment->delete();
// Check comment display.
$this->drupalLogin($this->web_user);
$this->drupalLogin($this->webUser);
$this->drupalGet('node/' . $this->node->id());
$this->assertText($subject_text, 'Individual comment subject found.');
$this->assertText($comment_text, 'Individual comment body found.');
// Set comments to have subject and preview to optional.
$this->drupalLogout();
$this->drupalLogin($this->admin_user);
$this->drupalLogin($this->adminUser);
$this->setCommentSubject(TRUE);
$this->setCommentPreview(DRUPAL_OPTIONAL);
......@@ -87,14 +87,14 @@ function testCommentInterface() {
// Test changing the comment author to a verified user.
$this->drupalGet('comment/' . $comment->id() . '/edit');
$comment = $this->postComment(NULL, $comment->comment_body->value, $comment->getSubject(), array('name' => $this->web_user->getUsername()));
$this->assertTrue($comment->getAuthorName() == $this->web_user->getUsername() && $comment->getOwnerId() == $this->web_user->id(), 'Comment author successfully changed to a registered user.');
$comment = $this->postComment(NULL, $comment->comment_body->value, $comment->getSubject(), array('name' => $this->webUser->getUsername()));
$this->assertTrue($comment->getAuthorName() == $this->webUser->getUsername() && $comment->getOwnerId() == $this->webUser->id(), 'Comment author successfully changed to a registered user.');
$this->drupalLogout();
// Reply to comment #2 creating comment #3 with optional preview and no
// subject though field enabled.
$this->drupalLogin($this->web_user);
$this->drupalLogin($this->webUser);
// Deliberately use the wrong url to test
// \Drupal\comment\Controller\CommentController::redirectNode().
$this->drupalGet('comment/' . $this->node->id() . '/reply');
......@@ -172,7 +172,7 @@ function testCommentInterface() {
// Delete comment and make sure that reply is also removed.
$this->drupalLogout();
$this->drupalLogin($this->admin_user);
$this->drupalLogin($this->adminUser);
$this->deleteComment($comment);
$this->deleteComment($comment_new_page);
......@@ -181,19 +181,19 @@ function testCommentInterface() {
$this->assertFalse($this->commentExists($reply, TRUE), 'Reply not found.');
// Enabled comment form on node page.
$this->drupalLogin($this->admin_user);
$this->drupalLogin($this->adminUser);
$this->setCommentForm(TRUE);
$this->drupalLogout();
// Submit comment through node form.
$this->drupalLogin($this->web_user);
$this->drupalLogin($this->webUser);
$this->drupalGet('node/' . $this->node->id());
$form_comment = $this->postComment(NULL, $this->randomMachineName(), $this->randomMachineName(), TRUE);
$this->assertTrue($this->commentExists($form_comment), 'Form comment found.');
// Disable comment form on node page.
$this->drupalLogout();
$this->drupalLogin($this->admin_user);
$this->drupalLogin($this->adminUser);
$this->setCommentForm(FALSE);
}
}
......@@ -27,7 +27,7 @@ protected function setUp() {
* Tests comment links altering.
*/
public function testCommentLinksAlter() {
$this->drupalLogin($this->web_user);
$this->drupalLogin($this->webUser);
$comment_text = $this->randomMachineName();
$subject = $this->randomMachineName();
$comment = $this->postComment($this->node, $comment_text, $subject);
......
......@@ -52,9 +52,9 @@ public function testCommentLinks() {
->set('default', 'stark')
->save();
// Remove additional user permissions from $this->web_user added by setUp(),
// Remove additional user permissions from $this->webUser added by setUp(),
// since this test is limited to anonymous and authenticated roles only.
$roles = $this->web_user->getRoles();
$roles = $this->webUser->getRoles();
entity_delete_multiple('user_role', array(reset($roles)));
// Create a comment via CRUD API functionality, since
......
......@@ -71,7 +71,7 @@ protected function renderNewCommentsNodeLinks(array $node_ids) {
public function testCommentNewCommentsIndicator() {
// Test if the right links are displayed when no comment is present for the
// node.
$this->drupalLogin($this->admin_user);
$this->drupalLogin($this->adminUser);
$this->drupalGet('node');
$this->assertNoLink(t('@count comments', array('@count' => 0)));
$this->assertLink(t('Read more'));
......@@ -101,7 +101,7 @@ public function testCommentNewCommentsIndicator() {
$this->drupalLogout();
// Log in with 'web user' and check comment links.
$this->drupalLogin($this->web_user);
$this->drupalLogin($this->webUser);
$this->drupalGet('node');
// Verify the data-history-node-last-comment-timestamp attribute. Given its
// value, the drupal.node-new-comments-link library would determine that the
......
......@@ -32,7 +32,7 @@ protected function setUp() {
node_access_rebuild();
// Re-create user.
$this->web_user = $this->drupalCreateUser(array(
$this->webUser = $this->drupalCreateUser(array(
'access comments',
'post comments',
'create article content',
......@@ -42,7 +42,7 @@ protected function setUp() {
));
// Set the author of the created node to the web_user uid.
$this->node->setOwnerId($this->web_user->id())->save();
$this->node->setOwnerId($this->webUser->id())->save();
}
/**
......@@ -50,7 +50,7 @@ protected function setUp() {
*/
function testThreadedCommentView() {
// Set comments to have subject required and preview disabled.
$this->drupalLogin($this->admin_user);
$this->drupalLogin($this->adminUser);
$this->setCommentPreview(DRUPAL_DISABLED);
$this->setCommentForm(TRUE);
$this->setCommentSubject(TRUE);
......@@ -58,7 +58,7 @@ function testThreadedCommentView() {
$this->drupalLogout();
// Post comment.
$this->drupalLogin($this->web_user);
$this->drupalLogin($this->webUser);
$comment_text = $this->randomMachineName();
$comment_subject = $this->randomMachineName();
$comment = $this->postComment($this->node, $comment_text, $comment_subject);
......
......@@ -21,7 +21,7 @@ class CommentNodeChangesTest extends CommentTestBase {
* Tests that comments are deleted with the node.
*/
function testNodeDeletion() {
$this->drupalLogin($this->web_user);
$this->drupalLogin($this->webUser);
$comment = $this->postComment($this->node, $this->randomMachineName(), $this->randomMachineName());
$this->assertTrue($comment->id(), 'The comment could be loaded.');
$this->node->delete();
......
......@@ -31,7 +31,7 @@ class CommentNonNodeTest extends WebTestBase {
*
* @var \Drupal\user\UserInterface
*/
protected $admin_user;
protected $adminUser;
protected function setUp() {
parent::setUp();
......@@ -52,7 +52,7 @@ protected function setUp() {
$this->assertEqual($bundles['comment']['label'], 'Comment settings');
// Create test user.
$this->admin_user = $this->drupalCreateUser(array(
$this->adminUser = $this->drupalCreateUser(array(
'administer comments',
'skip comment approval',
'post comments',
......@@ -247,7 +247,7 @@ function testCommentFunctionality() {
$this->drupalGet('entity_test/structure/entity_test/entity-test/fields/entity_test.entity_test.comment');
$this->assertNoField('edit-default-value-input-comment-und-0-status-0');
$this->drupalLogin($this->admin_user);
$this->drupalLogin($this->adminUser);
// Post a comment.
$comment1 = $this->postComment($this->entity, $this->randomMachineName(), $this->randomMachineName());
......
......@@ -21,7 +21,7 @@ class CommentPagerTest extends CommentTestBase {
* Confirms comment paging works correctly with flat and threaded comments.
*/
function testCommentPaging() {
$this->drupalLogin($this->admin_user);
$this->drupalLogin($this->adminUser);
// Set comment variables.
$this->setCommentForm(TRUE);
......@@ -93,7 +93,7 @@ function testCommentPaging() {
* Tests comment ordering and threading.
*/
function testCommentOrderingThreading() {
$this->drupalLogin($this->admin_user);
$this->drupalLogin($this->adminUser);
// Set comment variables.
$this->setCommentForm(TRUE);
......@@ -192,7 +192,7 @@ function assertCommentOrder(array $comments, array $expected_order) {
* Tests calculation of first page with new comment.
*/
function testCommentNewPageIndicator() {
$this->drupalLogin($this->admin_user);
$this->drupalLogin($this->adminUser);
// Set comment variables.
$this->setCommentForm(TRUE);
......@@ -301,10 +301,10 @@ function testTwoPagers() {
$this->drupalPostForm(NULL, array('fields[comment][settings_edit_form][settings][pager_id]' => 0), t('Save'));
$this->assertNoText(t('Pager ID: @id', array('@id' => 0)), 'No summary for standard pager');
$this->drupalLogin($this->admin_user);
$this->drupalLogin($this->adminUser);
// Add a new node with both comment fields open.
$node = $this->drupalCreateNode(array('type' => 'article', 'promote' => 1, 'uid' => $this->web_user->id()));
$node = $this->drupalCreateNode(array('type' => 'article', 'promote' => 1, 'uid' => $this->webUser->id()));
// Set comment options.
$comments = array();
foreach (array('comment', 'comment_2') as $field_name) {
......
......@@ -32,7 +32,7 @@ class CommentPreviewTest extends CommentTestBase {
*/
function testCommentPreview() {
// As admin user, configure comment settings.
$this->drupalLogin($this->admin_user);
$this->drupalLogin($this->adminUser);
$this->setCommentPreview(DRUPAL_OPTIONAL);
$this->setCommentForm(TRUE);
$this->setCommentSubject(TRUE);
......@@ -40,13 +40,13 @@ function testCommentPreview() {
$this->drupalLogout();
// Login as web user and add a signature and a user picture.
$this->drupalLogin($this->web_user);
$this->drupalLogin($this->webUser);
\Drupal::config('user.settings')->set('signatures', 1)->save();
$test_signature = $this->randomMachineName();
$edit['signature[value]'] = '<a href="http://example.com/">' . $test_signature. '</a>';
$image = current($this->drupalGetTestFiles('image'));
$edit['files[user_picture_0]'] = drupal_realpath($image->uri);
$this->drupalPostForm('user/' . $this->web_user->id() . '/edit', $edit, t('Save'));
$this->drupalPostForm('user/' . $this->webUser->id() . '/edit', $edit, t('Save'));
// As the web user, fill in the comment form and preview the comment.
$edit = array();
......@@ -75,7 +75,7 @@ function testCommentPreview() {
*/
function testCommentEditPreviewSave() {
$web_user = $this->drupalCreateUser(array('access comments', 'post comments', 'skip comment approval', 'edit own comments'));
$this->drupalLogin($this->admin_user);
$this->drupalLogin($this->adminUser);
$this->setCommentPreview(DRUPAL_OPTIONAL);
$this->setCommentForm(TRUE);
$this->setCommentSubject(TRUE);
......
......@@ -28,7 +28,7 @@ class CommentRssTest extends CommentTestBase {
*/
function testCommentRss() {
// Find comment in RSS feed.
$this->drupalLogin($this->web_user);
$this->drupalLogin($this->webUser);
$this->postComment($this->node, $this->randomMachineName(), $this->randomMachineName());
$this->drupalGet('rss.xml');
$raw = '<comments>' . $this->node->url('canonical', array('fragment' => 'comments', 'absolute' => TRUE)) . '</comments>';
......
......@@ -17,11 +17,18 @@
*/
class CommentStatisticsTest extends CommentTestBase {
/**
* A secondary user for posting comments.
*
* @var \Drupal\user\UserInterface
*/
protected $webUser2;
protected function setUp() {
parent::setUp();
// Create a second user to post comments.
$this->web_user2 = $this->drupalCreateUser(array(
$this->webUser2 = $this->drupalCreateUser(array(
'post comments',
'create article content',
'edit own comments',
......@@ -38,7 +45,7 @@ protected function setUp() {
function testCommentNodeCommentStatistics() {
$node_storage = $this->container->get('entity.manager')->getStorage('node');
// Set comments to have subject and preview disabled.
$this->drupalLogin($this->admin_user);
$this->drupalLogin($this->adminUser);
$this->setCommentPreview(DRUPAL_DISABLED);
$this->setCommentForm(TRUE);
$this->setCommentSubject(FALSE);
......@@ -49,11 +56,11 @@ function testCommentNodeCommentStatistics() {
$node = $node_storage->load($this->node->id());
$this->assertEqual($node->get('comment')->last_comment_timestamp, $this->node->getCreatedTime(), 'The initial value of node last_comment_timestamp is the node created date.');
$this->assertEqual($node->get('comment')->last_comment_name, NULL, 'The initial value of node last_comment_name is NULL.');
$this->assertEqual($node->get('comment')->last_comment_uid, $this->web_user->id(), 'The initial value of node last_comment_uid is the node uid.');
$this->assertEqual($node->get('comment')->last_comment_uid, $this->webUser->id(), 'The initial value of node last_comment_uid is the node uid.');
$this->assertEqual($node->get('comment')->comment_count, 0, 'The initial value of node comment_count is zero.');
// Post comment #1 as web_user2.
$this->drupalLogin($this->web_user2);
$this->drupalLogin($this->webUser2);
$comment_text = $this->randomMachineName();
$this->postComment($this->node, $comment_text);
......@@ -62,11 +69,11 @@ function testCommentNodeCommentStatistics() {
$node_storage->resetCache(array($this->node->id()));
$node = $node_storage->load($this->node->id());
$this->assertEqual($node->get('comment')->last_comment_name, NULL, 'The value of node last_comment_name is NULL.');
$this->assertEqual($node->get('comment')->last_comment_uid, $this->web_user2->id(), 'The value of node last_comment_uid is the comment #1 uid.');
$this->assertEqual($node->get('comment')->last_comment_uid, $this->webUser2->id(), 'The value of node last_comment_uid is the comment #1 uid.');
$this->assertEqual($node->get('comment')->comment_count, 1, 'The value of node comment_count is 1.');
// Prepare for anonymous comment submission (comment approval enabled).
$this->drupalLogin($this->admin_user);
$this->drupalLogin($this->adminUser);
user_role_change_permissions(DRUPAL_ANONYMOUS_RID, array(
'access comments' => TRUE,
'post comments' => TRUE,
......@@ -86,11 +93,11 @@ function testCommentNodeCommentStatistics() {
$node_storage->resetCache(array($this->node->id()));
$node = $node_storage->load($this->node->id());
$this->assertEqual($node->get('comment')->last_comment_name, NULL, 'The value of node last_comment_name is still NULL.');
$this->assertEqual($node->get('comment')->last_comment_uid, $this->web_user2->id(), 'The value of node last_comment_uid is still the comment #1 uid.');
$this->assertEqual($node->get('comment')->last_comment_uid, $this->webUser2->id(), 'The value of node last_comment_uid is still the comment #1 uid.');
$this->assertEqual($node->get('comment')->comment_count, 1, 'The value of node comment_count is still 1.');
// Prepare for anonymous comment submission (no approval required).
$this->drupalLogin($this->admin_user);
$this->drupalLogin($this->adminUser);
user_role_change_permissions(DRUPAL_ANONYMOUS_RID, array(
'access comments' => TRUE,
'post comments' => TRUE,
......
......@@ -31,14 +31,14 @@ abstract class CommentTestBase extends WebTestBase {
*
* @var \Drupal\user\UserInterface
*/
protected $admin_user;
protected $adminUser;
/**
* A normal user with permission to post comments.
*
* @var \Drupal\user\UserInterface
*/
protected $web_user;
protected $webUser;
/**
* A test node to which comments will be posted.
......@@ -58,7 +58,7 @@ protected function setUp() {
}
// Create two test users.
$this->admin_user = $this->drupalCreateUser(array(
$this->adminUser = $this->drupalCreateUser(array(