ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
KeyValueInterruptiveItemTest.php
Go to the documentation of this file.
1<?php
2
19declare(strict_types=1);
20
21require_once("vendor/composer/vendor/autoload.php");
22require_once(__DIR__ . "../../../../Base.php");
23
27
29{
30 private string $id;
31 private string $key;
32 private string $value;
33
34 public function setUp(): void
35 {
36 $this->id = 'id';
37 $this->key = 'key';
38 $this->value = 'value';
39 }
40
41 protected function getItem(): KeyValue
42 {
43 return new KeyValue(
44 $this->id,
45 $this->key,
46 $this->value
47 );
48 }
49
50 public function testGetKey(): void
51 {
52 $item = $this->getItem();
53 $this->assertEquals($this->key, $item->getKey());
54 }
55
56 public function testGetValue(): void
57 {
58 $item = $this->getItem();
59 $this->assertEquals($this->value, $item->getValue());
60 }
61
62 public function testRender(): void
63 {
64 $r = $this->getDefaultRenderer();
65 $html = $r->render($this->getItem());
66
67 $expected = <<<EOT
68<div class="c-modal--interruptive__items__key-value">
69 <dt class="c-modal--interruptive__items__key-value__key">
70 key <input type="hidden" name="interruptive_items[]" value="id">
71 </dt>
72 <dd class="c-modal--interruptive__items__key-value__value">
73 value
74 </dd>
75</div>
76EOT;
77
78 $this->assertEquals(
79 $this->brutallyTrimHTML($expected),
80 $this->brutallyTrimHTML($html)
81 );
82 }
83}
Provides common functionality for UI tests.
Definition: Base.php:337