Commit a29f2d14 authored by webchick's avatar webchick

Issue #1814868 by xjm: Convert remaining comment tests to the testing profile.

parent 711ed2ad
......@@ -12,15 +12,6 @@
*/
class CommentAnonymousTest extends CommentTestBase {
/**
* Use the standard profile.
*
* @var string
*
* @todo Remove this dependency if possible.
*/
protected $profile = 'standard';
public static function getInfo() {
return array(
'name' => 'Anonymous comments',
......@@ -32,6 +23,18 @@ public static function getInfo() {
function setUp() {
parent::setUp();
config('user.settings')->set('register', USER_REGISTER_VISITORS)->save();
// Enable anonymous and authenticated user comments.
user_role_grant_permissions(DRUPAL_ANONYMOUS_RID, array(
'access comments',
'post comments',
'skip comment approval',
));
user_role_grant_permissions(DRUPAL_AUTHENTICATED_RID, array(
'access comments',
'post comments',
'skip comment approval',
));
}
/**
......@@ -39,12 +42,6 @@ function setUp() {
*/
function testAnonymous() {
$this->drupalLogin($this->admin_user);
// Enabled anonymous user comments.
user_role_change_permissions(DRUPAL_ANONYMOUS_RID, array(
'access comments' => TRUE,
'post comments' => TRUE,
'skip comment approval' => TRUE,
));
$this->setCommentAnonymous('0'); // Ensure that doesn't require contact info.
$this->drupalLogout();
......
......@@ -12,16 +12,6 @@
*/
class CommentCSSTest extends CommentTestBase {
/**
* Use the standard profile.
*
* @var string
*
* @todo Are these dependent on a particular theme? Remove this dependency
* if possible.
*/
protected $profile = 'standard';
public static function getInfo() {
return array(
'name' => 'Comment CSS',
......@@ -30,6 +20,16 @@ public static function getInfo() {
);
}
function setUp() {
parent::setUp();
// Allow anonymous users to see comments.
user_role_grant_permissions(DRUPAL_ANONYMOUS_RID, array(
'access comments',
'access content'
));
}
/**
* Tests CSS classes on comments.
*/
......
......@@ -12,15 +12,6 @@
*/
class CommentLinksTest extends CommentTestBase {
/**
* Use the standard profile.
*
* @var string
*
* @todo Remove this dependency.
*/
protected $profile = 'standard';
public static function getInfo() {
return array(
'name' => 'Comment links',
......@@ -220,7 +211,7 @@ function assertCommentLinks(array $info) {
$nid = $this->node->nid;
foreach (array('', "node/$nid") as $path) {
foreach (array('node', "node/$nid") as $path) {
$this->drupalGet($path);
// User is allowed to view comments.
......
......@@ -12,15 +12,6 @@
*/
class CommentNewIndicatorTest extends CommentTestBase {
/**
* Use the standard profile.
*
* @var string
*
* @todo Remove this dependency.
*/
protected $profile = 'standard';
public static function getInfo() {
return array(
'name' => "Comment 'new' indicator",
......@@ -41,8 +32,6 @@ public function testCommentNewCommentsIndicator() {
$this->assertNoLink(t('@count comments', array('@count' => 0)));
$this->assertNoLink(t('@count new comments', array('@count' => 0)));
$this->assertLink(t('Read more'));
$count = $this->xpath('//div[@id=:id]/div[@class=:class]/ul/li', array(':id' => 'node-' . $this->node->nid, ':class' => 'link-wrapper'));
$this->assertTrue(count($count) == 1, 'One child found');
// Create a new comment. This helper function may be run with different
// comment settings so use comment_save() to avoid complex setup.
......@@ -75,8 +64,6 @@ public function testCommentNewCommentsIndicator() {
$this->assertLink(t('Read more'));
$this->assertNoLink(t('1 new comment'));
$this->assertNoLink(t('@count new comments', array('@count' => 0)));
$count = $this->xpath('//div[@id=:id]/div[@class=:class]/ul/li', array(':id' => 'node-' . $this->node->nid, ':class' => 'link-wrapper'));
$this->assertTrue(count($count) == 2, print_r($count, TRUE));
}
}
......@@ -12,15 +12,6 @@
*/
class CommentStatisticsTest extends CommentTestBase {
/**
* Use the standard profile.
*
* @var string
*
* @todo Remove this dependency.
*/
protected $profile = 'standard';
public static function getInfo() {
return array(
'name' => 'Comment statistics',
......@@ -29,6 +20,21 @@ public static function getInfo() {
);
}
function setUp() {
parent::setUp();
// Create a second user to post comments.
$this->web_user2 = $this->drupalCreateUser(array(
'post comments',
'create article content',
'edit own comments',
'post comments',
'skip comment approval',
'access comments',
'access content',
));
}
/**
* Tests the node comment statistics.
*/
......@@ -42,9 +48,6 @@ function testCommentNodeCommentStatistics() {
$this->setCommentSettings('comment_default_mode', COMMENT_MODE_THREADED, 'Comment paging changed.');
$this->drupalLogout();
// Creates a second user to post comments.
$this->web_user2 = $this->drupalCreateUser(array('access comments', 'post comments', 'create article content', 'edit own comments'));
// Checks the initial values of node comment statistics with no comment.
$node = node_load($this->node->nid);
$this->assertEqual($node->last_comment_timestamp, $this->node->created, 'The initial value of node last_comment_timestamp is the node created date.');
......
......@@ -69,7 +69,6 @@ function setUp() {
'edit own comments',
'post comments',
'skip comment approval',
'access comments',
'access content',
));
......
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