Passed
Branch master (bab720)
by Rasmus
10:39
created

AddressCest   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 18
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 9
dl 0
loc 18
rs 10
c 1
b 0
f 0
wmc 2

2 Methods

Rating   Name   Duplication   Size   Complexity  
A preventNameInjection() 0 6 1
A rejectInvalidEmailAddress() 0 6 1
1
<?php
2
3
namespace Kodus\Mail\Test\Unit;
4
5
use InvalidArgumentException;
6
use Kodus\Mail\Address;
7
use RuntimeException;
8
use UnitTester;
9
10
class AddressCest
11
{
12
    public function rejectInvalidEmailAddress(UnitTester $I)
13
    {
14
        $I->assertException(
15
            InvalidArgumentException::class,
16
            function () {
17
                new Address("foo@bar");
18
            }
19
        );
20
    }
21
22
    public function preventNameInjection(UnitTester $I)
23
    {
24
        $I->assertException(
25
            RuntimeException::class,
26
            function () {
27
                new Address("[email protected]", "Foo\nBar");
28
            }
29
        );
30
    }
31
}
32