summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlex Pott2015-01-02 23:35:58 (GMT)
committerAlex Pott2015-01-02 23:35:58 (GMT)
commit7aad4bc4f3b0578e11dc9ab111f9f231817915a9 (patch)
tree3d78572936c01a390b87cf46e7b142164169900c
parent1241586557454cb426adfa8e821522946e7c2d22 (diff)
Issue #2385217 by rpayanm, hussainweb, areke: Clean-up tracker module test members - ensure property definition and use of camelCase naming convention
-rw-r--r--core/modules/tracker/src/Tests/TrackerTest.php32
-rw-r--r--core/modules/tracker/src/Tests/Views/TrackerTestBase.php7
2 files changed, 23 insertions, 16 deletions
diff --git a/core/modules/tracker/src/Tests/TrackerTest.php b/core/modules/tracker/src/Tests/TrackerTest.php
index 7bcaa42..80f6fa5 100644
--- a/core/modules/tracker/src/Tests/TrackerTest.php
+++ b/core/modules/tracker/src/Tests/TrackerTest.php
@@ -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 @@ class TrackerTest extends WebTestBase {
$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 @@ class TrackerTest extends WebTestBase {
));
$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 @@ class TrackerTest extends WebTestBase {
$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 @@ class TrackerTest extends WebTestBase {
),
));
- $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 @@ class TrackerTest extends WebTestBase {
'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 @@ class TrackerTest extends WebTestBase {
);
$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 @@ class TrackerTest extends WebTestBase {
);
$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 @@ class TrackerTest extends WebTestBase {
}
// 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),
diff --git a/core/modules/tracker/src/Tests/Views/TrackerTestBase.php b/core/modules/tracker/src/Tests/Views/TrackerTestBase.php
index 4b69d9c..5ec6597 100644
--- a/core/modules/tracker/src/Tests/Views/TrackerTestBase.php
+++ b/core/modules/tracker/src/Tests/Views/TrackerTestBase.php
@@ -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();