ILIAS  trunk Revision v11.0_alpha-1702-gfd3ecb7f852
All Data Structures Namespaces Files Functions Variables Enumerations Enumerator Modules Pages
TabsManagerTest.php
Go to the documentation of this file.
1 <?php
2 
19 declare(strict_types=1);
20 
22 
26 
31 {
33 
34  protected function setUp(): void
35  {
36  global $DIC;
37  parent::setUp();
38 
39  $this->addGlobal_ilTabs();
40 
41  $this->testObj = new TabsManager(
42  $DIC['ilTabs'],
43  $this->createMock(\ilLanguage::class),
44  $this->createMock(\ilCtrl::class),
45  $this->createMock(\ilAccess::class),
46  $this->createMock(\ilTestAccess::class),
47  $this->getTestObjMock(),
48  $this->createMock(\ilTestObjectiveOrientedContainer::class),
49  $this->createMock(\ilTestSession::class)
50  );
51  }
52 
54  {
55  $this->assertInstanceOf(TabsManager::class, $this->testObj);
56  }
57 
58  public function testActivateTab(): void
59  {
60  global $DIC;
61  $DIC['ilTabs']->expects($this->exactly(2))->method('activateTab');
62  $this->testObj->activateTab(TabsManager::TAB_ID_PARTICIPANTS);
63  $this->testObj->activateTab(TabsManager::TAB_ID_YOUR_RESULTS);
64  $this->testObj->activateTab('randomString');
65  }
66 
67  public function testActivateSubTab(): void
68  {
69  global $DIC;
70  $DIC['ilTabs']->expects($this->exactly(7))->method('activateSubTab');
71 
72  $this->testObj->activateSubTab(TabsManager::SUBTAB_ID_MY_RESULTS);
73  $this->testObj->activateSubTab(TabsManager::SUBTAB_ID_LO_RESULTS);
74  $this->testObj->activateSubTab(TabsManager::SUBTAB_ID_HIGHSCORE);
75  $this->testObj->activateSubTab(TabsManager::SUBTAB_ID_SKILL_RESULTS);
76  $this->testObj->activateSubTab(TabsManager::SUBTAB_ID_MY_SOLUTIONS);
77  $this->testObj->activateSubTab(TabsManager::SUBTAB_ID_QST_LIST_VIEW);
78  $this->testObj->activateSubTab(TabsManager::SUBTAB_ID_QST_PAGE_VIEW);
79  $this->testObj->activateSubTab('randomString');
80  }
81 
82  public function testParentBackLabel(): void
83  {
84  $parent_back_label = 'Test';
85  $this->testObj->setParentBackLabel($parent_back_label);
86  $this->assertEquals($parent_back_label, $this->testObj->getParentBackLabel());
87  }
88 
89  public function testParentBackHref(): void
90  {
91  $parent_back_href = 'Test';
92  $this->testObj->setParentBackHref($parent_back_href);
93  $this->assertEquals($parent_back_href, $this->testObj->getParentBackHref());
94  }
95 
96  public function testHasParentBackLink(): void
97  {
98  $this->assertFalse($this->testObj->hasParentBackLink());
99  $parent_back_x = 'Test';
100 
101  $this->testObj->setParentBackHref($parent_back_x);
102  $this->assertFalse($this->testObj->hasParentBackLink());
103 
104  $this->testObj->setParentBackLabel($parent_back_x);
105  $this->assertTrue($this->testObj->hasParentBackLink());
106  }
107 }
global $DIC
Definition: shib_login.php:22
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
Class ilTestBaseClass.