Passed
Branch moving_tests_around (1c37ee)
by Eduardo Gulias
04:42 queued 01:17
created

EmailValidatorTest::testValidationIsUsed()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 10
Code Lines 7

Duplication

Lines 10
Ratio 100 %

Importance

Changes 1
Bugs 1 Features 0
Metric Value
c 1
b 1
f 0
dl 10
loc 10
rs 9.4285
cc 1
eloc 7
nc 1
nop 0
1
<?php
2
3
namespace Egulias\Tests\EmailValidator;
4
5
use Egulias\EmailValidator\EmailValidator;
6
use Egulias\EmailValidator\Validation\MultipleValidationWithAnd;
7
8
class EmailValidatorTest extends \PHPUnit_Framework_TestCase
9
{
10 View Code Duplication
    public function testValidationIsUsed()
0 ignored issues
show
Duplication introduced by
This method 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
        $validator = new EmailValidator();
13
        $validation = $this->getMock("Egulias\\EmailValidator\\Validation\\EmailValidation");
14
        $validation->expects($this->once())->method("isValid")->willReturn(true);
15
        $validation->expects($this->once())->method("getWarnings")->willReturn([]);
16
        $validation->expects($this->once())->method("getError")->willReturn(null);
17
18
        $this->assertTrue($validator->isValid("[email protected]", $validation));
19
    }
20
    
21 View Code Duplication
    public function testMultipleValidation()
0 ignored issues
show
Duplication introduced by
This method 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...
22
    {
23
        $validator = new EmailValidator();
24
        $validation = $this->getMock("Egulias\\EmailValidator\\Validation\\EmailValidation");
25
        $validation->expects($this->once())->method("isValid")->willReturn(true);
26
        $validation->expects($this->once())->method("getWarnings")->willReturn([]);
27
        $validation->expects($this->once())->method("getError")->willReturn(null);
28
        $multiple = new MultipleValidationWithAnd([$validation]);
29
30
        $this->assertTrue($validator->isValid("[email protected]", $multiple));
31
    }
32
}
33