Passed
Pull Request — master (#69)
by Chris
17:32 queued 08:49
created

DelegateTest::testFromArray()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 16
Code Lines 13

Duplication

Lines 16
Ratio 100 %

Importance

Changes 0
Metric Value
cc 1
eloc 13
nc 1
nop 0
dl 16
loc 16
rs 9.4285
c 0
b 0
f 0
1
<?php
2
3
namespace ConferenceTools\Tickets\Domain\ValueObject;
4
5
use PHPUnit\Framework\TestCase;
6
7
class DelegateTest extends TestCase
8
{
9 View Code Duplication
    public function testFromArray()
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...
10
    {
11
        $data['firstname']= 'Ed';
0 ignored issues
show
Comprehensibility Best Practice introduced by
$data was never initialized. Although not strictly required by PHP, it is generally a good practice to add $data = array(); before regardless.
Loading history...
12
        $data['lastname'] = 'Nigma';
13
        $data['email'] = '[email protected]';
14
        $data['company'] = 'Mystery Inc.';
15
        $data['twitter'] = '@ed_nigma';
16
        $data['requirements'] = 'none';
17
18
        $sut = Delegate::fromArray($data);
19
        self::assertEquals($data['firstname'], $sut->getFirstname());
20
        self::assertEquals($data['lastname'], $sut->getLastname());
21
        self::assertEquals($data['email'], $sut->getEmail());
22
        self::assertEquals($data['company'], $sut->getCompany());
23
        self::assertEquals($data['twitter'], $sut->getTwitter());
24
        self::assertEquals($data['requirements'], $sut->getRequirements());
25
    }
26
27 View Code Duplication
    public function testEmpty()
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...
28
    {
29
        $data['firstname']= '';
0 ignored issues
show
Comprehensibility Best Practice introduced by
$data was never initialized. Although not strictly required by PHP, it is generally a good practice to add $data = array(); before regardless.
Loading history...
30
        $data['lastname'] = '';
31
        $data['email'] = '';
32
        $data['company'] = '';
33
        $data['twitter'] = '';
34
        $data['requirements'] = '';
35
36
        $sut = Delegate::emptyObject();
37
        self::assertEquals($data['firstname'], $sut->getFirstname());
38
        self::assertEquals($data['lastname'], $sut->getLastname());
39
        self::assertEquals($data['email'], $sut->getEmail());
40
        self::assertEquals($data['company'], $sut->getCompany());
41
        self::assertEquals($data['twitter'], $sut->getTwitter());
42
        self::assertEquals($data['requirements'], $sut->getRequirements());
43
    }
44
}
45