mirror of
https://github.com/ramsey/uuid.git
synced 2026-06-14 15:56:48 +03:00
Modify tests
This commit is contained in:
committed by
Ben Ramsey
parent
4109ad85a9
commit
1d13922f0c
@@ -363,6 +363,9 @@ class ExpectedBehaviorTest extends TestCase
|
||||
'uuid3' => $uuid,
|
||||
'uuid4' => $uuid,
|
||||
'uuid5' => $uuid,
|
||||
'uuid6' => $uuid,
|
||||
'uuid7' => $uuid,
|
||||
'uuid8' => $uuid,
|
||||
'fromBytes' => $uuid,
|
||||
'fromString' => $uuid,
|
||||
'fromInteger' => $uuid,
|
||||
@@ -377,6 +380,9 @@ class ExpectedBehaviorTest extends TestCase
|
||||
$this->assertSame($uuid, Uuid::uuid3(Uuid::NAMESPACE_URL, 'https://example.com/foo'));
|
||||
$this->assertSame($uuid, Uuid::uuid4());
|
||||
$this->assertSame($uuid, Uuid::uuid5(Uuid::NAMESPACE_URL, 'https://example.com/foo'));
|
||||
$this->assertSame($uuid, Uuid::uuid6());
|
||||
$this->assertSame($uuid, Uuid::uuid7());
|
||||
$this->assertSame($uuid, Uuid::uuid8(hex2bin('ffffffffffffffffffffffffffffffff')));
|
||||
$this->assertSame($uuid, Uuid::fromBytes($bytes));
|
||||
$this->assertSame($uuid, Uuid::fromString('ffffffff-ffff-ffff-ffff-ffffffffffff'));
|
||||
$this->assertSame($uuid, Uuid::fromInteger('340282366920938463463374607431768211455'));
|
||||
|
||||
@@ -10,7 +10,6 @@ use Brick\Math\RoundingMode;
|
||||
use DateTimeImmutable;
|
||||
use DateTimeInterface;
|
||||
use Mockery;
|
||||
use Mockery\MockInterface;
|
||||
use PHPUnit\Framework\Attributes\DataProvider;
|
||||
use PHPUnit\Framework\MockObject\MockObject;
|
||||
use Ramsey\Uuid\Codec\StringCodec;
|
||||
@@ -673,19 +672,6 @@ class UuidTest extends TestCase
|
||||
$this->assertSame(Version::UnixTime, $uuid->getFields()->getVersion());
|
||||
}
|
||||
|
||||
public function testUuid7ThrowsExceptionForUnsupportedFactory(): void
|
||||
{
|
||||
/** @var UuidFactoryInterface&MockInterface $factory */
|
||||
$factory = Mockery::mock(UuidFactoryInterface::class);
|
||||
|
||||
Uuid::setFactory($factory);
|
||||
|
||||
$this->expectException(UnsupportedOperationException::class);
|
||||
$this->expectExceptionMessage('The provided factory does not support the uuid7() method');
|
||||
|
||||
Uuid::uuid7();
|
||||
}
|
||||
|
||||
public function testUuid7WithDateTime(): void
|
||||
{
|
||||
$dateTime = new DateTimeImmutable('@281474976710.655');
|
||||
@@ -776,20 +762,6 @@ class UuidTest extends TestCase
|
||||
$this->assertSame(Version::Custom, $uuid->getFields()->getVersion());
|
||||
}
|
||||
|
||||
public function testUuid8ThrowsExceptionForUnsupportedFactory(): void
|
||||
{
|
||||
/** @var UuidFactoryInterface&MockInterface $factory */
|
||||
$factory = Mockery::mock(UuidFactoryInterface::class);
|
||||
|
||||
Uuid::setFactory($factory);
|
||||
|
||||
$this->expectException(UnsupportedOperationException::class);
|
||||
$this->expectExceptionMessage('The provided factory does not support the uuid8() method');
|
||||
|
||||
/** @phpstan-ignore staticMethod.resultUnused */
|
||||
Uuid::uuid8("\x00\x11\x22\x33\x44\x55\x66\x77\x88\x99\xaa\xbb\xcc\xdd\xee\xff");
|
||||
}
|
||||
|
||||
/**
|
||||
* Tests known version-3 UUIDs
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user