function InspectorTest::providerTestAssertAllStrings

Same name in other branches
  1. 8.9.x core/tests/Drupal/Tests/Component/Assertion/InspectorTest.php \Drupal\Tests\Component\Assertion\InspectorTest::providerTestAssertAllStrings()
  2. 10 core/tests/Drupal/Tests/Component/Assertion/InspectorTest.php \Drupal\Tests\Component\Assertion\InspectorTest::providerTestAssertAllStrings()
  3. 11.x core/tests/Drupal/Tests/Component/Assertion/InspectorTest.php \Drupal\Tests\Component\Assertion\InspectorTest::providerTestAssertAllStrings()

File

core/tests/Drupal/Tests/Component/Assertion/InspectorTest.php, line 41

Class

InspectorTest
@coversDefaultClass \Drupal\Component\Assertion\Inspector @group Assertion

Namespace

Drupal\Tests\Component\Assertion

Code

public function providerTestAssertAllStrings() {
    $data = [
        'empty-array' => [
            [],
            TRUE,
        ],
        'array-with-strings' => [
            [
                'foo',
                'bar',
            ],
            TRUE,
        ],
        'string' => [
            'foo',
            FALSE,
        ],
        'array-with-strings-with-colon' => [
            [
                'foo',
                'bar',
                'llama:2001988',
                'baz',
                'llama:14031991',
            ],
            TRUE,
        ],
        'with-FALSE' => [
            [
                FALSE,
            ],
            FALSE,
        ],
        'with-TRUE' => [
            [
                TRUE,
            ],
            FALSE,
        ],
        'with-string-and-boolean' => [
            [
                'foo',
                FALSE,
            ],
            FALSE,
        ],
        'with-NULL' => [
            [
                NULL,
            ],
            FALSE,
        ],
        'string-with-NULL' => [
            [
                'foo',
                NULL,
            ],
            FALSE,
        ],
        'integer' => [
            [
                1337,
            ],
            FALSE,
        ],
        'string-and-integer' => [
            [
                'foo',
                1337,
            ],
            FALSE,
        ],
        'double' => [
            [
                3.14,
            ],
            FALSE,
        ],
        'string-and-double' => [
            [
                'foo',
                3.14,
            ],
            FALSE,
        ],
        'array' => [
            [
                [],
            ],
            FALSE,
        ],
        'string-and-array' => [
            [
                'foo',
                [],
            ],
            FALSE,
        ],
        'string-and-nested-array' => [
            [
                'foo',
                [
                    'bar',
                ],
            ],
            FALSE,
        ],
        'object' => [
            [
                new \stdClass(),
            ],
            FALSE,
        ],
        'string-and-object' => [
            [
                'foo',
                new StringObject(),
            ],
            FALSE,
        ],
    ];
    return $data;
}

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