| 1 | <?php |
||
| 5 | use MVar\Apache2LogParser\TimeFormatTrait; |
||
| 6 | |||
| 7 | class TimeFormatTraitTest extends \PHPUnit_Framework_TestCase |
||
| 8 | { |
||
| 9 | /** |
||
| 10 | * Test for formatTime() in case no format was set. |
||
| 11 | */ |
||
| 12 | public function testFormatTimeNoFormatting() |
||
| 19 | |||
| 20 | /** |
||
| 21 | * Test for formatTime() in case object was requested. |
||
| 22 | */ |
||
| 23 | public function testFormatTimeObject() |
||
| 33 | |||
| 34 | /** |
||
| 35 | * Test for formatTime() in case custom format was set. |
||
| 36 | */ |
||
| 37 | public function testFormatTimeCustom() |
||
| 38 | { |
||
| 39 | /** @var TimeFormatTrait $formatter */ |
||
| 40 | $formatter = $this->getMockForTrait('MVar\Apache2LogParser\TimeFormatTrait'); |
||
| 41 | $formatter->setTimeFormat('d/m/Y H:i:s'); |
||
| 42 | |||
| 43 | $this->assertEquals('05/12/2015 12:00:00', $formatter->formatTime('2015-12-05 12:00:00')); |
||
| 44 | } |
||
| 46 |