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

tests/Doctrine/Tests/DBAL/Types/SmallIntTest.php (1 issue)

Labels
Severity
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
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