|
@@ 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 = '+P0002-00-01T01:02:03'; |
| 36 |
|
$actual = $this->type->convertToDatabaseValue($interval, $this->platform); |
| 37 |
|
|
| 38 |
|
$this->assertEquals($expected, $actual); |
| 39 |
|
} |
| 40 |
|
|
| 41 |
|
public function testDateIntervalConvertsToPHPValue() |
| 42 |
|
{ |
|
@@ 55-64 (lines=10) @@
|
| 52 |
|
$this->assertEquals('+P2Y0M1DT1H2M3S', $interval->format('%RP%yY%mM%dDT%hH%iM%sS')); |
| 53 |
|
} |
| 54 |
|
|
| 55 |
|
public function testNegativeDateIntervalConvertsToDatabaseValue() |
| 56 |
|
{ |
| 57 |
|
$interval = new \DateInterval('P2Y1DT1H2M3S'); |
| 58 |
|
$interval->invert = 1; |
| 59 |
|
|
| 60 |
|
$expected = '-P0002-00-01T01:02:03'; |
| 61 |
|
$actual = $this->type->convertToDatabaseValue($interval, $this->platform); |
| 62 |
|
|
| 63 |
|
$this->assertEquals($expected, $actual); |
| 64 |
|
} |
| 65 |
|
|
| 66 |
|
public function testNegativeDateIntervalConvertsToPHPValue() |
| 67 |
|
{ |