function UniqueFieldConstraintTest::providerTestEntityWithStringIdWithViolation
Data provider for ::testEntityWithStringIdWithViolation().
Return value
array An array of test cases.
See also
self::testEntityWithStringIdWithViolation()
File
- 
              core/tests/ Drupal/ KernelTests/ Core/ Validation/ UniqueFieldConstraintTest.php, line 108 
Class
- UniqueFieldConstraintTest
- Tests the unique field value validation constraint.
Namespace
Drupal\KernelTests\Core\ValidationCode
public static function providerTestEntityWithStringIdWithViolation() {
  return [
    'without an id' => [
      NULL,
    ],
    'zero as integer' => [
      0,
    ],
    'zero as string' => [
      "0",
    ],
    'non-zero as integer' => [
      mt_rand(1, 127),
    ],
    'non-zero as string' => [
      (string) mt_rand(1, 127),
    ],
    'alphanumeric' => [
      Random::machineName(),
    ],
  ];
}Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.
