FlatCommentsReplyLinkTest.php in Flatcomments 8
File
tests/src/Functional/FlatCommentsReplyLinkTest.php
View source
<?php
namespace Drupal\Tests\flat_comments\Functional;
use Drupal\comment\CommentManagerInterface;
use Drupal\comment\Tests\CommentTestTrait;
use Drupal\field\Entity\FieldConfig;
use Drupal\Tests\comment\Functional\CommentTestBase;
class FlatCommentsReplyLinkTest extends CommentTestBase {
protected $defaultTheme = 'classy';
use CommentTestTrait;
public static $modules = [
'flat_comments',
'comment',
'node',
];
protected $node;
public function testCommentThreading() {
$field = FieldConfig::loadByName('node', 'article', 'comment');
$field
->setSetting('default_mode', CommentManagerInterface::COMMENT_MODE_FLAT);
$field
->setSetting('preview', DRUPAL_DISABLED);
$field
->setSetting('form_location', TRUE);
$field
->setThirdPartySetting('flat_comments', 'remove_reply_link', TRUE);
$field
->save();
$this
->drupalLogin($this->adminUser);
$this->node = $this
->drupalCreateNode([
'type' => 'article',
'promote' => 1,
'uid' => $this->adminUser
->id(),
]);
$this
->drupalLogin($this->adminUser);
$subject_text = $this
->randomMachineName();
$comment_text = $this
->randomMachineName();
$comment1 = $this
->postComment($this->node, $comment_text, $subject_text, TRUE);
$this
->assertTrue($this
->commentExists($comment1), 'Comment found.');
$this
->assertNoLink('Reply');
$this
->drupalLogout();
}
}