ILIAS  release_9 Revision v9.13-25-g2c18ec4c24f
DateTimeInputTest Class Reference
+ Inheritance diagram for DateTimeInputTest:
+ Collaboration diagram for DateTimeInputTest:

Public Member Functions

 setUp ()
 
 getUIFactory ()
 
 getLanguage ()
 
 testWithFormat ()
 
 testWithMinValue ()
 
 testWithMaxValue ()
 
 testWithUseTime ()
 
 testWithTimeOnly ()
 
 testWithTimeZone ()
 
 testWithInvalidTimeZone ()
 
 testWithValueThatIsDateTimeImmutable ()
 
 testWithInvalidValue ()
 
- Public Member Functions inherited from ILIAS_UI_TestBase
 setUp ()
 
 tearDown ()
 
 getUIFactory ()
 
 getTemplateFactory ()
 
 getResourceRegistry ()
 
 getLanguage ()
 
 getJavaScriptBinding ()
 
 getRefinery ()
 
 getImagePathResolver ()
 
 getDataFactory ()
 
 getHelpTextRetriever ()
 
 getUploadLimitResolver ()
 
 getDefaultRenderer (JavaScriptBinding $js_binding=null, array $with_stub_renderings=[])
 
 getDecoratedRenderer (Renderer $default)
 
 normalizeHTML (string $html)
 
 assertHTMLEquals (string $expected_html_as_string, string $html_as_string)
 

Protected Member Functions

 buildFactory ()
 
- Protected Member Functions inherited from ILIAS_UI_TestBase
 brutallyTrimHTML (string $html)
 A more radical version of normalizeHTML. More...
 
 brutallyTrimSignals (string $html)
 A naive replacement of all il_signal-ids with dots to ease comparisons of rendered output. More...
 

Protected Attributes

DefNamesource $name_source
 
Data Factory $data_factory
 
I Input Field Factory $factory
 

Detailed Description

Definition at line 31 of file DateTimeInputTest.php.

Member Function Documentation

◆ buildFactory()

DateTimeInputTest::buildFactory ( )
protected

Definition at line 68 of file DateTimeInputTest.php.

Referenced by setUp().

68  : I\Input\Field\Factory
69  {
70  $df = new Data\Factory();
71  $language = $this->createMock(ilLanguage::class);
72 
73  return new I\Input\Field\Factory(
74  $this->createMock(\ILIAS\UI\Implementation\Component\Input\UploadLimitResolver::class),
75  new SignalGenerator(),
76  $this->data_factory,
77  new Refinery($df, $language),
78  $language
79  );
80  }
Class ChatMainBarProvider .
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
+ Here is the caller graph for this function:

◆ getLanguage()

DateTimeInputTest::getLanguage ( )

Definition at line 58 of file DateTimeInputTest.php.

59  {
60  return new class () extends ilLanguageMock {
61  public function getLangKey(): string
62  {
63  return 'en';
64  }
65  };
66  }

◆ getUIFactory()

DateTimeInputTest::getUIFactory ( )

Definition at line 44 of file DateTimeInputTest.php.

References ILIAS\Repository\symbol().

44  : NoUIFactory
45  {
46  return new class () extends NoUIFactory {
47  public function symbol(): C\Symbol\Factory
48  {
49  return new S\Factory(
50  new S\Icon\Factory(),
51  new S\Glyph\Factory(),
52  new S\Avatar\Factory()
53  );
54  }
55  };
56  }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
+ Here is the call graph for this function:

◆ setUp()

DateTimeInputTest::setUp ( )

Definition at line 37 of file DateTimeInputTest.php.

References buildFactory().

37  : void
38  {
39  $this->name_source = new DefNamesource();
40  $this->data_factory = new Data\Factory();
41  $this->factory = $this->buildFactory();
42  }
+ Here is the call graph for this function:

◆ testWithFormat()

DateTimeInputTest::testWithFormat ( )

Definition at line 82 of file DateTimeInputTest.php.

References $datetime.

82  : void
83  {
84  $format = $this->data_factory->dateFormat()->germanShort();
85  $datetime = $this->factory->datetime('label', 'byline')
86  ->withFormat($format);
87 
88  $this->assertEquals(
89  $format,
90  $datetime->getFormat()
91  );
92  }
$datetime

