function UpdateMailTest::providerTestUpdateEmail

Same name in other branches
  1. 11.x core/modules/update/tests/src/Unit/UpdateMailTest.php \Drupal\Tests\update\Unit\UpdateMailTest::providerTestUpdateEmail()

Provides data for ::testUpdateEmail.

Return value

array

  • The value of the update setting 'notification.threshold'.
  • An array of parameters for update_mail.
  • TRUE if the user is authorized.
  • An array of message body strings.

File

core/modules/update/tests/src/Unit/UpdateMailTest.php, line 184

Class

UpdateMailTest
Tests text of update email.

Namespace

Drupal\Tests\update\Unit

Code

public static function providerTestUpdateEmail() : array {
    return [
        'all' => [
            'all',
            [],
            FALSE,
            [
                "See the available updates page for more information:\nhttps://example.com/admin/reports/updates/settings",
                'Your site is currently configured to send these emails when any updates are available. To get notified only for security updates, https://example.com/admin/reports/updates.',
            ],
        ],
        'security' => [
            'security',
            [],
            FALSE,
            [
                "See the available updates page for more information:\nhttps://example.com/admin/reports/updates/settings",
                'Your site is currently configured to send these emails only when security updates are available. To get notified for any available updates, https://example.com/admin/reports/updates.',
            ],
        ],
        // Choose parameters that do not require changes to the mocks.
'not secure' => [
            'security',
            [
                'core' => UpdateManagerInterface::NOT_SECURE,
                'contrib' => NULL,
            ],
            FALSE,
            [
                "There is a security update available for your version of Drupal. To ensure the security of your server, you should update immediately!",
                '',
                "See the available updates page for more information:\nhttps://example.com/admin/reports/updates/settings",
                "Your site is currently configured to send these emails only when security updates are available. To get notified for any available updates, https://example.com/admin/reports/updates.",
            ],
        ],
        'authorize' => [
            'all',
            [],
            TRUE,
            [
                "See the available updates page for more information:\nhttps://example.com/admin/reports/updates/settings",
                "You can automatically download your missing updates using the Update manager:\nhttps://example.com/admin/reports/updates",
                'Your site is currently configured to send these emails when any updates are available. To get notified only for security updates, https://example.com/admin/reports/updates.',
            ],
        ],
    ];
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.