|
@@ 31-39 (lines=9) @@
|
| 28 |
|
$this->assertInstanceOf('Doctrine\DBAL\Types\DateIntervalType', $this->type); |
| 29 |
|
} |
| 30 |
|
|
| 31 |
|
public function testDateIntervalConvertsToDatabaseValue() |
| 32 |
|
{ |
| 33 |
|
$interval = new \DateInterval('P2Y1DT1H2M3S'); |
| 34 |
|
|
| 35 |
|
$expected = '+P02Y00M01DT01H02M03S'; |
| 36 |
|
$actual = $this->type->convertToDatabaseValue($interval, $this->platform); |
| 37 |
|
|
| 38 |
|
$this->assertEquals($expected, $actual); |
| 39 |
|
} |
| 40 |
|
|
| 41 |
|
public function testDateIntervalConvertsToPHPValue() |
| 42 |
|
{ |
|
@@ 48-57 (lines=10) @@
|
| 45 |
|
$this->assertEquals('+P02Y00M01DT01H02M03S', $interval->format('%RP%YY%MM%DDT%HH%IM%SS')); |
| 46 |
|
} |
| 47 |
|
|
| 48 |
|
public function testNegativeDateIntervalConvertsToDatabaseValue() |
| 49 |
|
{ |
| 50 |
|
$interval = new \DateInterval('P2Y1DT1H2M3S'); |
| 51 |
|
$interval->invert = 1; |
| 52 |
|
|
| 53 |
|
$expected = '-P02Y00M01DT01H02M03S'; |
| 54 |
|
$actual = $this->type->convertToDatabaseValue($interval, $this->platform); |
| 55 |
|
|
| 56 |
|
$this->assertEquals($expected, $actual); |
| 57 |
|
} |
| 58 |
|
|
| 59 |
|
public function testNegativeDateIntervalConvertsToPHPValue() |
| 60 |
|
{ |