ILIAS  release_7 Revision v7.30-3-g800a261c036
DateFormatTest Class Reference
+ Inheritance diagram for DateFormatTest:
+ Collaboration diagram for DateFormatTest:

Public Member Functions

 testFactory ()
 
 testDateFormatFactory (DateFormat\Factory $df)
 @depends testFactory More...
 
 testDateFormatBuilderAndGetters (DateFormat\Factory $df)
 @depends testFactory More...
 
 testInvalidTokens ()
 

Detailed Description

Definition at line 10 of file DateFormatTest.php.

Member Function Documentation

◆ testDateFormatBuilderAndGetters()

DateFormatTest::testDateFormatBuilderAndGetters ( DateFormat\Factory  $df)

@depends testFactory

Definition at line 34 of file DateFormatTest.php.

35 {
36 $expect = [
37 '.', ',', '-', '/', ' ', 'd', 'jS', 'l', 'D', 'W', 'm', 'F', 'M', 'Y', 'y'
38 ];
39 $format = $df->custom()
40 ->dot()->comma()->dash()->slash()->space()
41 ->day()->dayOrdinal()->weekday()->weekdayShort()
42 ->week()->month()->monthSpelled()->monthSpelledShort()
43 ->year()->twoDigitYear()
44 ->get();
45
46 $this->assertEquals(
47 $expect,
48 $format->toArray()
49 );
50
51 $this->assertEquals(
52 implode('', $expect),
53 $format->toString()
54 );
55 }
$format
Definition: metadata.php:218

References $format.

◆ testDateFormatFactory()

DateFormatTest::testDateFormatFactory ( DateFormat\Factory  $df)

@depends testFactory

Definition at line 23 of file DateFormatTest.php.

24 {
25 $this->assertInstanceOf(DateFormat\DateFormat::class, $df->standard());
26 $this->assertInstanceOf(DateFormat\DateFormat::class, $df->germanShort());
27 $this->assertInstanceOf(DateFormat\DateFormat::class, $df->germanLong());
28 $this->assertInstanceOf(DateFormat\FormatBuilder::class, $df->custom());
29 }

◆ testFactory()

DateFormatTest::testFactory ( )

Definition at line 12 of file DateFormatTest.php.

13 {
14 $f = new ILIAS\Data\Factory();
15 $df = $f->dateFormat();
16 $this->assertInstanceOf(DateFormat\Factory::class, $df);
17 return $df;
18 }
Builds data types.
Definition: Factory.php:20

References Vendor\Package\$f.

◆ testInvalidTokens()

DateFormatTest::testInvalidTokens ( )

Definition at line 57 of file DateFormatTest.php.

58 {
59 $this->expectException(\InvalidArgumentException::class);
60 new DateFormat\DateFormat(['x', '2']);
61 }
A Date Format provides a format definition akin to PHP's date formatting options, but stores the sing...
Definition: DateFormat.php:11

The documentation for this class was generated from the following file: