2022-06-12 15:01:34 +02:00
|
|
|
<?php
|
|
|
|
|
2023-02-03 20:41:59 +01:00
|
|
|
declare(strict_types=1);
|
|
|
|
|
2022-06-12 15:01:34 +02:00
|
|
|
namespace Engelsystem\Test\Unit\Helpers;
|
|
|
|
|
|
|
|
use Engelsystem\Application;
|
2022-12-31 16:25:16 +01:00
|
|
|
use Engelsystem\Helpers\Uuid;
|
2022-06-12 15:01:34 +02:00
|
|
|
use Engelsystem\Helpers\UuidServiceProvider;
|
|
|
|
use Engelsystem\Test\Unit\ServiceProviderTest;
|
|
|
|
use Illuminate\Support\Str;
|
2022-12-31 16:25:16 +01:00
|
|
|
use ReflectionProperty;
|
2022-06-12 15:01:34 +02:00
|
|
|
|
|
|
|
class UuidServiceProviderTest extends ServiceProviderTest
|
|
|
|
{
|
|
|
|
/**
|
|
|
|
* @covers \Engelsystem\Helpers\UuidServiceProvider::register
|
|
|
|
*/
|
2022-12-14 19:15:20 +01:00
|
|
|
public function testRegister(): void
|
2022-06-12 15:01:34 +02:00
|
|
|
{
|
|
|
|
$app = new Application();
|
|
|
|
|
|
|
|
$serviceProvider = new UuidServiceProvider($app);
|
|
|
|
$serviceProvider->register();
|
|
|
|
|
2022-12-31 16:25:16 +01:00
|
|
|
$uuidFactoryReference = (new ReflectionProperty(Str::class, 'uuidFactory'))
|
|
|
|
->getValue();
|
|
|
|
|
|
|
|
$this->assertIsCallable($uuidFactoryReference);
|
|
|
|
$this->assertIsString($uuidFactoryReference);
|
|
|
|
$this->assertEquals(Uuid::class . '::uuid', $uuidFactoryReference);
|
|
|
|
|
|
|
|
$this->assertTrue(Str::isUuid(Str::uuid()), 'Is a UUID');
|
2022-06-12 15:01:34 +02:00
|
|
|
}
|
|
|
|
}
|