ILIAS  trunk Revision v11.0_alpha-2662-g519ff7d528f
ilServicesMainMenuTest Class Reference
+ Inheritance diagram for ilServicesMainMenuTest:
+ Collaboration diagram for ilServicesMainMenuTest:

Public Member Functions

 testTypeHandlers ()
 PhpArrayIndexImmediatelyRewrittenInspection More...
 
 testStandardTopItems ()
 

Protected Member Functions

 setUp ()
 
 tearDown ()
 

Protected Attributes

ilDBInterface $db_mock
 
Container $dic_mock
 

Private Attributes

Container $dic_backup
 

Detailed Description

Definition at line 45 of file ilServicesMainMenuTest.php.

Member Function Documentation

◆ setUp()

ilServicesMainMenuTest::setUp ( )
protected

Definition at line 54 of file ilServicesMainMenuTest.php.

References $DIC.

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

◆ tearDown()

ilServicesMainMenuTest::tearDown ( )
protected

Definition at line 80 of file ilServicesMainMenuTest.php.

References $DIC, and $dic_backup.

80  : void
81  {
82  global $DIC;
83  $DIC = $this->dic_backup;
84  }
global $DIC
Definition: shib_login.php:26

◆ testStandardTopItems()

ilServicesMainMenuTest::testStandardTopItems ( )

Definition at line 142 of file ilServicesMainMenuTest.php.

References ILIAS\GlobalScreen\isGlobalScreenItem\getProviderIdentification().

142  : void
143  {
144  $this->dic_mock['lng'] = $this->createMock(ilLanguage::class);
145  $standard_top_items = new StandardTopItemsProvider($this->dic_mock);
146  $items = $standard_top_items->getStaticTopItems();
147  $item_identifications = array_map(
149  $items
150  );
151 
152  $this->assertCount(7, $items); // this contains Dashboard as well
153  $this->assertCount(7, $item_identifications);
154 
155  $repo = $standard_top_items->getRepositoryIdentification();
156  $this->assertContains($repo, $item_identifications);
157 
158  $admin = $standard_top_items->getAdministrationIdentification();
159  $this->assertContains($admin, $item_identifications);
160 
161  $achievments = $standard_top_items->getAchievementsIdentification();
162  $this->assertContains($achievments, $item_identifications);
163 
164  $communication = $standard_top_items->getCommunicationIdentification();
165  $this->assertContains($communication, $item_identifications);
166 
167  $organisation = $standard_top_items->getOrganisationIdentification();
168  $this->assertContains($communication, $item_identifications);
169 
170  $personal = $standard_top_items->getPersonalWorkspaceIdentification();
171  $this->assertContains($personal, $item_identifications);
172  }
+ Here is the call graph for this function:

◆ testTypeHandlers()

ilServicesMainMenuTest::testTypeHandlers ( )

PhpArrayIndexImmediatelyRewrittenInspection

Definition at line 87 of file ilServicesMainMenuTest.php.

References $provider, and $renderer.

87  : void
88  {
89  $provider = new CustomMainBarProvider($this->dic_mock, $this->createMock(ilMainMenuAccess::class));
90  $type_info = $provider->provideTypeInformation();
91  $this->assertInstanceOf(TypeInformationCollection::class, $type_info);
92 
93  // TopLink Item
94  $item_type_info = $type_info->get(TopParentItem::class);
95  $renderer = $item_type_info->getRenderer();
96  $this->assertInstanceOf(TopParentItemRenderer::class, $renderer);
97  $this->assertInstanceOf(
98  Combined::class,
99  $renderer->getComponentForItem(new TopParentItem(new NullIdentification()))
100  );
101 
102  // Link Item
103  $item_type_info = $type_info->get(Link::class);
104  $renderer = $item_type_info->getRenderer();
105  $this->assertInstanceOf(ilMMLinkItemRenderer::class, $renderer);
106  $this->assertInstanceOf(
107  \ILIAS\UI\Component\Link\Link::class,
108  $renderer->getComponentForItem(new Link(new NullIdentification()))
109  );
110 
111  // LinkList Item
112  $item_type_info = $type_info->get(LinkList::class);
113  $renderer = $item_type_info->getRenderer();
114  $this->assertInstanceOf(LinkListItemRenderer::class, $renderer);
115  $this->assertInstanceOf(
116  Combined::class,
117  $renderer->getComponentForItem(new LinkList(new NullIdentification()))
118  );
119 
120  // Separator Item
121  $item_type_info = $type_info->get(Separator::class);
122  $renderer = $item_type_info->getRenderer();
123  $this->assertInstanceOf(SeparatorItemRenderer::class, $renderer);
124  $this->assertInstanceOf(
125  Horizontal::class,
126  $renderer->getComponentForItem(new Separator(new NullIdentification()))
127  );
128 
129  // RepositoryLink Item
130  $this->dic_mock['ilObjDataCache'] = $this->createMock(ilObjectDataCache::class);
131  $this->dic_mock['static_url'] = $this->createMock(\ILIAS\StaticURL\Services::class);
132  $item_type_info = $type_info->get(RepositoryLink::class);
133  $renderer = $item_type_info->getRenderer();
134  $this->assertInstanceOf(ilMMRepositoryLinkItemRenderer::class, $renderer);
135  // Cannot render this due to missing mocking of ilLink
136  // $this->assertInstanceOf(
137  // \ILIAS\UI\Component\Link\Link::class,
138  // $renderer->getComponentForItem(new RepositoryLink(new NullIdentification()))
139  // );
140  }
$renderer
Interface Observer Contains several chained tasks and infos about them.
$provider
Definition: ltitoken.php:80

Field Documentation

◆ $db_mock

ilDBInterface ilServicesMainMenuTest::$db_mock
protected

Definition at line 51 of file ilServicesMainMenuTest.php.

◆ $dic_backup

Container ilServicesMainMenuTest::$dic_backup
private

Definition at line 47 of file ilServicesMainMenuTest.php.

Referenced by tearDown().

◆ $dic_mock

Container ilServicesMainMenuTest::$dic_mock
protected

Definition at line 52 of file ilServicesMainMenuTest.php.


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