20250723 1.2 Бета 2
This commit is contained in:
103
tests/types/GUIDTest.php
Normal file
103
tests/types/GUIDTest.php
Normal file
@@ -0,0 +1,103 @@
|
||||
<?php
|
||||
|
||||
namespace goodboyalex\php_components_pack\tests\types;
|
||||
|
||||
use goodboyalex\php_components_pack\types\GUID;
|
||||
use PHPUnit\Framework\TestCase;
|
||||
|
||||
class GUIDTest extends TestCase
|
||||
{
|
||||
public function test__construct ()
|
||||
{
|
||||
$this->PrepareForTest();
|
||||
|
||||
$guid = new GUID();
|
||||
|
||||
$this->assertEquals(GUID::Empty(), $guid->ToString());
|
||||
}
|
||||
|
||||
private function PrepareForTest (): void
|
||||
{
|
||||
require_once __DIR__ . '/../../sources/interfaces/ISerializable.php';
|
||||
require_once __DIR__ . '/../../sources/interfaces/IArrayable.php';
|
||||
require_once __DIR__ . '/../../sources/interfaces/IComparable.php';
|
||||
require_once __DIR__ . '/../../sources/interfaces/IHashable.php';
|
||||
require_once __DIR__ . '/../../sources/interfaces/IDuplicated.php';
|
||||
require_once __DIR__ . '/../../sources/types/GUID.php';
|
||||
}
|
||||
|
||||
public function testSegment ()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public function testToString ()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public function testIsInvalidOrEmpty ()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public function testParse ()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public function test__toString ()
|
||||
{
|
||||
}
|
||||
|
||||
public function testToBytes ()
|
||||
{
|
||||
$this->PrepareForTest();
|
||||
|
||||
$guid = new GUID ('00000000-0000-0000-0000-000000000000');
|
||||
|
||||
$bytes = $guid->ToBytes();
|
||||
|
||||
$this->assertCount(16, $bytes);
|
||||
|
||||
$this->assertEquals(0, $bytes[0]);
|
||||
$this->assertEquals(0, $bytes[1]);
|
||||
$this->assertEquals(0, $bytes[2]);
|
||||
$this->assertEquals(0, $bytes[3]);
|
||||
$this->assertEquals(0, $bytes[4]);
|
||||
$this->assertEquals(0, $bytes[5]);
|
||||
$this->assertEquals(0, $bytes[6]);
|
||||
$this->assertEquals(0, $bytes[7]);
|
||||
$this->assertEquals(0, $bytes[8]);
|
||||
$this->assertEquals(0, $bytes[9]);
|
||||
$this->assertEquals(0, $bytes[10]);
|
||||
$this->assertEquals(0, $bytes[11]);
|
||||
$this->assertEquals(0, $bytes[12]);
|
||||
$this->assertEquals(0, $bytes[13]);
|
||||
$this->assertEquals(0, $bytes[14]);
|
||||
$this->assertEquals(0, $bytes[15]);
|
||||
}
|
||||
|
||||
public function testGenerate ()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public function testFromBytes ()
|
||||
{
|
||||
// Создаю массив
|
||||
$array = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0];
|
||||
|
||||
// Конвертирую
|
||||
$guid = GUID::FromBytes($array);
|
||||
|
||||
// И вывожу его
|
||||
self::assertEquals('00000000-0000-0000-0000-000000000000', $guid->ToString());
|
||||
|
||||
}
|
||||
|
||||
public function testValidate ()
|
||||
{
|
||||
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user