Completed
Push — master ( cc3a7c...737a8c )
by Roma
01:07
created

SetTypeTest::getType()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 11
Code Lines 6

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 1
Metric Value
dl 0
loc 11
rs 9.4285
c 1
b 0
f 1
cc 1
eloc 6
nc 1
nop 0
1
<?php
2
3
namespace Doctrine\Test\DBAL\Types;
4
5
6
use PHPUnit\Framework\TestCase;
7
use Doctrine\DBAL\Types\SetType;
8
use Doctrine\DBAL\Platforms\AbstractPlatform;
9
10
class SetTypeTest extends TestCase {
11
12
    /**
13
     * @return AbstractPlatform
14
     */
15
    public function getPlatform() {
16
        return $this->getMockForAbstractClass(AbstractPlatform::class);
17
    }
18
19
    /**
20
     * @return SetType
21
     */
22
    public function getType() {
23
24
        $typeBuilder = $this->getMockBuilder(SetType::class);
25
        $typeBuilder = $typeBuilder->disableOriginalConstructor();
26
        $typeBuilder = $typeBuilder->setMethods(array('getValue', 'getName'));
27
28
        /** @var SetType $type */
29
        $type = $typeBuilder->getMock();
30
31
        return $type;
32
    }
33
34
    public function testConvertsToPHPValue() {
35
36
        $result = $this->getType()->convertToPHPValue('ONE,TWO', $this->getPlatform());
37
38
        $this->assertEquals(array('ONE', 'TWO'), $result);
39
    }
40
41
    public function testNullConvertsToPHPValue() {
42
43
        $result = $this->getType()->convertToPHPValue(null, $this->getPlatform());
44
45
        $this->assertEquals(null, $result);
46
    }
47
}
48