NullMappingTest::shouldNotRevertValue()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 3
c 0
b 0
f 0
nc 1
nop 0
dl 0
loc 5
rs 10
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\NullMapping;
15
use Addiks\RDMBundle\Hydration\HydrationContextInterface;
16
use Symfony\Component\DependencyInjection\ContainerInterface;
17
18
final class NullMappingTest extends TestCase
19
{
20
21
    /**
22
     * @var NullMapping
23
     */
24
    private $mapping;
25
26
    public function setUp(): void
27
    {
28
        $this->mapping = new NullMapping("some origin");
29
    }
30
31
    /**
32
     * @test
33
     */
34
    public function shouldDescribeOrigin()
35
    {
36
        $this->assertEquals("some origin", $this->mapping->describeOrigin());
37
    }
38
39
    /**
40
     * @test
41
     */
42
    public function shouldNotCollectAnyColumns()
43
    {
44
        $this->assertEmpty($this->mapping->collectDBALColumns());
45
    }
46
47
    /**
48
     * @test
49
     */
50
    public function shouldNotResolveValue()
51
    {
52
        $this->assertNull($this->mapping->resolveValue(
0 ignored issues
show
Bug introduced by
Are you sure the usage of $this->mapping->resolveV...rface::class), array()) targeting Addiks\RDMBundle\Mapping...Mapping::resolveValue() seems to always return null.

This check looks for function or method calls that always return null and whose return value is used.

class A
{
    function getObject()
    {
        return null;
    }

}

$a = new A();
if ($a->getObject()) {

The method getObject() can return nothing but null, so it makes no sense to use the return value.

The reason is most likely that a function or method is imcomplete or has been reduced for debug purposes.

Loading history...
53
            $this->createMock(HydrationContextInterface::class),
54
            []
55
        ));
56
    }
57
58
    /**
59
     * @test
60
     */
61
    public function shouldNotRevertValue()
62
    {
63
        $this->assertEmpty($this->mapping->revertValue(
64
            $this->createMock(HydrationContextInterface::class),
65
            null
66
        ));
67
    }
68
69
    /**
70
     * @test
71
     */
72
    public function shouldNotAssertValue()
73
    {
74
        $this->assertNull($this->mapping->assertValue(
0 ignored issues
show
Bug introduced by
Are you sure the usage of $this->mapping->assertVa...:class), array(), null) targeting Addiks\RDMBundle\Mapping...lMapping::assertValue() seems to always return null.

This check looks for function or method calls that always return null and whose return value is used.

class A
{
    function getObject()
    {
        return null;
    }

}

$a = new A();
if ($a->getObject()) {

The method getObject() can return nothing but null, so it makes no sense to use the return value.

The reason is most likely that a function or method is imcomplete or has been reduced for debug purposes.

Loading history...
75
            $this->createMock(HydrationContextInterface::class),
76
            [],
77
            null
78
        ));
79
    }
80
81
    /**
82
     * @test
83
     */
84
    public function shouldWakeUpInnerMapping()
85
    {
86
        /** @var ContainerInterface $container */
87
        $container = $this->createMock(ContainerInterface::class);
88
89
        $this->assertNull($this->mapping->wakeUpMapping($container));
0 ignored issues
show
Bug introduced by
Are you sure the usage of $this->mapping->wakeUpMapping($container) targeting Addiks\RDMBundle\Mapping...apping::wakeUpMapping() seems to always return null.

This check looks for function or method calls that always return null and whose return value is used.

class A
{
    function getObject()
    {
        return null;
    }

}

$a = new A();
if ($a->getObject()) {

The method getObject() can return nothing but null, so it makes no sense to use the return value.

The reason is most likely that a function or method is imcomplete or has been reduced for debug purposes.

Loading history...
90
    }
91
92
}
93