ILIAS  trunk Revision v12.0_alpha-1540-g00f839d5fa1
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;
27
28class ilKSDocumentationEntryGUITest extends TestCase
29{
30 protected ilKSDocumentationEntryGUI $entry_gui;
31
32 protected function setUp(): void
33 {
34 $ui_helper = new UITestHelper();
35
36 $ctrl = $this->getMockBuilder(ilCtrl::class)->disableOriginalConstructor()->onlyMethods([
37 'setParameterByClass'
38 ])->getMock();
39
40 $entries_data = include './components/ILIAS/UI/tests/Crawler/Fixture/EntriesFixture.php';
41 $entries = new Entries();
42 $entries->addEntriesFromArray($entries_data);
43
44 $this->entry_gui = new ilKSDocumentationEntryGUI(
45 $ui_helper->factory(),
46 $ctrl,
47 $entries,
48 'Entry1'
49 );
50 }
51
52 public function testConstruct(): void
53 {
54 $this->assertInstanceOf(ilKSDocumentationEntryGUI::class, $this->entry_gui);
55 }
56
57 public function testRenderEntry(): void
58 {
59 $report = $this->entry_gui->createUIComponentOfEntry();
60 $this->assertInstanceOf(Report::class, $report);
61 $this->assertEquals('Entry1Title', $report->getTitle());
62 }
63}
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.