namespace Drupal\Tests\comment\Kernel\Views;
-use Drupal\comment\CommentInterface;
use Drupal\comment\CommentManagerInterface;
use Drupal\Core\Session\AnonymousUserSession;
use Drupal\Core\Url;
$this->assertEqual(\Drupal::l('Approve', $url), (string) $approve_comment, 'Found a comment approve link for an unapproved comment.');
// Approve the comment.
- $comment->setPublished(CommentInterface::PUBLISHED);
+ $comment->setPublished();
$comment->save();
$view = Views::getView('test_comment');
$view->preview();
// anonymous user.
$account_switcher->switchTo(new AnonymousUserSession());
// Set the comment as unpublished again.
- $comment->setPublished(CommentInterface::NOT_PUBLISHED);
+ $comment->setUnpublished();
$comment->save();
$view = Views::getView('test_comment');
$this->assertFalse((string) $replyto_comment, "I can't reply to an unapproved comment.");
// Approve the comment.
- $comment->setPublished(CommentInterface::PUBLISHED);
+ $comment->setPublished();
$comment->save();
$view = Views::getView('test_comment');
$view->preview();