Problem/Motivation

Splitting task from #2791619: Test Monitoring Mail with real examples, this issue is created to add the missing hook_requirements checking for the monitoring_mail recipient in the runtime phase.

Proposed resolution

Implement a check for the monitoring_mail recipient in a hook_requirements() in the runtime phase.

Remaining tasks

User interface changes

API changes

Data model changes

Comments

tduong created an issue. See original summary.

tduong’s picture

Status: Active » Needs review
Parent issue: » #2791619: Test Monitoring Mail with real examples
StatusFileSize
new1.86 KB

Moved the code from the parent issue.

miro_dietiker’s picture

Status: Needs review » Needs work
Issue tags: +Needs tests
+++ b/modules/monitoring_mail/monitoring_mail.install
@@ -0,0 +1,49 @@
+    // @todo hook_requirements: no log = no mail

Remove.

Other than that, this looks fine.
But additionally, hook_requirements are about critical integrity constrains. You want to test what hook_requirements return based on the invalid settings.

ginovski’s picture

Status: Needs work » Needs review
StatusFileSize
new3.09 KB
new4.29 KB

1.Added test.
2.Removed todo.

tduong’s picture

Status: Needs review » Needs work
Issue tags: -Needs tests
  1. +++ b/modules/monitoring_mail/monitoring_mail.install
    @@ -0,0 +1,48 @@
    +        '@monitoring_settings' => Url::fromRoute('monitoring.settings')->toString(),
    

    Maybe would be nice to have this as a clickable link, so this needs to be Url::fromRoute()->setAbsolute()->toString().

  2. +++ b/modules/monitoring_mail/tests/src/Kernel/MonitoringMailKernelTest.php
    @@ -117,4 +117,46 @@ class MonitoringMailKernelTest extends MonitoringUnitTestBase {
    +    // Run monitoring_mail (Requirements) and make sure the message contains
    ...
    +    // Run monitoring_mail (Requirements) again and make sure it has warning
    ...
    +    // Run monitoring_mail (Requirements) again and make sure it has warning
    

    Please separate these steps you do in the test from the things you need set, just for readability.

Otherwise I guess it's alright.

berdir’s picture

1. No, that has nothing to do with absolute, that just adds the domain. to make it clickable, add a link tag to the translatable string.

ginovski’s picture

Status: Needs work » Needs review
StatusFileSize
new2.4 KB
new4.32 KB

Added blank lines and the link in the monitoring settings.

tduong’s picture

StatusFileSize
new11.94 KB

Oh, just checked and I noticed we should add a validation for this (?)

tduong’s picture

Status: Needs review » Reviewed & tested by the community

Alright, followups are there, and code looks fine for me.

@Ginovski, next time just remember to use [#issue number] when you post a comment referencing to another issue instead of the link.