Completed
Push — master ( 5dd66e...5b5c2c )
by Marco
114:19 queued 111:15
created

SmallIntTest::testSmallIntNullConvertsToPHPValue()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 3
rs 10
c 0
b 0
f 0
cc 1
eloc 1
nc 1
nop 0
1
<?php
2
3
namespace Doctrine\Tests\DBAL\Types;
4
5
use Doctrine\DBAL\Platforms\AbstractPlatform;
6
use Doctrine\DBAL\Types\SmallIntType;
7
use Doctrine\DBAL\Types\Type;
8
use Doctrine\Tests\DbalTestCase;
9
use PHPUnit\Framework\MockObject\MockObject;
10
11
class SmallIntTest extends DbalTestCase
12
{
13
    /** @var AbstractPlatform|MockObject */
14
    private $platform;
15
16
    /** @var SmallIntType */
17
    private $type;
18
19
    protected function setUp() : void
20
    {
21
        $this->platform = $this->createMock(AbstractPlatform::class);
22
        $this->type     = Type::getType('smallint');
23
    }
24
25
    public function testSmallIntConvertsToPHPValue()
26
    {
27
        self::assertIsInt($this->type->convertToPHPValue('1', $this->platform));
28
        self::assertIsInt($this->type->convertToPHPValue('0', $this->platform));
29
    }
30
31
    public function testSmallIntNullConvertsToPHPValue()
32
    {
33
        self::assertNull($this->type->convertToPHPValue(null, $this->platform));
0 ignored issues
show
Bug introduced by
Are you sure the usage of $this->type->convertToPH...(null, $this->platform) targeting Doctrine\DBAL\Types\Smal...pe::convertToPHPValue() 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...
34
    }
35
}
36