You are here

public function SiteAlertStorageTest::getCacheMaxAgeProvider in Site Alert 8

Data provider for ::testGetMaxAge().

Return value

array An array of test cases, each test case an array consisting of:

  • An array of identifiers for the site alerts that should be created at the start of the test.
  • An array of identifiers for the site alerts that are expected to be returned by the method under test.

See also

testGetMaxAge()

File

tests/src/Kernel/SiteAlertStorageTest.php, line 73

Class

SiteAlertStorageTest
Tests for the site alert entity storage handler.

Namespace

Drupal\Tests\site_alert\Kernel

Code

public function getCacheMaxAgeProvider() {
  return [
    [
      [],
      CacheBackendInterface::CACHE_PERMANENT,
    ],
    [
      [
        'unscheduled-active',
      ],
      CacheBackendInterface::CACHE_PERMANENT,
    ],
    [
      [
        'unscheduled-inactive',
      ],
      CacheBackendInterface::CACHE_PERMANENT,
    ],
    [
      [
        'past-active',
      ],
      CacheBackendInterface::CACHE_PERMANENT,
    ],
    [
      [
        'past-inactive',
      ],
      CacheBackendInterface::CACHE_PERMANENT,
    ],
    [
      [
        'present-active',
      ],
      // The `present-active` alert will disappear in 1 hour.
      1 * 60 * 60,
    ],
    [
      [
        'present-inactive',
      ],
      CacheBackendInterface::CACHE_PERMANENT,
    ],
    [
      [
        'future-active',
      ],
      // The `future-active` alert will appear in 2 hours.
      2 * 60 * 60,
    ],
    [
      [
        'future-inactive',
      ],
      CacheBackendInterface::CACHE_PERMANENT,
    ],
    [
      [
        'unscheduled-active',
        'present-active',
      ],
      // The `present-active` alert will disappear in 1 hour.
      1 * 60 * 60,
    ],
    [
      [
        'unscheduled-inactive',
        'past-active',
        'past-inactive',
        'future-active',
        'future-inactive',
      ],
      // The `future-active` alert will appear in 2 hours.
      2 * 60 * 60,
    ],
    [
      [
        'unscheduled-active',
        'unscheduled-inactive',
        'past-active',
        'past-inactive',
        'present-active',
        'present-inactive',
        'future-active',
        'future-inactive',
      ],
      // The `present-active` alert will disappear in 1 hour.
      1 * 60 * 60,
    ],
    [
      [
        'unscheduled-active',
        'unscheduled-active2',
        'present-active',
        'present-active2',
      ],
      // The `present-active` alerts will disappear in 1 hour.
      1 * 60 * 60,
    ],
    [
      [
        'unscheduled-inactive',
        'unscheduled-inactive2',
        'past-active',
        'past-active2',
        'past-inactive',
        'past-inactive2',
        'present-inactive',
        'present-inactive2',
        'future-active',
        'future-active2',
        'future-inactive',
        'future-inactive2',
      ],
      // The `future-active` alert will appear in 2 hours.
      2 * 60 * 60,
    ],
    [
      [
        'unscheduled-active',
        'unscheduled-active2',
        'unscheduled-inactive',
        'unscheduled-inactive2',
        'past-active',
        'past-active2',
        'past-inactive',
        'past-inactive2',
        'present-active',
        'present-active2',
        'present-inactive',
        'present-inactive2',
        'future-active',
        'future-active2',
        'future-inactive',
        'future-inactive2',
      ],
      // The `present-active` alerts will disappear in 1 hour.
      1 * 60 * 60,
    ],
  ];
}