toBeTrue() ->and(UuidHelper::isV4($uuidV7))->toBeFalse(); }); it('correctly checks if UUID is v7', function (): void { // GIVEN $uuidV4 = Uuid::uuid4(); $uuidV7 = Uuid::uuid7(); // WHEN & THEN expect(UuidHelper::isV7($uuidV7))->toBeTrue() ->and(UuidHelper::isV7($uuidV4))->toBeFalse(); }); it('gets version from string index fallback when fields are not Rfc4122', function (): void { // GIVEN $mockFields = \Mockery::mock(FieldsInterface::class); $mockUuid = \Mockery::mock(UuidInterface::class); $mockUuid->shouldReceive('getFields')->andReturn($mockFields); $mockUuid->shouldReceive('toString')->andReturn('00000000-0000-4000-8000-000000000000'); // WHEN $version = UuidHelper::version($mockUuid); // THEN expect($version)->toBe(4); }); it('returns 0 when UUID string length is shorter than 15 and not Rfc4122', function (): void { // GIVEN $mockFields = \Mockery::mock(FieldsInterface::class); $mockUuid = \Mockery::mock(UuidInterface::class); $mockUuid->shouldReceive('getFields')->andReturn($mockFields); $mockUuid->shouldReceive('toString')->andReturn('short'); // WHEN $version = UuidHelper::version($mockUuid); // THEN expect($version)->toBe(0); }); });