function CacheTest::validateTagsProvider

Same name and namespace in other branches
  1. 8.9.x core/tests/Drupal/Tests/Core/Cache/CacheTest.php \Drupal\Tests\Core\Cache\CacheTest::validateTagsProvider()
  2. 10 core/tests/Drupal/Tests/Core/Cache/CacheTest.php \Drupal\Tests\Core\Cache\CacheTest::validateTagsProvider()
  3. 11.x core/tests/Drupal/Tests/Core/Cache/CacheTest.php \Drupal\Tests\Core\Cache\CacheTest::validateTagsProvider()

Provides a list of cache tags arrays.

Return value

array

File

core/tests/Drupal/Tests/Core/Cache/CacheTest.php, line 22

Class

CacheTest
@coversDefaultClass <a href="/api/drupal/core%21lib%21Drupal%21Core%21Cache%21Cache.php/class/Cache/9" title="Helper methods for cache." class="local">\Drupal\Core\Cache\Cache</a> @group Cache

Namespace

Drupal\Tests\Core\Cache

Code

public function validateTagsProvider() {
    return [
        [
            [],
            FALSE,
        ],
        [
            [
                'foo',
            ],
            FALSE,
        ],
        [
            [
                'foo',
                'bar',
            ],
            FALSE,
        ],
        [
            [
                'foo',
                'bar',
                'llama:2001988',
                'baz',
                'llama:14031991',
            ],
            FALSE,
        ],
        // Invalid.
[
            [
                FALSE,
            ],
            'Cache tags must be strings, boolean given.',
        ],
        [
            [
                TRUE,
            ],
            'Cache tags must be strings, boolean given.',
        ],
        [
            [
                'foo',
                FALSE,
            ],
            'Cache tags must be strings, boolean given.',
        ],
        [
            [
                NULL,
            ],
            'Cache tags must be strings, NULL given.',
        ],
        [
            [
                'foo',
                NULL,
            ],
            'Cache tags must be strings, NULL given.',
        ],
        [
            [
                1337,
            ],
            'Cache tags must be strings, integer given.',
        ],
        [
            [
                'foo',
                1337,
            ],
            'Cache tags must be strings, integer given.',
        ],
        [
            [
                3.14,
            ],
            'Cache tags must be strings, double given.',
        ],
        [
            [
                'foo',
                3.14,
            ],
            'Cache tags must be strings, double given.',
        ],
        [
            [
                [],
            ],
            'Cache tags must be strings, array given.',
        ],
        [
            [
                'foo',
                [],
            ],
            'Cache tags must be strings, array given.',
        ],
        [
            [
                'foo',
                [
                    'bar',
                ],
            ],
            'Cache tags must be strings, array given.',
        ],
        [
            [
                new \stdClass(),
            ],
            'Cache tags must be strings, object given.',
        ],
        [
            [
                'foo',
                new \stdClass(),
            ],
            'Cache tags must be strings, object given.',
        ],
    ];
}

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