SearchResultTest   A
last analyzed

Complexity

Total Complexity 1

Size/Duplication

Total Lines 41
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 2

Importance

Changes 0
Metric Value
wmc 1
lcom 1
cbo 2
dl 0
loc 41
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A testGettersAndSetters() 0 18 1
1
<?php
2
3
namespace SumoCoders\FrameworkSearchBundle\Tests\Entity;
4
5
use SumoCoders\FrameworkSearchBundle\Entity\SearchResult;
6
7
class SearchResultTest extends \PHPUnit_Framework_TestCase
8
{
9
    /**
10
     * @var SumoCoders\FrameworkSearchBundle\Entity\SearchResult
11
     */
12
    private $searchResult;
13
14
    /**
15
     * @var array
16
     */
17
    private $defaultData = array(
18
        'class' => 'User',
19
        'id' => 1,
20
        'bundle' => 'users',
21
        'title' => 'J. Doe',
22
        'route' => '/en/users/1',
23
        'weight' => 100,
24
    );
25
26
    /**
27
     * Test the getters and setters
28
     */
29
    public function testGettersAndSetters()
30
    {
31
        $this->searchResult = new SearchResult(
0 ignored issues
show
Documentation Bug introduced by
It seems like new \SumoCoders\Framewor...->defaultData['route']) of type object<SumoCoders\Framew...le\Entity\SearchResult> is incompatible with the declared type object<SumoCoders\Framew...le\Entity\SearchResult> of property $searchResult.

Our type inference engine has found an assignment to a property that is incompatible with the declared type of that property.

Either this assignment is in error or the assigned type should be added to the documentation/type hint for that property..

Loading history...
32
            $this->defaultData['class'],
33
            $this->defaultData['id'],
34
            $this->defaultData['bundle'],
35
            $this->defaultData['title'],
36
            $this->defaultData['route']
37
        );
38
        $this->searchResult->setWeight($this->defaultData['weight']);
39
40
        $this->assertEquals($this->defaultData['class'], $this->searchResult->getClass());
41
        $this->assertEquals($this->defaultData['id'], $this->searchResult->getId());
42
        $this->assertEquals($this->defaultData['bundle'], $this->searchResult->getBundle());
43
        $this->assertEquals($this->defaultData['title'], $this->searchResult->getTitle());
44
        $this->assertEquals($this->defaultData['route'], $this->searchResult->getRoute());
45
        $this->assertEquals($this->defaultData['weight'], $this->searchResult->getWeight());
46
    }
47
}
48