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

SetTypeTest   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 38
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 3

Importance

Changes 2
Bugs 0 Features 2
Metric Value
wmc 4
lcom 1
cbo 3
dl 0
loc 38
rs 10
c 2
b 0
f 2

4 Methods

Rating   Name   Duplication   Size   Complexity  
A getPlatform() 0 3 1
A getType() 0 11 1
A testConvertsToPHPValue() 0 6 1
A testNullConvertsToPHPValue() 0 6 1
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