This commit is contained in:
2025-02-03 18:49:47 +03:00
parent f1a79d66ec
commit dd62ad0ca4
1739 changed files with 154102 additions and 0 deletions

View File

@@ -0,0 +1,51 @@
<?php
namespace goodboyalex\php_components_pack\tests\extensions;
use goodboyalex\php_components_pack\extensions\GUIDExtension;
use PHPUnit\Framework\TestCase;
class GUIDExtensionTest extends TestCase
{
public function testGenerate ()
{
$this->PrepareForTest();
$guid = GUIDExtension::Generate();
$this->assertTrue(strlen($guid) === 36);
}
public function testIsNotValidOrEmpty ()
{
$this->PrepareForTest();
$guid = GUIDExtension::Generate();
$this->assertFalse(GUIDExtension::IsNotValidOrEmpty($guid));
$guid = '12345678-91101-1121-3141-516171819202';
$this->assertTrue(GUIDExtension::IsNotValidOrEmpty($guid));
$guid = GUIDExtension::GUIDEmpty;
$this->assertTrue(GUIDExtension::IsNotValidOrEmpty($guid));
}
public function testValidate ()
{
$this->PrepareForTest();
$guid = GUIDExtension::Generate();
$this->assertFalse(GUIDExtension::IsNotValidOrEmpty($guid));
$guid = '12345678-91101-1121-3141-516171819202';
$this->assertTrue(GUIDExtension::IsNotValidOrEmpty($guid));
$guid = GUIDExtension::GUIDEmpty;
$this->assertTrue(GUIDExtension::IsNotValidOrEmpty($guid));
}
private function PrepareForTest (): void
{
require_once __DIR__ . '/../../sources/extensions/StringExtension.php';
require_once __DIR__ . '/../../sources/extensions/GUIDExtension.php';
}
}