function UuidTest::providerTestValidation

Same name in other branches
  1. 9 core/tests/Drupal/Tests/Component/Uuid/UuidTest.php \Drupal\Tests\Component\Uuid\UuidTest::providerTestValidation()
  2. 8.9.x core/tests/Drupal/Tests/Component/Uuid/UuidTest.php \Drupal\Tests\Component\Uuid\UuidTest::providerTestValidation()
  3. 11.x core/tests/Drupal/Tests/Component/Uuid/UuidTest.php \Drupal\Tests\Component\Uuid\UuidTest::providerTestValidation()

Data provider for UUID instance tests.

Return value

array An array of arrays containing

  • The Uuid to check against.
  • (bool) Whether or not the Uuid is valid.
  • Failure message.

File

core/tests/Drupal/Tests/Component/Uuid/UuidTest.php, line 87

Class

UuidTest
Tests the handling of Universally Unique Identifiers (UUIDs).

Namespace

Drupal\Tests\Component\Uuid

Code

public static function providerTestValidation() {
    return [
        // These valid UUIDs.
[
            '6ba7b810-9dad-11d1-80b4-00c04fd430c8',
            TRUE,
            'Basic FQDN UUID did not validate',
        ],
        [
            '00000000-0000-0000-0000-000000000000',
            TRUE,
            'Minimum UUID did not validate',
        ],
        [
            'ffffffff-ffff-ffff-ffff-ffffffffffff',
            TRUE,
            'Maximum UUID did not validate',
        ],
        // These are invalid UUIDs.
[
            '0ab26e6b-f074-4e44-9da-601205fa0e976',
            FALSE,
            'Invalid format was validated',
        ],
        [
            '0ab26e6b-f074-4e44-9daf-1205fa0e9761f',
            FALSE,
            'Invalid length was validated',
        ],
    ];
}

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