ArgumentUserUIDTest.php in Zircon Profile 8.0
File
core/modules/comment/src/Tests/Views/ArgumentUserUIDTest.php
View source
<?php
namespace Drupal\comment\Tests\Views;
use Drupal\comment\Entity\Comment;
use Drupal\user\Entity\User;
use Drupal\views\Views;
class ArgumentUserUIDTest extends CommentTestBase {
public static $testViews = array(
'test_comment_user_uid',
);
function testCommentUserUIDTest() {
$new_user = User::create([
'name' => 'new user',
]);
$new_user
->save();
$comment = Comment::create([
'uid' => $new_user->uid->value,
'entity_id' => $this->nodeUserCommented
->id(),
'entity_type' => 'node',
'field_name' => 'comment',
'subject' => 'if a woodchuck could chuck wood.',
]);
$comment
->save();
$view = Views::getView('test_comment_user_uid');
$this
->executeView($view, array(
$this->account
->id(),
));
$result_set = array(
array(
'nid' => $this->nodeUserPosted
->id(),
),
array(
'nid' => $this->nodeUserCommented
->id(),
),
);
$column_map = array(
'nid' => 'nid',
);
$this
->assertIdenticalResultset($view, $result_set, $column_map);
}
}