$this->asAdmin();
$page = $this->entities->page();
+ Comment::factory()->create(['commentable_id' => $page->id, 'commentable_type' => 'page', 'local_id' => 2]);
$comment = Comment::factory()->make(['parent_id' => 2]);
$resp = $this->postJson("/comment/$page->id", $comment->getAttributes());
$pageResp->assertSee($comment->html, false);
$this->assertDatabaseHas('comments', [
- 'local_id' => 1,
- 'entity_id' => $page->id,
- 'entity_type' => Page::newModelInstance()->getMorphClass(),
- 'text' => null,
+ 'local_id' => 3,
+ 'commentable_id' => $page->id,
+ 'commentable_type' => 'page',
'parent_id' => 2,
]);
]);
if ($valid) {
- $this->assertDatabaseHas('comments', ['entity_id' => $page->id, 'content_ref' => $ref]);
+ $this->assertDatabaseHas('comments', ['commentable_id' => $page->id, 'content_ref' => $ref]);
} else {
- $this->assertDatabaseMissing('comments', ['entity_id' => $page->id, 'content_ref' => $ref]);
+ $this->assertDatabaseMissing('comments', ['commentable_id' => $page->id, 'content_ref' => $ref]);
}
}
}
$this->assertDatabaseHas('comments', [
'html' => $newHtml,
- 'entity_id' => $page->id,
+ 'commentable_id' => $page->id,
]);
$this->assertActivityExists(ActivityType::COMMENT_UPDATE);
$page = $this->entities->page();
Comment::factory()->create([
'html' => '<script>superbadscript</script><script>superbadscript</script><p onclick="superbadonclick">scriptincommentest</p>',
- 'entity_type' => 'page', 'entity_id' => $page
+ 'commentable_type' => 'page', 'commentable_id' => $page
]);
$resp = $this->asAdmin()->get($page->getUrl());
$resp = $this->asAdmin()->post("/comment/{$page->id}", ['html' => $input]);
$resp->assertOk();
$this->assertDatabaseHas('comments', [
- 'entity_type' => 'page',
- 'entity_id' => $page->id,
+ 'commentable_type' => 'page',
+ 'commentable_id' => $page->id,
'html' => $expected,
]);
$resp = $this->asAdmin()->post("/comment/{$page->id}", ['html' => $input]);
$resp->assertOk();
$this->assertDatabaseHas('comments', [
- 'entity_type' => 'page',
- 'entity_id' => $page->id,
+ 'commentable_type' => 'page',
+ 'commentable_id' => $page->id,
'html' => $expected,
]);