update
This commit is contained in:
@@ -75,6 +75,7 @@ interface CommentStorageInterface extends ContentEntityStorageInterface {
|
||||
*
|
||||
* @param \Drupal\comment\CommentInterface[] $comments
|
||||
* An array of comment entities keyed by their ids.
|
||||
*
|
||||
* @return array
|
||||
* The entity ids of the passed comment entities' children as an array.
|
||||
*/
|
||||
|
||||
@@ -176,7 +176,7 @@ class CommentAnonymousTest extends CommentTestBase {
|
||||
// "Login or register to post comments" type link may be shown.
|
||||
$this->drupalGet('node/' . $this->node->id());
|
||||
$this->assertSession()->responseNotMatches('@<h2[^>]*>Comments</h2>@', 'Comments were not displayed.');
|
||||
$this->assertNoLink('Add new comment', 'Link to add comment was found.');
|
||||
$this->assertSession()->linkNotExists('Add new comment', 'Link to add comment was found.');
|
||||
|
||||
// Attempt to view node-comment form while disallowed.
|
||||
$this->drupalGet('comment/reply/node/' . $this->node->id() . '/comment');
|
||||
@@ -189,8 +189,8 @@ class CommentAnonymousTest extends CommentTestBase {
|
||||
]);
|
||||
$this->drupalGet('node/' . $this->node->id());
|
||||
$this->assertPattern('@<h2[^>]*>Comments</h2>@', 'Comments were displayed.');
|
||||
$this->assertLink('Log in', 1, 'Link to login was found.');
|
||||
$this->assertLink('register', 1, 'Link to register was found.');
|
||||
$this->assertSession()->linkExists('Log in', 1, 'Link to login was found.');
|
||||
$this->assertSession()->linkExists('register', 1, 'Link to register was found.');
|
||||
|
||||
user_role_change_permissions(RoleInterface::ANONYMOUS_ID, [
|
||||
'access comments' => FALSE,
|
||||
|
||||
@@ -60,7 +60,11 @@ class CommentBookTest extends BrowserTestBase {
|
||||
]);
|
||||
$comment->save();
|
||||
|
||||
$commenting_user = $this->drupalCreateUser(['access printer-friendly version', 'access comments', 'post comments']);
|
||||
$commenting_user = $this->drupalCreateUser([
|
||||
'access printer-friendly version',
|
||||
'access comments',
|
||||
'post comments',
|
||||
]);
|
||||
$this->drupalLogin($commenting_user);
|
||||
|
||||
$this->drupalGet('node/' . $book_node->id());
|
||||
|
||||
@@ -191,7 +191,10 @@ class CommentFieldsTest extends CommentTestBase {
|
||||
*/
|
||||
public function testCommentInstallAfterContentModule() {
|
||||
// Create a user to do module administration.
|
||||
$this->adminUser = $this->drupalCreateUser(['access administration pages', 'administer modules']);
|
||||
$this->adminUser = $this->drupalCreateUser([
|
||||
'access administration pages',
|
||||
'administer modules',
|
||||
]);
|
||||
$this->drupalLogin($this->adminUser);
|
||||
|
||||
// Drop default comment field added in CommentTestBase::setup().
|
||||
@@ -233,7 +236,12 @@ class CommentFieldsTest extends CommentTestBase {
|
||||
// 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->webUser = $this->drupalCreateUser(['access content', 'access comments', 'post comments', 'skip comment approval']);
|
||||
$this->webUser = $this->drupalCreateUser([
|
||||
'access content',
|
||||
'access comments',
|
||||
'post comments',
|
||||
'skip comment approval',
|
||||
]);
|
||||
$this->drupalLogin($this->webUser);
|
||||
$this->postComment($book_node, $this->randomMachineName(), $this->randomMachineName());
|
||||
}
|
||||
|
||||
@@ -45,7 +45,17 @@ class CommentLanguageTest extends BrowserTestBase {
|
||||
$this->drupalCreateContentType(['type' => 'article', 'name' => 'Article']);
|
||||
|
||||
// Create and log in user.
|
||||
$admin_user = $this->drupalCreateUser(['administer site configuration', 'administer languages', 'access administration pages', 'administer content types', 'administer comments', 'create article content', 'access comments', 'post comments', 'skip comment approval']);
|
||||
$admin_user = $this->drupalCreateUser([
|
||||
'administer site configuration',
|
||||
'administer languages',
|
||||
'access administration pages',
|
||||
'administer content types',
|
||||
'administer comments',
|
||||
'create article content',
|
||||
'access comments',
|
||||
'post comments',
|
||||
'skip comment approval',
|
||||
]);
|
||||
$this->drupalLogin($admin_user);
|
||||
|
||||
// Add language.
|
||||
|
||||
@@ -34,7 +34,7 @@ class CommentLinksAlterTest extends CommentTestBase {
|
||||
|
||||
$this->drupalGet('node/' . $this->node->id());
|
||||
|
||||
$this->assertLink(t('Report'));
|
||||
$this->assertSession()->linkExists(t('Report'));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -101,9 +101,9 @@ class CommentLinksTest extends CommentTestBase {
|
||||
// In teaser view, a link containing the comment count is always
|
||||
// expected.
|
||||
if ($path == 'node') {
|
||||
$this->assertLink(t('1 comment'));
|
||||
$this->assertSession()->linkExists(t('1 comment'));
|
||||
}
|
||||
$this->assertLink('Add new comment');
|
||||
$this->assertSession()->linkExists('Add new comment');
|
||||
}
|
||||
|
||||
$display_repository = $this->container->get('entity_display.repository');
|
||||
@@ -133,13 +133,13 @@ class CommentLinksTest extends CommentTestBase {
|
||||
->removeComponent('links')
|
||||
->save();
|
||||
$this->drupalGet($this->node->toUrl());
|
||||
$this->assertNoLink('1 comment');
|
||||
$this->assertNoLink('Add new comment');
|
||||
$this->assertSession()->linkNotExists('1 comment');
|
||||
$this->assertSession()->linkNotExists('Add new comment');
|
||||
|
||||
// Visit the full node, make sure there are links for the comment.
|
||||
$this->drupalGet('node/' . $this->node->id());
|
||||
$this->assertText($comment->getSubject());
|
||||
$this->assertLink('Reply');
|
||||
$this->assertSession()->linkExists('Reply');
|
||||
|
||||
// Make sure we can hide comment links.
|
||||
$display_repository->getViewDisplay('comment', 'comment')
|
||||
@@ -147,7 +147,7 @@ class CommentLinksTest extends CommentTestBase {
|
||||
->save();
|
||||
$this->drupalGet('node/' . $this->node->id());
|
||||
$this->assertText($comment->getSubject());
|
||||
$this->assertNoLink('Reply');
|
||||
$this->assertSession()->linkNotExists('Reply');
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -60,8 +60,8 @@ class CommentNewIndicatorTest extends CommentTestBase {
|
||||
// node.
|
||||
$this->drupalLogin($this->adminUser);
|
||||
$this->drupalGet('node');
|
||||
$this->assertNoLink(t('@count comments', ['@count' => 0]));
|
||||
$this->assertLink(t('Read more'));
|
||||
$this->assertSession()->linkNotExists(t('@count comments', ['@count' => 0]));
|
||||
$this->assertSession()->linkExists(t('Read more'));
|
||||
// Verify the data-history-node-last-comment-timestamp attribute, which is
|
||||
// used by the drupal.node-new-comments-link library to determine whether
|
||||
// a "x new comments" link might be necessary or not. We do this in
|
||||
|
||||
@@ -355,7 +355,7 @@ class CommentNonNodeTest extends BrowserTestBase {
|
||||
// Attempt to view comments while disallowed.
|
||||
$this->drupalGet('entity-test/' . $this->entity->id());
|
||||
$this->assertSession()->responseNotMatches('@<h2[^>]*>Comments</h2>@', 'Comments were not displayed.');
|
||||
$this->assertNoLink('Add new comment', 'Link to add comment was found.');
|
||||
$this->assertSession()->linkNotExists('Add new comment', 'Link to add comment was found.');
|
||||
|
||||
// Attempt to view test entity comment form while disallowed.
|
||||
$this->drupalGet('comment/reply/entity_test/' . $this->entity->id() . '/comment');
|
||||
@@ -371,8 +371,8 @@ class CommentNonNodeTest extends BrowserTestBase {
|
||||
]);
|
||||
$this->drupalGet('entity_test/' . $this->entity->id());
|
||||
$this->assertPattern('@<h2[^>]*>Comments</h2>@', 'Comments were displayed.');
|
||||
$this->assertLink('Log in', 0, 'Link to login was found.');
|
||||
$this->assertLink('register', 0, 'Link to register was found.');
|
||||
$this->assertSession()->linkExists('Log in', 0, 'Link to login was found.');
|
||||
$this->assertSession()->linkExists('register', 0, 'Link to register was found.');
|
||||
$this->assertNoFieldByName('subject[0][value]', '', 'Subject field not found.');
|
||||
$this->assertNoFieldByName('comment_body[0][value]', '', 'Comment field not found.');
|
||||
|
||||
|
||||
@@ -128,7 +128,12 @@ class CommentPreviewTest extends CommentTestBase {
|
||||
* Tests comment edit, preview, and save.
|
||||
*/
|
||||
public function testCommentEditPreviewSave() {
|
||||
$web_user = $this->drupalCreateUser(['access comments', 'post comments', 'skip comment approval', 'edit own comments']);
|
||||
$web_user = $this->drupalCreateUser([
|
||||
'access comments',
|
||||
'post comments',
|
||||
'skip comment approval',
|
||||
'edit own comments',
|
||||
]);
|
||||
$this->drupalLogin($this->adminUser);
|
||||
$this->setCommentPreview(DRUPAL_OPTIONAL);
|
||||
$this->setCommentForm(TRUE);
|
||||
|
||||
Reference in New Issue
Block a user