19 declare(strict_types=1);
21 require_once(
"vendor/composer/vendor/autoload.php");
30 private const VALID_UUID4 =
'/^[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[0-9a-f]{4}-[0-9a-f]{12}$/';
32 private const UUID4 =
'f47ac10b-58cc-4372-a567-0e02b2c3d479';
33 private const NO_UUID =
'lorem ipsum dolor';
35 #[\PHPUnit\Framework\Attributes\DoesNotPerformAssertions] 41 #[\PHPUnit\Framework\Attributes\Depends('test_init')] 45 $uuid = $factory->uuid4();
47 $this->assertMatchesRegularExpression(self::VALID_UUID4, $uuid->toString());
50 #[\PHPUnit\Framework\Attributes\Depends('test_init')] 54 $uuid = $factory->uuid4AsString();
56 $this->assertIsString($uuid);
57 $this->assertMatchesRegularExpression(self::VALID_UUID4, $uuid);
60 #[\PHPUnit\Framework\Attributes\Depends('test_init')] 64 $uuid = $factory->fromString(self::UUID4);
66 $this->assertMatchesRegularExpression(self::VALID_UUID4, $uuid->toString());
67 $this->assertEquals(self::UUID4, $uuid->toString());
70 #[\PHPUnit\Framework\Attributes\Depends('test_init')] 73 $this->expectException(InvalidUuidStringException::class);
76 $factory->fromString(self::NO_UUID);
test_from_illegal_string()