GenericDateItemConverterTest   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 48
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Importance

Changes 0
Metric Value
wmc 3
lcom 1
cbo 1
dl 0
loc 48
rs 10
c 0
b 0
f 0

3 Methods

Rating   Name   Duplication   Size   Complexity  
A setUp() 0 4 1
A testConvert() 0 4 1
A getConvertData() 0 25 1
1
<?php
2
namespace Mathielen\DataImport\ValueConverter;
3
4
class GenericDateItemConverterTest extends \PHPUnit_Framework_TestCase
5
{
6
7
    /**
8
     * @var GenericDateItemConverter
9
     */
10
    private $sut;
11
12
    protected function setUp()
13
    {
14
        $this->sut = new GenericDateItemConverter();
15
    }
16
17
    /**
18
     * @dataProvider getConvertData
19
     */
20
    public function testConvert($inputData, $expectedResult)
21
    {
22
        $this->assertEquals($expectedResult, $this->sut->convert($inputData));
23
    }
24
25
    public function getConvertData()
26
    {
27
        return array(
28
            array(
29
                0,
30
                null
31
            ),
32
            array(
33
                '12.11.2015',
34
                '2015-11-12'
35
            ),
36
            array(
37
                '12.11.15',
38
                '2015-11-12'
39
            ),
40
            array(
41
                '121115',
42
                '2015-11-12'
43
            ),
44
            array(
45
                'abc',
46
                'abc'
47
            )
48
        );
49
    }
50
51
}
52