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

Public Member Functions

 setUp ()
 
 testGetTitle ()
 
 testGetIcon ()
 
 testGetDescription ()
 
 testRender ()
 
 testRenderWithoutDescription ()
 
 testRenderWithoutIcon ()
 
- 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

 getItem ()
 
 getItemWithoutDescription ()
 
 getItemWithoutIcon ()
 
- 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...
 

Private Attributes

string $id
 
string $title
 
I Image Image $image
 
string $description
 

Detailed Description

Definition at line 28 of file StandardInterruptiveItemTest.php.

Member Function Documentation

◆ getItem()

StandardInterruptiveItemTest::getItem ( )
protected

Definition at line 43 of file StandardInterruptiveItemTest.php.

Referenced by testGetDescription(), testGetIcon(), testGetTitle(), and testRender().

43  : Standard
44  {
45  return new Standard(
46  $this->id,
47  $this->title,
48  $this->image,
49  $this->description
50  );
51  }
+ Here is the caller graph for this function:

◆ getItemWithoutDescription()

StandardInterruptiveItemTest::getItemWithoutDescription ( )
protected

Definition at line 53 of file StandardInterruptiveItemTest.php.

Referenced by testGetDescription(), and testRenderWithoutDescription().

53  : Standard
54  {
55  return new Standard(
56  $this->id,
57  $this->title,
58  $this->image
59  );
60  }
+ Here is the caller graph for this function:

◆ getItemWithoutIcon()

StandardInterruptiveItemTest::getItemWithoutIcon ( )
protected

Definition at line 62 of file StandardInterruptiveItemTest.php.

Referenced by testGetIcon(), and testRenderWithoutIcon().

62  : Standard
63  {
64  return new Standard(
65  $this->id,
66  $this->title,
67  null,
68  $this->description
69  );
70  }
+ Here is the caller graph for this function:

◆ setUp()

StandardInterruptiveItemTest::setUp ( )

Definition at line 35 of file StandardInterruptiveItemTest.php.

35  : void
36  {
37  $this->id = 'id';
38  $this->title = 'title';
39  $this->image = new I\Image\Image(C\Image\Image::STANDARD, 'path', 'alt');
40  $this->description = 'description';
41  }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...

◆ testGetDescription()

StandardInterruptiveItemTest::testGetDescription ( )

Definition at line 86 of file StandardInterruptiveItemTest.php.

References getItem(), and getItemWithoutDescription().

86  : void
87  {
88  $item = $this->getItem();
89  $this->assertEquals($this->description, $item->getDescription());
90  $item = $this->getItemWithoutDescription();
91  $this->assertEquals('', $item->getDescription());
92  }
+ Here is the call graph for this function:

◆ testGetIcon()

StandardInterruptiveItemTest::testGetIcon ( )

Definition at line 78 of file StandardInterruptiveItemTest.php.

References getItem(), and getItemWithoutIcon().

78  : void
79  {
80  $item = $this->getItem();
81  $this->assertEquals($this->image, $item->getIcon());
82  $item = $this->getItemWithoutIcon();
83  $this->assertNull($item->getIcon());
84  }
+ Here is the call graph for this function:

◆ testGetTitle()

StandardInterruptiveItemTest::testGetTitle ( )

Definition at line 72 of file StandardInterruptiveItemTest.php.

References getItem().

72  : void
73  {
74  $item = $this->getItem();
75  $this->assertEquals($this->title, $item->getTitle());
76  }
+ Here is the call graph for this function:

◆ testRender()

StandardInterruptiveItemTest::testRender ( )

Definition at line 94 of file StandardInterruptiveItemTest.php.

References $r, ILIAS_UI_TestBase\brutallyTrimHTML(), ILIAS_UI_TestBase\getDefaultRenderer(), and getItem().

94  : void
95  {
96  $r = $this->getDefaultRenderer();
97  $html = $r->render($this->getItem());
98 
99  $expected = <<<EOT
100 <tr class="c-modal--interruptive__items__standard">
101  <td>
102  <img src="path" class="img-standard" alt="alt" />
103  </td>
104  <td>
105  title <br>
106  description
107  </td>
108  <td>
109  <input type="hidden" name="interruptive_items[]" value="id">
110  </td>
111 </tr>
112 EOT;
113 
114  $this->assertEquals(
115  $this->brutallyTrimHTML($expected),
116  $this->brutallyTrimHTML($html)
117  );
118  }
getDefaultRenderer(JavaScriptBinding $js_binding=null, array $with_stub_renderings=[])
Definition: Base.php:377
brutallyTrimHTML(string $html)
A more radical version of normalizeHTML.
Definition: Base.php:475
$r
+ Here is the call graph for this function:

◆ testRenderWithoutDescription()

StandardInterruptiveItemTest::testRenderWithoutDescription ( )

Definition at line 120 of file StandardInterruptiveItemTest.php.

References $r, ILIAS_UI_TestBase\brutallyTrimHTML(), ILIAS_UI_TestBase\getDefaultRenderer(), and getItemWithoutDescription().

120  : void
121  {
122  $r = $this->getDefaultRenderer();
123  $html = $r->render($this->getItemWithoutDescription());
124 
125  $expected = <<<EOT
126 <tr class="c-modal--interruptive__items__standard">
127  <td>
128  <img src="path" class="img-standard" alt="alt" />
129  </td>
130  <td>
131  title
132  </td>
133  <td>
134  <input type="hidden" name="interruptive_items[]" value="id">
135  </td>
136 </tr>
137 EOT;
138 
139  $this->assertEquals(
140  $this->brutallyTrimHTML($expected),
141  $this->brutallyTrimHTML($html)
142  );
143  }
getDefaultRenderer(JavaScriptBinding $js_binding=null, array $with_stub_renderings=[])
Definition: Base.php:377
brutallyTrimHTML(string $html)
A more radical version of normalizeHTML.
Definition: Base.php:475
$r
+ Here is the call graph for this function:

◆ testRenderWithoutIcon()

StandardInterruptiveItemTest::testRenderWithoutIcon ( )

Definition at line 145 of file StandardInterruptiveItemTest.php.

References $r, ILIAS_UI_TestBase\brutallyTrimHTML(), ILIAS_UI_TestBase\getDefaultRenderer(), and getItemWithoutIcon().

145  : void
146  {
147  $r = $this->getDefaultRenderer();
148  $html = $r->render($this->getItemWithoutIcon());
149 
150  $expected = <<<EOT
151 <tr class="c-modal--interruptive__items__standard">
152  <td></td>
153  <td>
154  title <br>
155  description
156  </td>
157  <td>
158  <input type="hidden" name="interruptive_items[]" value="id">
159  </td>
160 </tr>
161 EOT;
162 
163  $this->assertEquals(
164  $this->brutallyTrimHTML($expected),
165  $this->brutallyTrimHTML($html)
166  );
167  }
getDefaultRenderer(JavaScriptBinding $js_binding=null, array $with_stub_renderings=[])
Definition: Base.php:377
brutallyTrimHTML(string $html)
A more radical version of normalizeHTML.
Definition: Base.php:475
$r
+ Here is the call graph for this function:

Field Documentation

◆ $description

string StandardInterruptiveItemTest::$description
private

Definition at line 33 of file StandardInterruptiveItemTest.php.

◆ $id

string StandardInterruptiveItemTest::$id
private

Definition at line 30 of file StandardInterruptiveItemTest.php.

◆ $image

I Image Image StandardInterruptiveItemTest::$image
private

Definition at line 32 of file StandardInterruptiveItemTest.php.

◆ $title

string StandardInterruptiveItemTest::$title
private

Definition at line 31 of file StandardInterruptiveItemTest.php.


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