Commit 7aad4bc4 authored by alexpott's avatar alexpott

Issue #2385217 by rpayanm, hussainweb, areke: Clean-up tracker module test...

Issue #2385217 by rpayanm, hussainweb, areke: Clean-up tracker module test members - ensure property definition and use of camelCase naming convention
parent 12415865
......@@ -27,16 +27,16 @@ class TrackerTest extends WebTestBase {
/**
* The main user for testing.
*
* @var object
* @var \Drupal\user\UserInterface
*/
protected $user;
/**
* A second user that will 'create' comments and nodes.
*
* @var object
* @var \Drupal\user\UserInterface
*/
protected $other_user;
protected $otherUser;
protected function setUp() {
parent::setUp();
......@@ -45,7 +45,7 @@ protected function setUp() {
$permissions = array('access comments', 'create page content', 'post comments', 'skip comment approval');
$this->user = $this->drupalCreateUser($permissions);
$this->other_user = $this->drupalCreateUser($permissions);
$this->otherUser = $this->drupalCreateUser($permissions);
$this->container->get('comment.manager')->addDefaultField('node', 'page');
}
......@@ -93,12 +93,12 @@ function testTrackerUser() {
));
$other_published_no_comment = $this->drupalCreateNode(array(
'title' => $this->randomMachineName(8),
'uid' => $this->other_user->id(),
'uid' => $this->otherUser->id(),
'status' => 1,
));
$other_published_my_comment = $this->drupalCreateNode(array(
'title' => $this->randomMachineName(8),
'uid' => $this->other_user->id(),
'uid' => $this->otherUser->id(),
'status' => 1,
));
$comment = array(
......@@ -153,7 +153,7 @@ function testTrackerNewNodes() {
$this->drupalGet('activity');
$this->assertNoPattern('/' . $title . '.*new/', 'Visited nodes are not flagged as new.');
$this->drupalLogin($this->other_user);
$this->drupalLogin($this->otherUser);
$this->drupalGet('activity');
$this->assertPattern('/' . $title . '.*new/', 'For another user, new nodes are flagged as such in the tracker listing.');
......@@ -196,12 +196,12 @@ function testTrackerNewComments() {
),
));
$this->drupalLogin($this->other_user);
$this->drupalLogin($this->otherUser);
$this->drupalGet('activity');
$this->assertText('1 new', 'New comments are counted on the tracker listing pages.');
$this->drupalGet('node/' . $node->id());
// Add another comment as other_user.
// Add another comment as otherUser.
$comment = array(
'subject[0][value]' => $this->randomMachineName(),
'comment_body[0][value]' => $this->randomMachineName(20),
......@@ -231,8 +231,8 @@ function testTrackerOrderingNewComments() {
'title' => $this->randomMachineName(8),
));
// Now get other_user to track these pieces of content.
$this->drupalLogin($this->other_user);
// Now get otherUser to track these pieces of content.
$this->drupalLogin($this->otherUser);
// Add a comment to the first page.
$comment = array(
......@@ -252,7 +252,7 @@ function testTrackerOrderingNewComments() {
);
$this->drupalPostForm('comment/reply/node/' . $node_two->id() . '/comment', $comment, t('Save'));
// We should at this point have in our tracker for other_user:
// We should at this point have in our tracker for otherUser:
// 1. node_two
// 2. node_one
// Because that's the reverse order of the posted comments.
......@@ -272,9 +272,9 @@ function testTrackerOrderingNewComments() {
);
$this->drupalPostForm('comment/reply/node/' . $node_one->id() . '/comment', $comment, t('Save'));
// Switch back to the other_user and assert that the order has swapped.
$this->drupalLogin($this->other_user);
$this->drupalGet('user/' . $this->other_user->id() . '/activity');
// Switch back to the otherUser and assert that the order has swapped.
$this->drupalLogin($this->otherUser);
$this->drupalGet('user/' . $this->otherUser->id() . '/activity');
// This is a cheeky way of asserting that the nodes are in the right order
// on the tracker page.
// It's almost certainly too brittle.
......@@ -300,7 +300,7 @@ function testTrackerCronIndexing() {
}
// Add a comment to the last node as other user.
$this->drupalLogin($this->other_user);
$this->drupalLogin($this->otherUser);
$comment = array(
'subject[0][value]' => $this->randomMachineName(),
'comment_body[0][value]' => $this->randomMachineName(20),
......
......@@ -30,6 +30,13 @@ abstract class TrackerTestBase extends ViewTestBase {
*/
protected $node;
/**
* The comment used for testing.
*
* @var \Drupal\comment\CommentInterface
*/
protected $comment;
protected function setUp() {
parent::setUp();
......
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