Completed
Push — master ( 61c8d3...4f6348 )
by Tõnis
03:00
created

EmailsValidationFormTest::testProcess()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 3
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 0
1
<?php
2
namespace andmemasin\emailsvalidator;
3
4
use andmemasin\emailsvalidator\models\EmailsValidationForm;
5
use andmemasin\myabstract\test\ModelTestTrait;
6
7
class EmailsValidationFormTest extends \Codeception\Test\Unit
8
{
9
    use ModelTestTrait;
10
11
    /**
12
     * @var \andmemasin\emailsvalidator\UnitTester
13
     */
14
    protected $tester;
15
16
    /** @var EmailsValidationForm */
17
    protected $model;
18
19
    
20
    protected function _before()
21
    {
22
        $this->model = $this->baseObject();
23
    }
24
25
    protected function _after()
26
    {
27
    }
28
29
    public function testLoadEmailAddresses() {
30
        $this->model->textInput = "[email protected]\[email protected],[email protected]";
31
        $result = $this->invokeMethod($this->model, 'loadEmailAddresses');
0 ignored issues
show
Unused Code introduced by
$result is not used, you could remove the assignment.

This check looks for variable assignements that are either overwritten by other assignments or where the variable is not used subsequently.

$myVar = 'Value';
$higher = false;

if (rand(1, 6) > 3) {
    $higher = true;
} else {
    $higher = false;
}

Both the $myVar assignment in line 1 and the $higher assignment in line 2 are dead. The first because $myVar is never used and the second because $higher is always overwritten for every possible time line.

Loading history...
32
        $this->assertEquals(2, count($this->model->emailAddresses));
33
        $this->assertEquals(1, count($this->model->failingEmailAddresses));
34
    }
35
36
    public function testProcess() {
37
        $this->assertEquals(true, $this->model->process());
38
    }
39
40
41
42
    /**
43
     * Returns a good working LimeSurvey collector
44
     * @return EmailsValidationForm
45
     */
46
    public function baseObject(){
47
        $model = new EmailsValidationForm();
48
        return $model;
49
    }
50
51
}