Passed
Push — 1.0.0 ( 681a4e...b8a5a2 )
by Alex
01:34
created

testGivenAnInvalidEmailAnExceptionIsThrown()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 10
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 4
nc 1
nop 0
dl 0
loc 10
rs 10
c 1
b 0
f 0
1
<?php
2
3
namespace StraTDeS\VO\Tests;
4
5
use StraTDeS\VO\Name;
6
use PHPUnit\Framework\TestCase;
7
8
class NameTest extends TestCase
9
{
10
    public function testGivenAValidNameAValidVOIsReturned(): void
11
    {
12
        // Arrange
13
        $name = "John Smith";
14
15
        // Act
16
        $nameVO = Name::fromValue($name);
17
18
        // Assert
19
        $this->assertInstanceOf(Name::class, $nameVO);
20
        $this->assertEquals($name, $nameVO->value());
21
    }
22
23
    public function testGivenAnInvalidEmailAnExceptionIsThrown(): void
24
    {
25
        $this->expectException(\InvalidArgumentException::class);
26
        $this->expectExceptionMessage("Name value must have at least one character");
27
28
        // Arrange
29
        $name = "";
30
31
        // Act
32
        Name::fromValue($name);
33
    }
34
}
35