Add tests for Drupal Symfony Mailer (if non global reroute configuration is used)

Created on 13 October 2023, 9 months ago
Updated 5 January 2024, 6 months ago

Problem/Motivation

We need to add some basic tests for checked/unchecked "Use global configuration" in Drupal Symfony Mailer policy configuration.

πŸ› Bug report
Status

Needs work

Version

2.3

Component

Code

Created by

πŸ‡ΊπŸ‡¦Ukraine bohart Lutsk, Ukraine

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Merge Requests

Comments & Activities

  • Issue created by @bohart
  • πŸ‡ΊπŸ‡¦Ukraine bohart Lutsk, Ukraine
  • First commit to issue fork.
  • πŸ‡ΊπŸ‡¦Ukraine quadrexdev Lutsk

    Pushed the current state of the issue.

    What was added/changed:

    1. Subfolders for the Functional tests of a submodule.
    2. Policy tests that extend Global tests of a submodule.
    3. trait RerouteEmailPolicyTestTrait with a configureRerouteEmailPolicy method.
    4. Fixed an issue with the validateMultipleEmails method in SettingsForm. The problem was with the usage of ->getValue($element['#name'])

    In case we're configuring a rerouting on the policy form - the $element['#name'] was like that: "config[reroute_email][container..." so $addresses variable is always null. Fixed by changing this line to $element['#parents']
    5. Added getRerouteConfiguration() method that returns reroute configuration depending on the $rerouteConfigurationStorage property (configureRerouteEmailPolicy or configureRerouteEmailGlobal)
    6. Updated configureRerouteEmail() method so it executes a correct method depending on the $rerouteConfigurationStorage property + some required stuff like prefixes for post data.

  • Assigned to Abyss
  • πŸ‡ΊπŸ‡¦Ukraine Abyss
  • Status changed to Needs work 6 months ago
  • πŸ‡ΊπŸ‡¦Ukraine bohart Lutsk, Ukraine

    Hi @Abyss and @Quadrex,
    thanks for your contributions!

    A few further notes:
    1. Let's move RerouteEmailPolicyTestTrait into Policy folder, as it is used only there.

    2. policyConfigurationEditFormPath is used only in the trait.
    Why do we need to declare it in 6 tests?

    3. overridePolicyLink is used only once.
    Please move it from the class declaration to the setup method.

    4. Do we really need to specify strictConfigSchema now?

    5. It looks like 2 usages of getRerouteConfiguration() should be updated.
    (commented in MR)

    6. .gitlab-ci.yml updated in the wrong way. Tests are not running now.

    Thanks!

Production build 0.69.0 2024