ILIAS  release_8 Revision v8.24
ilServicesMainMenuTest Class Reference
+ Inheritance diagram for ilServicesMainMenuTest:
+ Collaboration diagram for ilServicesMainMenuTest:

Public Member Functions

 testTypeHandlers ()
 @noinspection PhpArrayIndexImmediatelyRewrittenInspection More...
 
 testStandardTopItems ()
 

Protected Member Functions

 setUp ()
 
 tearDown ()
 

Protected Attributes

ilDBInterface $db_mock
 
Container $dic_mock
 

Private Attributes

ILIAS DI Container $dic_backup
 

Detailed Description

Definition at line 46 of file ilServicesMainMenuTest.php.

Member Function Documentation

◆ setUp()

ilServicesMainMenuTest::setUp ( )
protected

Definition at line 55 of file ilServicesMainMenuTest.php.

55 : void
56 {
57 global $DIC;
58 if (!defined('ILIAS_HTTP_PATH')) {
59 define('ILIAS_HTTP_PATH', 'https://ilias.de/');
60 }
61 if (!defined('CLIENT_ID')) {
62 define('CLIENT_ID', 'client');
63 }
64 if (!defined('SYSTEM_FOLDER_ID')) {
65 define('SYSTEM_FOLDER_ID', 0);
66 }
67 $this->dic_backup = is_object($DIC) ? clone $DIC : $DIC;
68 $this->dic_mock = $DIC = new Container();
69 $this->provider_factory_mock = $this->createMock(ProviderFactory::class);
70 $this->gs_mock = $DIC['global_screen'] = new Services($this->provider_factory_mock);
71 $this->db_mock = $DIC['ilDB'] = $this->createMock(ilDBInterface::class);
72 $this->dic_mock['ilUser'] = $DIC['ilUser'] = $this->createMock(ilObjUser::class);
73 $this->dic_mock['ilSetting'] = $DIC['ilSetting'] = $this->createMock(ilSetting::class);
74 $this->dic_mock['rbacsystem'] = $DIC['rbacsystem'] = $this->createMock(ilRbacSystem::class);
75 $this->dic_mock['lng'] = $DIC['lng'] = $this->createMock(ilLanguage::class);
76 $this->dic_mock['ui.factory'] = $DIC['ui.factory'] = $this->createMock(\ILIAS\UI\Factory::class);
77 $this->dic_mock['ui.renderer'] = $DIC['ui.renderer'] = $this->createMock(\ILIAS\UI\Renderer::class);
78 $this->dic_mock['objDefinition'] = $DIC['objDefinition'] = $this->createMock(ilObjectDefinition::class);
79 }
Customizing of pimple-DIC for ILIAS.
Definition: Container.php:32
global $DIC
Definition: feed.php:28
Class ChatMainBarProvider \MainMenu\Provider.
Class Factory.

References $DIC.

◆ tearDown()

ilServicesMainMenuTest::tearDown ( )
protected

Definition at line 81 of file ilServicesMainMenuTest.php.

81 : void
82 {
83 global $DIC;
85 }
ILIAS DI Container $dic_backup

References $DIC, and $dic_backup.

◆ testStandardTopItems()

ilServicesMainMenuTest::testStandardTopItems ( )

Definition at line 141 of file ilServicesMainMenuTest.php.

