I noticed that the module didn't have any unit tests so I've set about adding one. As a starting point I've added a test that attempts to create a comment on a node, but using the default configuration as much as possible. This way the configuration can change without causing the test to break.

In order to do this I needed to also fix the schema file as that was a little broken.

Comments

philipnorton42 created an issue. See original summary.

philipnorton42’s picture

Status: Active » Needs review
StatusFileSize
new4 KB

Adding patch.

altagrade’s picture

Status: Needs review » Fixed

Fixed with https://www.drupal.org/commitlog/commit/100740/1d289bf7ca5e529caffdb739a... Thank you very much for adding the unit test.

altagrade’s picture

Status: Fixed » Needs work

Even-though the patch has been pushed, this still needs some work as per:

phpcs --standard=DrupalPractice protected_submissions

FILE: /var/www/web/modules/protected_submissions/tests/src/Functional/ProtectedSubmissionsTest.php
-----------------------------------------------------------------------------------------------------------------------------------------
FOUND 0 ERRORS AND 4 WARNINGS AFFECTING 4 LINES
-----------------------------------------------------------------------------------------------------------------------------------------
 37 | WARNING | t() calls should be avoided in classes, use \Drupal\Core\StringTranslation\StringTranslationTrait and $this->t() instead
 45 | WARNING | t() calls should be avoided in classes, use \Drupal\Core\StringTranslation\StringTranslationTrait and $this->t() instead
 71 | WARNING | t() calls should be avoided in classes, use \Drupal\Core\StringTranslation\StringTranslationTrait and $this->t() instead
 85 | WARNING | t() calls should be avoided in classes, use \Drupal\Core\StringTranslation\StringTranslationTrait and $this->t() instead
-----------------------------------------------------------------------------------------------------------------------------------------

Time: 123ms; Memory: 8MB

Thanks for your time!

philipnorton42’s picture

StatusFileSize
new1.66 KB

Thanks for looking at this. I've corrected the coding standards changes :)

philipnorton42’s picture

Status: Needs work » Needs review

altagrade’s picture

Status: Needs review » Fixed

Fixed with the last commit. Thanks a lot!

philipnorton42’s picture

Assigned: philipnorton42 » Unassigned

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.