ILIAS  release_6 Revision v6.24-5-g0c8bfefb3b8
DateTimeInputTest Class Reference
+ Inheritance diagram for DateTimeInputTest:
+ Collaboration diagram for DateTimeInputTest:

Public Member Functions

 setUp ()
 
 test_withFormat ()
 
 test_withMinValue ()
 
 test_withMaxValue ()
 
 test_withUseTime ()
 
 test_withTimeOnly ()
 
 test_withTimeZone ()
 
 test_withInvalidTimeZone ()
 
- Public Member Functions inherited from ILIAS_UI_TestBase
 setUp ()
 
 tearDown ()
 
 getUIFactory ()
 
 getTemplateFactory ()
 
 getResourceRegistry ()
 
 getLanguage ()
 
 getJavaScriptBinding ()
 
 getRefinery ()
 
 getDefaultRenderer (JavaScriptBinding $js_binding=null)
 
 getDecoratedRenderer (Renderer $default)
 
 normalizeHTML ($html)
 
 assertHTMLEquals ($expected_html_as_string, $html_as_string)
 

Protected Member Functions

 buildFactory ()
 
- Protected Member Functions inherited from ILIAS_UI_TestBase
 brutallyTrimHTML ($html)
 A more radical version of normalizeHTML. More...
 

Detailed Description

Definition at line 16 of file DateTimeInputTest.php.

Member Function Documentation

◆ buildFactory()

DateTimeInputTest::buildFactory ( )
protected

Definition at line 25 of file DateTimeInputTest.php.

26 {
27 $df = new Data\Factory();
28 $language = $this->createMock(\ilLanguage::class);
29
31 new SignalGenerator(),
32 $this->data_factory,
33 new \ILIAS\Refinery\Factory($df, $language),
34 $language
35 );
36 }
Builds data types.
Definition: Factory.php:20
Class ChatMainBarProvider \MainMenu\Provider.

Referenced by setUp().

+ Here is the caller graph for this function:

◆ setUp()

DateTimeInputTest::setUp ( )

Reimplemented from ILIAS_UI_TestBase.

Definition at line 18 of file DateTimeInputTest.php.

18 : void
19 {
20 $this->name_source = new DefNamesource();
21 $this->data_factory = new Data\Factory();
22 $this->factory = $this->buildFactory();
23 }

References buildFactory().

+ Here is the call graph for this function:

◆ test_withFormat()

DateTimeInputTest::test_withFormat ( )

Definition at line 38 of file DateTimeInputTest.php.

39 {
40 $format = $this->data_factory->dateFormat()->germanShort();
41 $datetime = $this->factory->datetime('label', 'byline')
42 ->withFormat($format);
43
44 $this->assertEquals(
45 $format,
46 $datetime->getFormat()
47 );
48 }
$format
Definition: metadata.php:218

References $format.

◆ test_withInvalidTimeZone()

DateTimeInputTest::test_withInvalidTimeZone ( )

Definition at line 98 of file DateTimeInputTest.php.

99 {
100 $this->expectException(\InvalidArgumentException::class);
101 $datetime = $this->factory->datetime('label', 'byline');
102 $tz = 'NOT/aValidTZ';
103 $datetime->withTimeZone($tz);
104 }

References $tz.

◆ test_withMaxValue()

DateTimeInputTest::test_withMaxValue ( )

Definition at line 62 of file DateTimeInputTest.php.

63 {
64 $dat = new \DateTimeImmutable('2019-01-09');
65 $datetime = $this->factory->datetime('label', 'byline')
66 ->withMaxValue($dat);
67
68 $this->assertEquals(
69 $dat,
70 $datetime->getMaxValue()
71 );
72 }

◆ test_withMinValue()

DateTimeInputTest::test_withMinValue ( )

Definition at line 50 of file DateTimeInputTest.php.

51 {
52 $dat = new \DateTimeImmutable('2019-01-09');
53 $datetime = $this->factory->datetime('label', 'byline')
54 ->withMinValue($dat);
55
56 $this->assertEquals(
57 $dat,
58 $datetime->getMinValue()
59 );
60 }

◆ test_withTimeOnly()

DateTimeInputTest::test_withTimeOnly ( )

Definition at line 81 of file DateTimeInputTest.php.

82 {
83 $datetime = $this->factory->datetime('label', 'byline');
84 $this->assertFalse($datetime->getTimeOnly());
85 $this->assertTrue($datetime->withTimeOnly(true)->getTimeOnly());
86 }

◆ test_withTimeZone()

DateTimeInputTest::test_withTimeZone ( )

Definition at line 88 of file DateTimeInputTest.php.

89 {
90 $datetime = $this->factory->datetime('label', 'byline');
91 $this->assertNull($datetime->getTimeZone());
92 $tz = 'Europe/Moscow';
93 $this->assertEquals(
94 $tz,
95 $datetime->withTimeZone($tz)->getTimeZone()
96 );
97 }

References $tz.

◆ test_withUseTime()

DateTimeInputTest::test_withUseTime ( )

Definition at line 74 of file DateTimeInputTest.php.

75 {
76 $datetime = $this->factory->datetime('label', 'byline');
77 $this->assertFalse($datetime->getUseTime());
78 $this->assertTrue($datetime->withUseTime(true)->getUseTime());
79 }

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