BooleanTest   A
last analyzed

Complexity

Total Complexity 6

Size/Duplication

Total Lines 34
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 11
dl 0
loc 34
ccs 21
cts 21
cp 1
rs 10
c 1
b 0
f 0
wmc 6

6 Methods

Rating   Name   Duplication   Size   Complexity  
A testIsFalse() 0 3 1
A testIsTrue() 0 3 1
A testEquals() 0 5 1
A testToNative() 0 4 1
A testToString() 0 4 1
A testNegate() 0 3 1
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\BoolValue;
12
use PHPUnit\Framework\TestCase;
13
14
final class BooleanTest extends TestCase
15
{
16 1
    public function testToNative(): void
17
    {
18 1
        $this->assertTrue(BoolValue::fromNative(true)->toNative());
19 1
        $this->assertFalse(BoolValue::fromNative(false)->toNative());
20 1
    }
21
22 1
    public function testEquals(): void
23
    {
24 1
        $bool = BoolValue::fromNative(true);
25 1
        $this->assertTrue($bool->equals(BoolValue::fromNative(true)));
26 1
        $this->assertFalse($bool->equals(BoolValue::fromNative(false)));
27 1
    }
28
29 1
    public function testIsTrue(): void
30
    {
31 1
        $this->assertTrue(BoolValue::fromNative(true)->isTrue());
32 1
    }
33
34 1
    public function testIsFalse(): void
35
    {
36 1
        $this->assertTrue(BoolValue::fromNative(false)->isFalse());
37 1
    }
38
39 1
    public function testNegate(): void
40
    {
41 1
        $this->assertTrue(BoolValue::fromNative(false)->negate()->toNative());
42 1
    }
43
44 1
    public function testToString(): void
45
    {
46 1
        $this->assertEquals('true', (string)BoolValue::fromNative(true));
47 1
        $this->assertEquals('false', (string)BoolValue::fromNative(false));
48 1
    }
49
}
50