ILIAS  release_8 Revision v8.24
DateTimeTransformationTest.php
Go to the documentation of this file.
1<?php
2
3declare(strict_types=1);
4
22
23use DateTimeImmutable;
25use PHPUnit\Framework\TestCase;
26use UnexpectedValueException;
27
29{
31
32 protected function setUp(): void
33 {
34 $this->trans = new DateTimeTransformation();
35 }
36
37 public function testTransform(): void
38 {
39 $value = '26.05.1977';
40 $expected = new DateTimeImmutable($value);
41
42 $this->assertEquals(
43 $expected,
44 $this->trans->transform($value)
45 );
46 }
47
48 public function testInvalidTransform(): void
49 {
50 $this->expectException(UnexpectedValueException::class);
51 $this->trans->transform('erroneous');
52 }
53
54 public function testInvoke(): void
55 {
56 $value = '2019/05/26';
57 $expected = new DateTimeImmutable($value);
58 $t = $this->trans;
59
60 $this->assertEquals($expected, $t($value));
61 }
62}
Transform a string representing a datetime-value to php's DateTimeImmutable see https://www....
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...