Sharing some suggestions how to proceed with the tests.
The test for `NewCommentController` can be a functional test. There are lots of if-else blocks. So, the test should validate the behavior when a certain condition is true. Better add negative test cases as well that will validate the code written inside the `else` block. Let's say that you want to write a test case for the below code snippet taken from `NewCommentController`:
```
if ($this->flood->isAllowed('disqus.new_comment', $limit, $interval)) {
// Register a flood event; but it will be cleared if the request turns out
// to be genuine.
$this->flood->register('disqus.new_comment', $interval);
}
else {
return new Response('', 400);
}
```
0. Prepare some test comment, and flood configs.
1. Hit this endpoint `/disqus/new-comment/{comment_id}` such that `$this->flood->isAllowed('disqus.new_comment', $limit, $interval)` is true
2. Validate whether a record has been entered in the database. Basically validating this: `\Drupal\Core\Flood\DatabaseBackend::doInsert`
And, as a negative test case:
1. Hit this endpoint `/disqus/new-comment/{comment_id}` such that `$this->flood->isAllowed('disqus.new_comment', $limit, $interval)` is false
2. Validate that the page response is 400
---
Similarly, `NewCommentEventSubscriber::onNewComment` can also be a functionally. Try to create the action in test that is supposed to trigger event `NewCommentEvent::NEW_COMMENT`.
It might be tricky to have 100% test coverage of the methods. Try to have as much code coverage as possible.