141 : void
142 {
143 $this->dic_mock['lng'] = $this->createMock(ilLanguage::class);
144 $standard_top_items = new StandardTopItemsProvider($this->dic_mock);
145 $items = $standard_top_items->getStaticTopItems();
146 $item_identifications = array_map(
147 fn (isItem $i): IdentificationInterface => $i->getProviderIdentification(),
148 $items
149 );
150
151 $this->assertEquals(7, count($items)); // this contains Dashboard as well
152 $this->assertEquals(7, count($item_identifications));
153
154 $repo = $standard_top_items->getRepositoryIdentification();
155 $this->assertTrue(in_array($repo, $item_identifications));
156
157 $admin = $standard_top_items->getAdministrationIdentification();
158 $this->assertTrue(in_array($admin, $item_identifications));
159
160 $achievments = $standard_top_items->getAchievementsIdentification();
161 $this->assertTrue(in_array($achievments, $item_identifications));
162
163 $communication = $standard_top_items->getCommunicationIdentification();
164 $this->assertTrue(in_array($communication, $item_identifications));
165
166 $organisation = $standard_top_items->getOrganisationIdentification();
167 $this->assertTrue(in_array($communication, $item_identifications));
168
169 $personal = $standard_top_items->getPersonalWorkspaceIdentification();
170 $this->assertTrue(in_array($personal, $item_identifications));
171
172
173// $this->assertFalse(true);
174 }
$i
Definition: metadata.php:41

References $i.

◆ testTypeHandlers()

ilServicesMainMenuTest::testTypeHandlers ( )

@noinspection PhpArrayIndexImmediatelyRewrittenInspection

Definition at line 88 of file ilServicesMainMenuTest.php.

88 : void
89 {
90 $provider = new CustomMainBarProvider($this->dic_mock, $this->createMock(ilMainMenuAccess::class));
91 $type_info = $provider->provideTypeInformation();
92 $this->assertInstanceOf(TypeInformationCollection::class, $type_info);
93
94 // TopLink Item
95 $item_type_info = $type_info->get(TopParentItem::class);
96 $renderer = $item_type_info->getRenderer();
97 $this->assertInstanceOf(TopParentItemRenderer::class, $renderer);
98 $this->assertInstanceOf(
99 Combined::class,
100 $renderer->getComponentForItem(new TopParentItem(new NullIdentification()))
101 );
102
103 // Link Item
104 $item_type_info = $type_info->get(Link::class);
105 $renderer = $item_type_info->getRenderer();
106 $this->assertInstanceOf(ilMMLinkItemRenderer::class, $renderer);
107 $this->assertInstanceOf(
108 \ILIAS\UI\Component\Link\Link::class,
109 $renderer->getComponentForItem(new Link(new NullIdentification()))
110 );
111
112 // LinkList Item
113 $item_type_info = $type_info->get(LinkList::class);
114 $renderer = $item_type_info->getRenderer();
115 $this->assertInstanceOf(LinkListItemRenderer::class, $renderer);
116 $this->assertInstanceOf(
117 Combined::class,
118 $renderer->getComponentForItem(new LinkList(new NullIdentification()))
119 );
120
121 // Separator Item
122 $item_type_info = $type_info->get(Separator::class);
123 $renderer = $item_type_info->getRenderer();
124 $this->assertInstanceOf(SeparatorItemRenderer::class, $renderer);
125 $this->assertInstanceOf(
126 Horizontal::class,
127 $renderer->getComponentForItem(new Separator(new NullIdentification()))
128 );
129
130 // RepositoryLink Item
131 $this->dic_mock['ilObjDataCache'] = $this->createMock(ilObjectDataCache::class);
132 $item_type_info = $type_info->get(RepositoryLink::class);
133 $renderer = $item_type_info->getRenderer();
134 $this->assertInstanceOf(ilMMRepositoryLinkItemRenderer::class, $renderer);
135 $this->assertInstanceOf(
136 \ILIAS\UI\Component\Link\Link::class,
137 $renderer->getComponentForItem(new RepositoryLink(new NullIdentification()))
138 );
139 }
$provider
Definition: ltitoken.php:83
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...

References $provider.

Field Documentation

◆ $db_mock

ilDBInterface ilServicesMainMenuTest::$db_mock
protected

Definition at line 52 of file ilServicesMainMenuTest.php.

◆ $dic_backup

ILIAS DI Container ilServicesMainMenuTest::$dic_backup
private

Definition at line 48 of file ilServicesMainMenuTest.php.

Referenced by tearDown().

◆ $dic_mock

Container ilServicesMainMenuTest::$dic_mock
protected

Definition at line 53 of file ilServicesMainMenuTest.php.


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