ILIAS  release_6 Revision v6.24-5-g0c8bfefb3b8
All Data Structures Namespaces Files Functions Variables Modules Pages
DateFormatTest Class Reference
+ Inheritance diagram for DateFormatTest:
+ Collaboration diagram for DateFormatTest:

Public Member Functions

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

Detailed Description

Definition at line 10 of file DateFormatTest.php.

Member Function Documentation

◆ testDateFormatBuilderAndGetters()

DateFormatTest::testDateFormatBuilderAndGetters ( DateFormat\Factory  $df)

testFactory

Definition at line 34 of file DateFormatTest.php.

References $format.

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

◆ testDateFormatFactory()

DateFormatTest::testDateFormatFactory ( DateFormat\Factory  $df)

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.

References Vendor\Package\$f.

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

◆ 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:10

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