-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathUUID1Test.php
More file actions
75 lines (66 loc) · 1.57 KB
/
Copy pathUUID1Test.php
File metadata and controls
75 lines (66 loc) · 1.57 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
<?php
namespace Tests\Koded\Stdlib;
use InvalidArgumentException;
use Koded\Stdlib\UUID;
use PHPUnit\Framework\TestCase;
class UUID1Test extends TestCase
{
/**
* @test
*/
public function v1_with_mac_address()
{
$uuid = UUID::v1('08:60:6e:11:c0:8e');
$this->assertTrue(UUID::matches($uuid, 1));
$this->assertSame('1', $uuid[14], $uuid);
}
/**
* @test
*/
public function v1_with_integer_node()
{
$uuid = UUID::v1(0x7fffffff);
$this->assertTrue(UUID::matches($uuid, 1), $uuid);
}
/**
* @test
*/
public function v1_with_ipv6_node_is_not_supported()
{
$this->expectException(InvalidArgumentException::class);
UUID::v1('2001:db8:85a3:8d3:1319:8a2e:370:7348');
}
/**
* @test
*/
public function v1_with_invalid_node()
{
//$this->expectException(InvalidArgumentException::class);
$uuid = UUID::v1('192.168.100.97');
$this->assertSame('1', $uuid[14], $uuid);
}
/**
* @test
*/
public function v1_with_invalid_integer_node()
{
$this->expectException(InvalidArgumentException::class);
UUID::v1(2987918954764484727721);
}
/**
* @test
*/
public function v1_with_invalid_hexadecimal_node()
{
$this->expectException(InvalidArgumentException::class);
UUID::v1('z7ba3e22');
}
/**
* @test
*/
public function v1_created_without_node()
{
$uuid = UUID::v1();
$this->assertTrue(UUID::matches($uuid, 1));
}
}