function CommentRestExportTest::testCommentRestExport
Test comment row.
File
-
core/
modules/ comment/ tests/ src/ Functional/ Views/ CommentRestExportTest.php, line 63
Class
- CommentRestExportTest
- Tests a comment rest export view.
Namespace
Drupal\Tests\comment\Functional\ViewsCode
public function testCommentRestExport() {
$this->drupalGet(sprintf('node/%d/comments', $this->nodeUserCommented
->id()), [
'query' => [
'_format' => 'hal_json',
],
]);
$this->assertSession()
->statusCodeEquals(200);
$contents = Json::decode($this->getSession()
->getPage()
->getContent());
$this->assertEqual($contents[0]['subject'], 'How much wood would a woodchuck chuck');
$this->assertEqual($contents[1]['subject'], 'A lot, apparently');
$this->assertCount(2, $contents);
// Ensure field-level access is respected - user shouldn't be able to see
// mail or hostname fields.
$this->assertNoText('someone@example.com');
$this->assertNoText('public.example.com');
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.