You are here

public function CommentRestExportTest::testCommentRestExport in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 core/modules/comment/src/Tests/Views/CommentRestExportTest.php \Drupal\comment\Tests\Views\CommentRestExportTest::testCommentRestExport()

Test comment row.

File

core/modules/comment/src/Tests/Views/CommentRestExportTest.php, line 57
Contains \Drupal\comment\Tests\Views\CommentRestExportTest.

Class

CommentRestExportTest
Tests a comment rest export view.

Namespace

Drupal\comment\Tests\Views

Code

public function testCommentRestExport() {
  $this
    ->drupalGetWithFormat(sprintf('node/%d/comments', $this->nodeUserCommented
    ->id()), 'hal_json');
  $this
    ->assertResponse(200);
  $contents = Json::decode($this
    ->getRawContent());
  $this
    ->assertEqual($contents[0]['subject'], 'How much wood would a woodchuck chuck');
  $this
    ->assertEqual($contents[1]['subject'], 'A lot, apparently');
  $this
    ->assertEqual(count($contents), 2);

  // 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');
}