Implement comments
This commit is contained in:
@@ -125,4 +125,26 @@ class PostControllerTest extends WebTestCase
|
||||
self::assertResponseRedirects('/');
|
||||
self::assertSame(0, $this->repository->count());
|
||||
}
|
||||
|
||||
public function testPostComment()
|
||||
{
|
||||
$fixture = new Post();
|
||||
$fixture->setFoundDate(new \DateTimeImmutable('2024-01-01 00:00:00'));
|
||||
$fixture->setCommentary('Cool stuff');
|
||||
|
||||
$this->manager->persist($fixture);
|
||||
$this->manager->flush();
|
||||
|
||||
$this->client->request('GET', sprintf('%s%s', $this->path, $fixture->getId()));
|
||||
|
||||
self::assertResponseStatusCodeSame(200);
|
||||
|
||||
$this->client->submitForm('Comment', [
|
||||
'comment[content]' => 'This is a comment',
|
||||
]);
|
||||
|
||||
self::assertResponseRedirects(sprintf('%s%s', $this->path, $fixture->getId()));
|
||||
$comments = $this->repository->find($fixture->getId())->getComments();
|
||||
self::assertSame(1, $comments->count());
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user