3 namespace Drupal\comment\Tests\Views;
5 use Drupal\comment\Entity\Comment;
6 use Drupal\user\Entity\User;
7 use Drupal\views\Views;
10 * Tests the user posted or commented argument handler.
14 class ArgumentUserUIDTest extends CommentTestBase {
17 * Views used by this test.
21 public static $testViews = ['test_comment_user_uid'];
23 public function testCommentUserUIDTest() {
24 // Add an additional comment which is not created by the user.
25 $new_user = User::create(['name' => 'new user']);
28 $comment = Comment::create([
29 'uid' => $new_user->uid->value,
30 'entity_id' => $this->nodeUserCommented->id(),
31 'entity_type' => 'node',
32 'field_name' => 'comment',
33 'subject' => 'if a woodchuck could chuck wood.',
37 $view = Views::getView('test_comment_user_uid');
38 $this->executeView($view, [$this->account->id()]);
41 'nid' => $this->nodeUserPosted->id(),
44 'nid' => $this->nodeUserCommented->id(),
47 $column_map = ['nid' => 'nid'];
48 $this->assertIdenticalResultset($view, $result_set, $column_map);