UuidTest::testEquals()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 4
CRAP Score 1

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 3
nc 1
nop 0
dl 0
loc 5
ccs 4
cts 4
cp 1
crap 1
rs 10
c 1
b 0
f 0
1
<?php declare(strict_types=1);
2
/**
3
 * This file is part of the daikon-cqrs/value-object project.
4
 *
5
 * For the full copyright and license information, please view the LICENSE
6
 * file that was distributed with this source code.
7
 */
8
9
namespace Daikon\Tests\ValueObject;
10
11
use Daikon\ValueObject\Uuid;
12
use PHPUnit\Framework\TestCase;
13
14
final class UuidTest extends TestCase
15
{
16
    private const FIXED_UUID = '110ec58a-a0f2-4ac4-8393-c866d813b8d1';
17
18
    private Uuid $uuid;
19
20 1
    public function testToNative(): void
21
    {
22 1
        $this->assertEquals(null, Uuid::fromNative(null)->toNative());
23 1
        $this->assertEquals(self::FIXED_UUID, $this->uuid->toNative());
24 1
    }
25
26 1
    public function testEquals(): void
27
    {
28 1
        $this->assertTrue($this->uuid->equals(Uuid::fromNative(self::FIXED_UUID)));
29 1
        $this->assertFalse($this->uuid->equals(Uuid::generate()));
30 1
        $this->assertFalse($this->uuid->equals(Uuid::fromNative(null)));
31 1
    }
32
33 1
    public function testString(): void
34
    {
35 1
        $this->assertEquals(self::FIXED_UUID, (string)$this->uuid);
36 1
    }
37
38 3
    protected function setUp(): void
39
    {
40 3
        $this->uuid = Uuid::fromNative(self::FIXED_UUID);
41 3
    }
42
}
43