◆ testWithInvalidTimeZone()

DateTimeInputTest::testWithInvalidTimeZone ( )

Definition at line 143 of file DateTimeInputTest.php.

References $datetime.

143  : void
144  {
145  $this->expectException(InvalidArgumentException::class);
146  $datetime = $this->factory->datetime('label', 'byline');
147  $tz = 'NOT/aValidTZ';
148  $datetime->withTimeZone($tz);
149  }
$datetime

◆ testWithInvalidValue()

DateTimeInputTest::testWithInvalidValue ( )

Definition at line 163 of file DateTimeInputTest.php.

References $datetime.

163  : void
164  {
165  $this->expectException(InvalidArgumentException::class);
166  $datetime = $this->factory->datetime('label', 'byline')
167  ->withValue("this is no datetime...");
168  }
$datetime

◆ testWithMaxValue()

DateTimeInputTest::testWithMaxValue ( )

Definition at line 106 of file DateTimeInputTest.php.

References $datetime.

106  : void
107  {
108  $dat = new DateTimeImmutable('2019-01-09');
109  $datetime = $this->factory->datetime('label', 'byline')
110  ->withMaxValue($dat);
111 
112  $this->assertEquals(
113  $dat,
114  $datetime->getMaxValue()
115  );
116  }
$datetime

◆ testWithMinValue()

DateTimeInputTest::testWithMinValue ( )

Definition at line 94 of file DateTimeInputTest.php.

References $datetime.

94  : void
95  {
96  $dat = new DateTimeImmutable('2019-01-09');
97  $datetime = $this->factory->datetime('label', 'byline')
98  ->withMinValue($dat);
99 
100  $this->assertEquals(
101  $dat,
102  $datetime->getMinValue()
103  );
104  }
$datetime

◆ testWithTimeOnly()

DateTimeInputTest::testWithTimeOnly ( )

Definition at line 125 of file DateTimeInputTest.php.

References $datetime.

125  : void
126  {
127  $datetime = $this->factory->datetime('label', 'byline');
128  $this->assertFalse($datetime->getTimeOnly());
129  $this->assertTrue($datetime->withTimeOnly(true)->getTimeOnly());
130  }
$datetime

◆ testWithTimeZone()

DateTimeInputTest::testWithTimeZone ( )

Definition at line 132 of file DateTimeInputTest.php.

References $datetime.

132  : void
133  {
134  $datetime = $this->factory->datetime('label', 'byline');
135  $this->assertNull($datetime->getTimeZone());
136  $tz = 'Europe/Moscow';
137  $this->assertEquals(
138  $tz,
139  $datetime->withTimeZone($tz)->getTimeZone()
140  );
141  }
$datetime

◆ testWithUseTime()

DateTimeInputTest::testWithUseTime ( )

Definition at line 118 of file DateTimeInputTest.php.

References $datetime.

118  : void
119  {
120  $datetime = $this->factory->datetime('label', 'byline');
121  $this->assertFalse($datetime->getUseTime());
122  $this->assertTrue($datetime->withUseTime(true)->getUseTime());
123  }
$datetime

◆ testWithValueThatIsDateTimeImmutable()

DateTimeInputTest::testWithValueThatIsDateTimeImmutable ( )

Definition at line 151 of file DateTimeInputTest.php.

References $datetime.

151  : void
152  {
153  $string_value = "1985-05-04 00:00";
154  $value = new \DateTimeImmutable($string_value);
155  $datetime = $this->factory->datetime('label', 'byline')
156  ->withValue($value);
157  $this->assertEquals(
158  $string_value,
159  $datetime->getValue()
160  );
161  }
$datetime

Field Documentation

◆ $data_factory

Data Factory DateTimeInputTest::$data_factory
protected

Definition at line 34 of file DateTimeInputTest.php.

◆ $factory

I Input Field Factory DateTimeInputTest::$factory
protected

Definition at line 35 of file DateTimeInputTest.php.

◆ $name_source

DefNamesource DateTimeInputTest::$name_source
protected

Definition at line 33 of file DateTimeInputTest.php.


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