EmailTest   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 32
Duplicated Lines 0 %

Importance

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

3 Methods

Rating   Name   Duplication   Size   Complexity  
A filter() 0 4 1
A filterNotValid() 0 5 1
A filterNotString() 0 5 1
1
<?php
2
3
namespace TraderInteractive\Filter;
4
5
use PHPUnit\Framework\TestCase;
6
7
/**
8
 * @coversDefaultClass \TraderInteractive\Filter\Email
9
 * @covers ::<private>
10
 */
11
final class EmailTest extends TestCase
12
{
13
    /**
14
     * @test
15
     * @covers ::filter
16
     */
17
    public function filter()
18
    {
19
        $email = '[email protected]';
20
        $this->assertSame($email, Email::filter($email));
21
    }
22
23
    /**
24
     * @test
25
     * @covers ::filter
26
     */
27
    public function filterNotString()
28
    {
29
        $this->expectException(\TraderInteractive\Exceptions\FilterException::class);
30
        $this->expectExceptionMessage("Value '111222333444' is not a string");
31
        Email::filter(111222333444);
32
    }
33
34
    /**
35
     * @test
36
     * @covers ::filter
37
     */
38
    public function filterNotValid()
39
    {
40
        $this->expectException(\TraderInteractive\Exceptions\FilterException::class);
41
        $this->expectExceptionMessage("Value '@email.com' is not a valid email");
42
        Email::filter('@email.com');
43
    }
44
}
45