ILIAS  release_10 Revision v10.1-43-ga1241a92c2f
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 ()
 
 testRender ()
 
 testCommonRendering ()
 

Protected Member Functions

 buildFactory ()
 

Protected Attributes

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

Detailed Description

Definition at line 32 of file DateTimeInputTest.php.

Member Function Documentation

◆ buildFactory()

DateTimeInputTest::buildFactory ( )
protected

Definition at line 71 of file DateTimeInputTest.php.

Referenced by setUp().

71  : I\Input\Field\Factory
72  {
73  $df = new Data\Factory();
74  $language = $this->createMock(ILIAS\Language\Language::class);
75 
76  return new I\Input\Field\Factory(
77  $this->createMock(\ILIAS\UI\Implementation\Component\Input\UploadLimitResolver::class),
78  new SignalGenerator(),
79  $this->data_factory,
80  new Refinery($df, $language),
81  $language
82  );
83  }
Interface Observer Contains several chained tasks and infos about them.
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 61 of file DateTimeInputTest.php.

61  : LanguageMock
62  {
63  return new class () extends LanguageMock {
64  public function getLangKey(): string
65  {
66  return 'en';
67  }
68  };
69  }

◆ getUIFactory()

DateTimeInputTest::getUIFactory ( )

Definition at line 47 of file DateTimeInputTest.php.

References ILIAS\Repository\symbol().

47  : NoUIFactory
48  {
49  return new class () extends NoUIFactory {
50  public function symbol(): C\Symbol\Factory
51  {
52  return new S\Factory(
53  new S\Icon\Factory(),
54  new S\Glyph\Factory(),
55  new S\Avatar\Factory()
56  );
57  }
58  };
59  }
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...
Builds data types.
Definition: Factory.php:35
+ Here is the call graph for this function:

◆ setUp()

DateTimeInputTest::setUp ( )

Definition at line 40 of file DateTimeInputTest.php.

References buildFactory().

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

◆ testCommonRendering()

DateTimeInputTest::testCommonRendering ( )

Definition at line 193 of file DateTimeInputTest.php.

References $datetime.

193  : void
194  {
195  $datetime = $this->factory->dateTime('label')
196  ->withNameFrom($this->name_source);
197 
198  $this->testWithError($datetime);
199  $this->testWithNoByline($datetime);
200  $this->testWithRequired($datetime);
201  $this->testWithDisabled($datetime);
202  $this->testWithAdditionalOnloadCodeRendersId($datetime);
203  }
$datetime

◆ testRender()

DateTimeInputTest::testRender ( )

Definition at line 173 of file DateTimeInputTest.php.

References $datetime, and $r.

173  : void
174  {
175  $datetime = $this->factory->dateTime('label', 'byline');
176  $r = $this->getDefaultRenderer();
177  $html = $this->brutallyTrimHTML($r->render($datetime));
178 
179  $expected = $this->brutallyTrimHTML('
180  <fieldset class="c-input" data-il-ui-component="date-time-field-input" data-il-ui-input-name="">
181  <label for="id_1">label</label>
182  <div class="c-input__field">
183  <div class="c-input-group">
184  <input id="id_1" type="date" class="c-field-datetime" />
185  </div>
186  </div>
187  <div class="c-input__help-byline">byline</div>
188  </fieldset>
189  ');
190  $this->assertEquals($expected, $html);
191  }
$datetime
$r

◆ testWithFormat()

DateTimeInputTest::testWithFormat ( )

Definition at line 85 of file DateTimeInputTest.php.

References $datetime.

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

◆ testWithInvalidTimeZone()

DateTimeInputTest::testWithInvalidTimeZone ( )

Definition at line 146 of file DateTimeInputTest.php.

References $datetime.

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

◆ testWithInvalidValue()

DateTimeInputTest::testWithInvalidValue ( )

Definition at line 166 of file DateTimeInputTest.php.

References $datetime.

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

◆ testWithMaxValue()

DateTimeInputTest::testWithMaxValue ( )

Definition at line 109 of file DateTimeInputTest.php.

References $datetime.

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

◆ testWithMinValue()

DateTimeInputTest::testWithMinValue ( )

Definition at line 97 of file DateTimeInputTest.php.

References $datetime.

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

◆ testWithTimeOnly()

DateTimeInputTest::testWithTimeOnly ( )

Definition at line 128 of file DateTimeInputTest.php.

References $datetime.

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

◆ testWithTimeZone()

DateTimeInputTest::testWithTimeZone ( )

Definition at line 135 of file DateTimeInputTest.php.

References $datetime.

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

◆ testWithUseTime()

DateTimeInputTest::testWithUseTime ( )

Definition at line 121 of file DateTimeInputTest.php.

References $datetime.

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

◆ testWithValueThatIsDateTimeImmutable()

DateTimeInputTest::testWithValueThatIsDateTimeImmutable ( )

Definition at line 154 of file DateTimeInputTest.php.

References $datetime.

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

Field Documentation

◆ $data_factory

Data Factory DateTimeInputTest::$data_factory
protected

Definition at line 37 of file DateTimeInputTest.php.

◆ $factory

I Input Field Factory DateTimeInputTest::$factory
protected

Definition at line 38 of file DateTimeInputTest.php.

◆ $name_source

DefNamesource DateTimeInputTest::$name_source
protected

Definition at line 36 of file DateTimeInputTest.php.


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