Completed
Pull Request — master (#296)
by
unknown
03:13
created

testInvalidInputFormatThrowsException()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 6
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 2
Bugs 0 Features 1
Metric Value
c 2
b 0
f 1
dl 0
loc 6
rs 9.4285
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