mirror of
https://github.com/ramsey/uuid.git
synced 2026-06-14 15:56:48 +03:00
36 lines
886 B
PHP
36 lines
886 B
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
namespace Ramsey\Uuid\Test\Generator;
|
|
|
|
use Ramsey\Uuid\Generator\PeclUuidTimeGenerator;
|
|
use phpmock\mockery\PHPMockery;
|
|
|
|
use const UUID_TYPE_TIME;
|
|
|
|
class PeclUuidTimeGeneratorTest extends PeclUuidTestCase
|
|
{
|
|
/**
|
|
* @runInSeparateProcess
|
|
* @preserveGlobalState disabled
|
|
*/
|
|
public function testGenerateCreatesUuidUsingPeclUuidMethods(): void
|
|
{
|
|
PHPMockery::mock('Ramsey\Uuid\Generator', 'uuid_create')
|
|
->once()
|
|
->with(UUID_TYPE_TIME)
|
|
->andReturn($this->uuidString);
|
|
|
|
PHPMockery::mock('Ramsey\Uuid\Generator', 'uuid_parse')
|
|
->once()
|
|
->with($this->uuidString)
|
|
->andReturn($this->uuidBinary);
|
|
|
|
$generator = new PeclUuidTimeGenerator();
|
|
$uuid = $generator->generate();
|
|
|
|
$this->assertSame($this->uuidBinary, $uuid);
|
|
}
|
|
}
|