Changeset View
Changeset View
Standalone View
Standalone View
tests/Strings/UUIDTest.php
- This file was added.
<?php | |||||
declare(strict_types=1); | |||||
namespace Keruald\OmniTools\Tests\Strings; | |||||
use Keruald\OmniTools\Strings\UUID; | |||||
use Phpunit\Framework\TestCase; | |||||
class UUIDTest extends TestCase { | |||||
public function testUUIDv4 () : void { | |||||
$uuid = UUID::UUIDv4(); | |||||
$this->assertEquals( | |||||
36, strlen($uuid), | |||||
"UUID size must be 36 characters." | |||||
); | |||||
$re = "/[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}/"; | |||||
$this->assertRegExp($re, $uuid); | |||||
} | |||||
public function testUUIDv4AreUnique () : void { | |||||
$this->assertNotEquals(UUID::UUIDv4(), UUID::UUIDv4()); | |||||
} | |||||
} |
Nasqueron DevCentral · If it had been much bigger the moon would have had a core of ice. · Powered by Phabricator