ILIAS  trunk Revision v13.0_alpha-62-g3b72d83f2e5
UuidTest Class Reference
+ Inheritance diagram for UuidTest:
+ Collaboration diagram for UuidTest:

Public Member Functions

 test_init ()
 
 test_uuid4 ()
 
 test_uuid4_string ()
 
 test_uuid3_is_stable ()
 Name-based UUIDs must never change: they are stored and compared, e.g. More...
 
 test_from_string ()
 
 test_from_illegal_string ()
 

Private Attributes

const VALID_UUID4 = '/^[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[0-9a-f]{4}-[0-9a-f]{12}$/'
 
const UUID4 = 'f47ac10b-58cc-4372-a567-0e02b2c3d479'
 
const NO_UUID = 'lorem ipsum dolor'
 

Detailed Description

Definition at line 28 of file UuidTest.php.

Member Function Documentation

◆ test_from_illegal_string()

UuidTest::test_from_illegal_string ( )

Definition at line 95 of file UuidTest.php.

95 : void
96 {
97 $this->expectException(InvalidUuidStringException::class);
98
99 $factory = new Factory();
100 $factory->fromString(self::NO_UUID);
101 }

◆ test_from_string()

UuidTest::test_from_string ( )

Definition at line 85 of file UuidTest.php.

85 : void
86 {
87 $factory = new Factory();
88 $uuid = $factory->fromString(self::UUID4);
89
90 $this->assertMatchesRegularExpression(self::VALID_UUID4, $uuid->toString());
91 $this->assertEquals(self::UUID4, $uuid->toString());
92 }

References ILIAS\components\ResourceStorage\$uuid.

◆ test_init()

UuidTest::test_init ( )

Definition at line 36 of file UuidTest.php.

36 : Factory
37 {
38 return new Factory();
39 }

◆ test_uuid3_is_stable()

UuidTest::test_uuid3_is_stable ( )

Name-based UUIDs must never change: they are stored and compared, e.g.

as cmi5 registrations. Expected values cross-checked with Python's uuid.uuid3().

Definition at line 65 of file UuidTest.php.

65 : void
66 {
67 $factory = new Factory();
68
69 $this->assertSame(
70 'cdefba47-4fc6-3904-99e9-989195f87f2c',
71 $factory->uuid3AsString('6ba7b810-9dad-11d1-80b4-00c04fd430c8', 'www.ilias.de')
72 );
73 // namespace without hyphens, as stored by CmiXapi
74 $this->assertSame(
75 'd60304bc-9cb8-3988-9fa1-e6953cc506e7',
76 $factory->uuid3AsString('0123456789abcdef0123456789abcdef', '12-34')
77 );
78 $this->assertSame(
79 'cdefba47-4fc6-3904-99e9-989195f87f2c',
80 $factory->uuid3($factory->fromString('6ba7b810-9dad-11d1-80b4-00c04fd430c8'), 'www.ilias.de')->toString()
81 );
82 }

◆ test_uuid4()

UuidTest::test_uuid4 ( )

Definition at line 42 of file UuidTest.php.

42 : void
43 {
44 $factory = new Factory();
45 $uuid = $factory->uuid4();
46
47 $this->assertMatchesRegularExpression(self::VALID_UUID4, $uuid->toString());
48 }

References ILIAS\components\ResourceStorage\$uuid.

◆ test_uuid4_string()

UuidTest::test_uuid4_string ( )

Definition at line 51 of file UuidTest.php.

51 : void
52 {
53 $factory = new Factory();
54 $uuid = $factory->uuid4AsString();
55
56 $this->assertIsString($uuid);
57 $this->assertMatchesRegularExpression(self::VALID_UUID4, $uuid);
58 }

References ILIAS\components\ResourceStorage\$uuid.

Field Documentation

◆ NO_UUID

const UuidTest::NO_UUID = 'lorem ipsum dolor'
private

Definition at line 33 of file UuidTest.php.

◆ UUID4

const UuidTest::UUID4 = 'f47ac10b-58cc-4372-a567-0e02b2c3d479'
private

Definition at line 32 of file UuidTest.php.

◆ VALID_UUID4

const UuidTest::VALID_UUID4 = '/^[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[0-9a-f]{4}-[0-9a-f]{12}$/'
private

Definition at line 30 of file UuidTest.php.


The documentation for this class was generated from the following file: