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

Public Member Functions

 setUp ()
 
 getUIFactory ()
 
 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

 buildLanguage ()
 
 buildRefinery ()
 
 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 DurationInputTest.php.

Member Function Documentation

◆ buildFactory()

DurationInputTest::buildFactory ( )
protected

Definition at line 38 of file DurationInputTest.php.

References buildLanguage(), and buildRefinery().

Referenced by setUp().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ buildLanguage()

DurationInputTest::buildLanguage ( )
protected

Definition at line 25 of file DurationInputTest.php.

26 {
27 if (!isset($this->lng)) {
28 $this->lng = $this->createMock(\ilLanguage::class);
29 }
30 return $this->lng;
31 }
$lng

References $lng.

Referenced by buildFactory(), and buildRefinery().

+ Here is the caller graph for this function:

◆ buildRefinery()

DurationInputTest::buildRefinery ( )
protected

Definition at line 33 of file DurationInputTest.php.

34 {
35 return new \ILIAS\Refinery\Factory($this->data_factory, $this->buildLanguage());
36 }

References buildLanguage().

Referenced by buildFactory().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getUIFactory()

DurationInputTest::getUIFactory ( )

Reimplemented from ILIAS_UI_TestBase.

Definition at line 47 of file DurationInputTest.php.

48 {
49 $factory = new class extends NoUIFactory {
50 public function symbol() : \ILIAS\UI\Component\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 return $factory;
60 }
A component is the most general form of an entity in the UI.
Definition: Component.php:14
$factory
Definition: metadata.php:58
Class ChatMainBarProvider \MainMenu\Provider.
Class Factory.

References $factory.

◆ setUp()

DurationInputTest::setUp ( )

Reimplemented from ILIAS_UI_TestBase.

Definition at line 18 of file DurationInputTest.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()

DurationInputTest::test_withFormat ( )

Definition at line 62 of file DurationInputTest.php.

63 {
64 $format = $this->data_factory->dateFormat()->germanShort();
65 $duration = $this->factory->duration('label', 'byline')
66 ->withFormat($format);
67
68 $this->assertEquals(
69 $format,
70 $duration->getFormat()
71 );
72 }
$format
Definition: metadata.php:218

References $format.

◆ test_withInvalidTimeZone()

DurationInputTest::test_withInvalidTimeZone ( )

Definition at line 123 of file DurationInputTest.php.

124 {
125 $this->expectException(\InvalidArgumentException::class);
126 $datetime = $this->factory->duration('label', 'byline');
127 $tz = 'NOT/aValidTZ';
128 $datetime->withTimeZone($tz);
129 }

References $tz.

◆ test_withMaxValue()

DurationInputTest::test_withMaxValue ( )

Definition at line 86 of file DurationInputTest.php.

87 {
88 $dat = new \DateTimeImmutable('2019-01-09');
89 $duration = $this->factory->duration('label', 'byline')
90 ->withMaxValue($dat);
91
92 $this->assertEquals(
93 $dat,
94 $duration->getMaxValue()
95 );
96 }

◆ test_withMinValue()

DurationInputTest::test_withMinValue ( )

Definition at line 74 of file DurationInputTest.php.

75 {
76 $dat = new \DateTimeImmutable('2019-01-09');
77 $duration = $this->factory->duration('label', 'byline')
78 ->withMinValue($dat);
79
80 $this->assertEquals(
81 $dat,
82 $duration->getMinValue()
83 );
84 }

◆ test_withTimeOnly()

DurationInputTest::test_withTimeOnly ( )

Definition at line 105 of file DurationInputTest.php.

106 {
107 $datetime = $this->factory->duration('label', 'byline');
108 $this->assertFalse($datetime->getTimeOnly());
109 $this->assertTrue($datetime->withTimeOnly(true)->getTimeOnly());
110 }

◆ test_withTimeZone()

DurationInputTest::test_withTimeZone ( )

Definition at line 112 of file DurationInputTest.php.

113 {
114 $datetime = $this->factory->duration('label', 'byline');
115 $this->assertNull($datetime->getTimeZone());
116 $tz = 'Europe/Moscow';
117 $this->assertEquals(
118 $tz,
119 $datetime->withTimeZone($tz)->getTimeZone()
120 );
121 }

References $tz.

◆ test_withUseTime()

DurationInputTest::test_withUseTime ( )

Definition at line 98 of file DurationInputTest.php.

99 {
100 $datetime = $this->factory->duration('label', 'byline');
101 $this->assertFalse($datetime->getUseTime());
102 $this->assertTrue($datetime->withUseTime(true)->getUseTime());
103 }

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