GenericDateItemConverterTest::testConvert()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 4
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 2
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