20250203
This commit is contained in:
51
tests/extensions/GUIDExtensionTest.php
Normal file
51
tests/extensions/GUIDExtensionTest.php
Normal 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';
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user