testInvalidInputFormatThrowsException()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 6
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
dl 0
loc 6
rs 9.4285
c 1
b 0
f 0
cc 1
eloc 4
nc 1
nop 0
1
<?php
2
3
namespace Ddeboer\DataImport\Tests\ValueConverter;
4
5
use Ddeboer\DataImport\ValueConverter\DateTimeToStringValueConverter;
6
7
class DateTimeToStringValueConverterTest extends \PHPUnit_Framework_TestCase
8
{
9
    public function testConvertWithoutOutputFormatReturnsString()
10
    {
11
        $value = new \DateTime('2010-01-01 01:00:00');
12
        $converter = new DateTimeToStringValueConverter;
13
        $output = $converter->convert($value);
14
        $this->assertEquals('2010-01-01 01:00:00', $output);
15
    }
16
17
    /**
18
     * @expectedException \Ddeboer\DataImport\Exception\UnexpectedValueException
19
     * @expectedExceptionMessage Input must be DateTime object
20
     */
21
    public function testInvalidInputFormatThrowsException()
22
    {
23
        $value = '14/10/2008 09:40:20';
24
        $converter = new DateTimeToStringValueConverter;
25
        $converter->convert($value);
26
    }
27
}
28