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

8.0.x
webchick 2012-10-18 00:01:57 -07:00
parent 711ed2adec
commit a29f2d14a0
6 changed files with 38 additions and 61 deletions

View File

@ -12,15 +12,6 @@ namespace Drupal\comment\Tests;
*/
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 @@ class CommentAnonymousTest extends CommentTestBase {
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 @@ class CommentAnonymousTest extends CommentTestBase {
*/
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();

View File

@ -12,16 +12,6 @@ namespace Drupal\comment\Tests;
*/
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 @@ class CommentCSSTest extends CommentTestBase {
);
}
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.
*/

View File

@ -12,15 +12,6 @@ namespace Drupal\comment\Tests;
*/
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 @@ class CommentLinksTest extends CommentTestBase {
$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.

View File

@ -12,15 +12,6 @@ namespace Drupal\comment\Tests;
*/
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 @@ class CommentNewIndicatorTest extends CommentTestBase {
$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 @@ class CommentNewIndicatorTest extends CommentTestBase {
$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));
}
}

View File

@ -12,15 +12,6 @@ namespace Drupal\comment\Tests;
*/
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 @@ class CommentStatisticsTest extends CommentTestBase {
);
}
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 @@ class CommentStatisticsTest extends CommentTestBase {
$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.');

View File

@ -69,7 +69,6 @@ abstract class CommentTestBase extends WebTestBase {
'edit own comments',
'post comments',
'skip comment approval',
'access comments',
'access content',
));