Completed
Push — master ( 4193f8...194f4a )
by Pablo
03:02
created

EmailValueObjectTest::invalidEmailProvider()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 8
Code Lines 5

Duplication

Lines 8
Ratio 100 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 8
loc 8
rs 9.4285
cc 1
eloc 5
nc 1
nop 0
1
<?php
2
3
4
namespace PhpValueObjects\Tests\Identity;
5
6
7
use PhpValueObjects\Identity\Exception\InvalidEmailException;
8
use PhpValueObjects\Tests\BaseUnitTestCase;
9
10 View Code Duplication
class EmailValueObjectTest extends BaseUnitTestCase
0 ignored issues
show
Duplication introduced by
This class seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
11
{
12
    /**
13
     * @test
14
     */
15
    public function itShouldReturnEmail()
16
    {
17
        $email = $this->faker()->email;
18
19
        $emailVO = new EmailValueObject($email);
20
21
        $this->assertSame($email, $emailVO->value());
22
        $this->assertSame($email, $emailVO->__toString());
23
    }
24
25
    /**
26
     * @return array
27
     */
28
    public function invalidEmailProvider()
29
    {
30
        return [
31
            [null],
32
            [$this->faker()->numberBetween()],
1 ignored issue
show
Bug introduced by
The call to numberBetween() misses a required argument $min.

This check looks for function calls that miss required arguments.

Loading history...
33
            [$this->faker()->address],
34
        ];
35
    }
36
37
    /**
38
     * @test
39
     *
40
     * @dataProvider invalidEmailProvider
41
     */
42
    public function itShouldThrowsException($data)
43
    {
44
        $this->expectException(InvalidEmailException::class);
45
46
        new EmailValueObject($data);
47
    }
48
}
49