|
@@ 33-41 (lines=9) @@
|
| 30 |
|
self::assertInstanceOf(DateIntervalType::class, $this->type); |
| 31 |
|
} |
| 32 |
|
|
| 33 |
|
public function testDateIntervalConvertsToDatabaseValue() : void |
| 34 |
|
{ |
| 35 |
|
$interval = new \DateInterval('P2Y1DT1H2M3S'); |
| 36 |
|
|
| 37 |
|
$expected = '+P02Y00M01DT01H02M03S'; |
| 38 |
|
$actual = $this->type->convertToDatabaseValue($interval, $this->platform); |
| 39 |
|
|
| 40 |
|
self::assertEquals($expected, $actual); |
| 41 |
|
} |
| 42 |
|
|
| 43 |
|
public function testDateIntervalConvertsToPHPValue() : void |
| 44 |
|
{ |
|
@@ 51-59 (lines=9) @@
|
| 48 |
|
self::assertEquals('+P02Y00M01DT01H02M03S', $interval->format(DateIntervalType::FORMAT)); |
| 49 |
|
} |
| 50 |
|
|
| 51 |
|
public function testNegativeDateIntervalConvertsToDatabaseValue() : void |
| 52 |
|
{ |
| 53 |
|
$interval = new \DateInterval('P2Y1DT1H2M3S'); |
| 54 |
|
$interval->invert = 1; |
| 55 |
|
|
| 56 |
|
$actual = $this->type->convertToDatabaseValue($interval, $this->platform); |
| 57 |
|
|
| 58 |
|
self::assertEquals('-P02Y00M01DT01H02M03S', $actual); |
| 59 |
|
} |
| 60 |
|
|
| 61 |
|
public function testNegativeDateIntervalConvertsToPHPValue() : void |
| 62 |
|
{ |