ILIAS  release_8 Revision v8.19
All Data Structures Namespaces Files Functions Variables Modules Pages
WrapperTest.php
Go to the documentation of this file.
1 <?php
2 
19 declare(strict_types=1);
20 
22 
24 
29 {
30  public function testRenderWrapper(): void
31  {
32  $expected_title = 'test_title';
33  $expected_url = 'test_url';
34  $expected_legacy_html = 'test_legacy_html';
35 
36  $expected_html = $this->brutallyTrimHTML("
37  <div id=\"id_2\" class=\"ui-dropzone ui-dropzone-wrapper\">
38  <div class=\"modal fade il-modal-roundtrip\" tabindex=\"-1\" role=\"dialog\" id=\"id_1\">
39  <div class=\"modal-dialog\" role=\"document\" data-replace-marker=\"component\">
40  <div class=\"modal-content\">
41  <div class=\"modal-header\">
42  <button type=\"button\" class=\"close\" data-dismiss=\"modal\" aria-label=\"close\">
43  <span aria-hidden=\"true\">&times;</span>
44  </button>
45  <span class=\"modal-title\">$expected_title</span>
46  </div>
47  <div class=\"modal-body\">
48  </div>
49  <div class=\"modal-footer\">
50  <button class=\"btn btn-default\" data-dismiss=\"modal\">cancel</button>
51  </div>
52  </div>
53  </div>
54  </div>
55  <div class=\"ui-dropzone-container\"> $expected_legacy_html</div>
56  </div>
57  ");
58 
59  $legacy_mock = $this->createMock(Legacy::class);
60  $legacy_mock->method('getCanonicalName')->willReturn($expected_legacy_html);
61 
62  $dropzone = $this->factory->wrapper($expected_title, $expected_url, $legacy_mock, $this->input);
63 
64  $html = $this->brutallyTrimHTML($this->getDefaultRenderer(null, [
65  $legacy_mock,
66  $this->input,
67  ])->render($dropzone));
68 
69  $this->assertEquals($expected_html, $html);
70  }
71 }
getDefaultRenderer(JavaScriptBinding $js_binding=null, array $with_stub_renderings=[])
Definition: Base.php:355
brutallyTrimHTML(string $html)
A more radical version of normalizeHTML.
Definition: Base.php:444