ILIAS  release_8 Revision v8.23
DateTimeInputTest Class Reference
+ Inheritance diagram for DateTimeInputTest:
+ Collaboration diagram for DateTimeInputTest:

Public Member Functions

 setUp ()
 
 getUIFactory ()
 
 getLanguage ()
 
 test_withFormat ()
 
 test_withMinValue ()
 
 test_withMaxValue ()
 
 test_withUseTime ()
 
 test_withTimeOnly ()
 
 test_withTimeZone ()
 
 test_withInvalidTimeZone ()
 
 test_jsConfigRendering ()
 
 test_withValueThatIsDateTimeImmutable ()
 
- Public Member Functions inherited from ILIAS_UI_TestBase
 setUp ()
 
 tearDown ()
 
 getUIFactory ()
 
 getTemplateFactory ()
 
 getResourceRegistry ()
 
 getLanguage ()
 
 getJavaScriptBinding ()
 
 getRefinery ()
 
 getImagePathResolver ()
 
 getDataFactory ()
 
 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 Factory.
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.

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...

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

◆ test_jsConfigRendering()

DateTimeInputTest::test_jsConfigRendering ( )

Definition at line 151 of file DateTimeInputTest.php.

References ILIAS_UI_TestBase\getDefaultRenderer(), and ILIAS_UI_TestBase\getJavaScriptBinding().

151  : void
152  {
153  $datetime = $this->factory->datetime('label', 'byline');
154  $js_binding = $this->getJavaScriptBinding();
155  $this->getDefaultRenderer($js_binding)->render($datetime);
156 
157  $expected = '$("#id_1").datetimepicker({'
158  . '"showClear":true,'
159  . '"sideBySide":true,'
160  . '"format":"YYYY-MM-DD",'
161  . '"locale":"en"'
162  . '});';
163 
164  $onload_js = array_shift($js_binding->on_load_code);
165  $this->assertEquals($expected, $onload_js);
166  }
getDefaultRenderer(JavaScriptBinding $js_binding=null, array $with_stub_renderings=[])
Definition: Base.php:355
getJavaScriptBinding()
Definition: Base.php:330
+ Here is the call graph for this function:

◆ test_withFormat()

DateTimeInputTest::test_withFormat ( )

Definition at line 82 of file DateTimeInputTest.php.

References $format.

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  }
$format
Definition: metadata.php:235

◆ test_withInvalidTimeZone()

DateTimeInputTest::test_withInvalidTimeZone ( )

Definition at line 143 of file DateTimeInputTest.php.

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

◆ test_withMaxValue()

DateTimeInputTest::test_withMaxValue ( )

Definition at line 106 of file DateTimeInputTest.php.

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  }

◆ test_withMinValue()

DateTimeInputTest::test_withMinValue ( )

Definition at line 94 of file DateTimeInputTest.php.

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  }

◆ test_withTimeOnly()

DateTimeInputTest::test_withTimeOnly ( )

Definition at line 125 of file DateTimeInputTest.php.

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

◆ test_withTimeZone()

DateTimeInputTest::test_withTimeZone ( )

Definition at line 132 of file DateTimeInputTest.php.

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  }

◆ test_withUseTime()

DateTimeInputTest::test_withUseTime ( )

Definition at line 118 of file DateTimeInputTest.php.

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

◆ test_withValueThatIsDateTimeImmutable()

DateTimeInputTest::test_withValueThatIsDateTimeImmutable ( )

Definition at line 168 of file DateTimeInputTest.php.

168  : void
169  {
170  $string_value = "1985-05-04";
171  $value = new \DateTimeImmutable($string_value);
172  $datetime = $this->factory->datetime('label', 'byline')
173  ->withValue($value);
174  $this->assertEquals(
175  $string_value,
176  $datetime->getValue()
177  );
178  }

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: