<?php declare(strict_types=1); namespace Ramsey\Uuid\Test; use DateTimeInterface; use Mockery; use Ramsey\Uuid\Codec\CodecInterface; use Ramsey\Uuid\Converter\NumberConverterInterface; use Ramsey\Uuid\Converter\Time\GenericTimeConverter; use Ramsey\Uuid\Converter\TimeConverterInterface; use Ramsey\Uuid\Exception\DateTimeException; use Ramsey\Uuid\Math\BrickMathCalculator; use Ramsey\Uuid\Rfc4122\Fields; use Ramsey\Uuid\Rfc4122\FieldsInterface; use Ramsey\Uuid\Type\Hexadecimal; use Ramsey\Uuid\Type\Time; use Ramsey\Uuid\Uuid; class DeprecatedUuidMethodsTraitTest extends TestCase { public function testGetDateTime(): void { $calculator = new BrickMathCalculator(); $fields = new Fields((string) hex2bin('ff6f8cb0c57d11e19b210800200c9a66')); $numberConverter = Mockery::mock(NumberConverterInterface::class); $codec = Mockery::mock(CodecInterface::class); $timeConverter = new GenericTimeConverter($calculator); $uuid = new Uuid($fields, $numberConverter, $codec, $timeConverter); $this->assertInstanceOf(DateTimeInterface::class, $uuid->getDateTime()); $this->assertSame('2012-07-04T02:14:34+00:00', $uuid->getDateTime()->format('c')); $this->assertSame('1341368074.491000', $uuid->getDateTime()->format('U.u')); } public function testGetDateTimeThrowsException(): void { $fields = Mockery::mock(FieldsInterface::class, [ 'getVersion' => 1, 'getTimestamp' => new Hexadecimal('0'), ]); $numberConverter = Mockery::mock(NumberConverterInterface::class); $codec = Mockery::mock(CodecInterface::class); $timeConverter = Mockery::mock(TimeConverterInterface::class, [ 'convertTime' => new Time('0', '1234567'), ]); $uuid = new Uuid($fields, $numberConverter, $codec, $timeConverter); $this->expectException(DateTimeException::class); $uuid->getDateTime(); } }
Name | Type | Size | Permission | Actions |
---|---|---|---|---|
Builder | Folder | 0755 |
|
|
Codec | Folder | 0755 |
|
|
Converter | Folder | 0755 |
|
|
Encoder | Folder | 0755 |
|
|
Generator | Folder | 0755 |
|
|
Guid | Folder | 0755 |
|
|
Math | Folder | 0755 |
|
|
Nonstandard | Folder | 0755 |
|
|
Provider | Folder | 0755 |
|
|
Rfc4122 | Folder | 0755 |
|
|
Type | Folder | 0755 |
|
|
Validator | Folder | 0755 |
|
|
benchmark | Folder | 0755 |
|
|
static-analysis | Folder | 0755 |
|
|
BinaryUtilsTest.php | File | 6.93 KB | 0644 |
|
DeprecatedUuidMethodsTraitTest.php | File | 1.99 KB | 0644 |
|
ExpectedBehaviorTest.php | File | 28.31 KB | 0644 |
|
FeatureSetTest.php | File | 2.63 KB | 0644 |
|
FunctionsTest.php | File | 4 KB | 0644 |
|
TestCase.php | File | 572 B | 0644 |
|
UuidFactoryTest.php | File | 8.35 KB | 0644 |
|
UuidTest.php | File | 73.48 KB | 0644 |
|
bootstrap.php | File | 231 B | 0644 |
|