ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
ilKSDocumentationEntryGUITest.php
Go to the documentation of this file.
1<?php
2
19declare(strict_types=1);
20
21require_once('vendor/composer/vendor/autoload.php');
22include_once('./components/ILIAS/UI/tests/UITestHelper.php');
23
24use PHPUnit\Framework\TestCase;
25
28
29class ilKSDocumentationEntryGUITest extends TestCase
30{
31 protected ilKSDocumentationEntryGUI $entry_gui;
32
33 protected function setUp(): void
34 {
35 $ui_helper = new UITestHelper();
36
37 $ctrl = $this->getMockBuilder(ilCtrl::class)->disableOriginalConstructor()->onlyMethods([
38 'setParameterByClass'
39 ])->getMock();
40
41 $entries_data = include './components/ILIAS/UI/tests/Crawler/Fixture/EntriesFixture.php';
42 $entries = new Entries();
43 $entries->addEntriesFromArray($entries_data);
44
45 $this->entry_gui = new ilKSDocumentationEntryGUI(
46 $ui_helper->factory(),
47 $ctrl,
48 $entries,
49 'Entry1'
50 );
51 }
52
53 public function testConstruct(): void
54 {
55 $this->assertInstanceOf(ilKSDocumentationEntryGUI::class, $this->entry_gui);
56 }
57
58 public function testRenderEntry(): void
59 {
60 $report = $this->entry_gui->createUIComponentOfEntry();
61 $this->assertInstanceOf(Report::class, $report);
62 $this->assertEquals('Entry1Title', $report->getTitle());
63 }
64}
trait UITestHelper
Class UITestHelper can be helpful for test cases outside the UI Components, to inject a working facto...
Container storing a list of UI Component Entries, can act as Iterator, countable and is serializable.