Passed
Push — master ( 356755...14835f )
by Gerrit
04:25
created

ListMappingTest::shouldHaveOrigin()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 4
rs 10
c 0
b 0
f 0
cc 1
eloc 2
nc 1
nop 0
1
<?php
2
/**
3
 * Copyright (C) 2017  Gerrit Addiks.
4
 * This package (including this file) was released under the terms of the GPL-3.0.
5
 * You should have received a copy of the GNU General Public License along with this program.
6
 * If not, see <http://www.gnu.org/licenses/> or send me a mail so i can send you a copy.
7
 * @license GPL-3.0
8
 * @author Gerrit Addiks <[email protected]>
9
 */
10
11
namespace Addiks;
12
13
use PHPUnit\Framework\TestCase;
14
use Addiks\RDMBundle\Mapping\ListMapping;
15
use Doctrine\DBAL\Schema\Column;
16
use Addiks\RDMBundle\Mapping\MappingInterface;
17
18
final class ListMappingTest extends TestCase
19
{
20
21
    /**
22
     * @var SubjectClass
23
     */
24
    private $mapping;
25
26
    /**
27
     * @var Column
28
     */
29
    private $column;
30
31
    /**
32
     * @var MappingInterface
33
     */
34
    private $entryMapping;
35
36
    public function setUp()
37
    {
38
        $this->column = $this->createMock(Column::class);
0 ignored issues
show
Documentation Bug introduced by
It seems like $this->createMock(\Doctr...L\Schema\Column::class) of type object<PHPUnit\Framework\MockObject\MockObject> is incompatible with the declared type object<Doctrine\DBAL\Schema\Column> of property $column.

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...
39
        $this->entryMapping = $this->createMock(MappingInterface::class);
0 ignored issues
show
Documentation Bug introduced by
It seems like $this->createMock(\Addik...appingInterface::class) of type object<PHPUnit\Framework\MockObject\MockObject> is incompatible with the declared type object<Addiks\RDMBundle\Mapping\MappingInterface> of property $entryMapping.

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...
40
41
        $this->mapping = new ListMapping($this->column, $this->entryMapping, "some origin");
0 ignored issues
show
Documentation introduced by
$this->column is of type object<PHPUnit\Framework\MockObject\MockObject>, but the function expects a object<Doctrine\DBAL\Schema\Column>.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
Documentation introduced by
$this->entryMapping is of type object<PHPUnit\Framework\MockObject\MockObject>, but the function expects a object<Addiks\RDMBundle\Mapping\MappingInterface>.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
Documentation Bug introduced by
It seems like new \Addiks\RDMBundle\Ma...Mapping, 'some origin') of type object<Addiks\RDMBundle\Mapping\ListMapping> is incompatible with the declared type object<Addiks\SubjectClass> of property $mapping.

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...
42
    }
43
44
    /**
45
     * @test
46
     */
47
    public function shouldHaveDBALColumn()
48
    {
49
        $this->assertSame($this->column, $this->mapping->getDBALColumn());
50
    }
51
52
    /**
53
     * @test
54
     */
55
    public function shouldHaveEntryMapping()
56
    {
57
        $this->assertSame($this->entryMapping, $this->mapping->getEntryMapping());
58
    }
59
60
    /**
61
     * @test
62
     */
63
    public function shouldHaveOrigin()
64
    {
65
        $this->assertSame("some origin", $this->mapping->describeOrigin());
66
    }
67
68
    /**
69
     * @test
70
     */
71
    public function shouldCollectDBALColumns()
72
    {
73
        $this->assertSame([$this->column], $this->mapping->collectDBALColumns());
74
    }
75
76
77
}
78