diff --git a/components/ILIAS/Test/classes/class.ilMyTestResultsGUI.php b/components/ILIAS/Test/classes/class.ilMyTestResultsGUI.php index 7dc186af6638..d2e3149cb5c7 100755 --- a/components/ILIAS/Test/classes/class.ilMyTestResultsGUI.php +++ b/components/ILIAS/Test/classes/class.ilMyTestResultsGUI.php @@ -36,13 +36,10 @@ */ class ilMyTestResultsGUI { - private const EVALGUI_CMD_SHOW_PASS_OVERVIEW = 'outUserResultsOverview'; - public function __construct( private readonly ?ilObjTest $test_obj, private readonly ilTestAccess $test_access, private readonly ilTestObjectiveOrientedContainer $objective_parent, - private readonly ilObjUser $user, private readonly ilLanguage $lng, private readonly ilCtrlInterface $ctrl, private readonly ilGlobalTemplateInterface $tpl, @@ -54,28 +51,26 @@ public function __construct( public function executeCommand(): void { switch ($this->ctrl->getNextClass()) { - case "iltestevaluationgui": + case strtolower(ilTestEvaluationGUI::class): $gui = new ilTestEvaluationGUI($this->test_obj); $gui->setObjectiveOrientedContainer($this->objective_parent); $gui->setTestAccess($this->test_access); if ($this->ctrl->getCmd() === '') { - $gui->{self::EVALGUI_CMD_SHOW_PASS_OVERVIEW}(); + $gui->outUserResultsOverview(); break; } $this->ctrl->forwardCommand($gui); break; - case 'ilassquestionpagegui': - $forwarder = new ilAssQuestionPageCommandForwarder( + case strtolower(ilAssQuestionPageGUI::class): + (new ilAssQuestionPageCommandForwarder( $this->test_obj, $this->lng, $this->ctrl, $this->tpl, $this->questionrepository, - $this->testrequest, - $this->user->getId() - ); - $forwarder->forward(); + $this->testrequest + ))->forward(); break; } } diff --git a/components/ILIAS/Test/classes/class.ilMyTestSolutionsGUI.php b/components/ILIAS/Test/classes/class.ilMyTestSolutionsGUI.php deleted file mode 100755 index d012176fdc07..000000000000 --- a/components/ILIAS/Test/classes/class.ilMyTestSolutionsGUI.php +++ /dev/null @@ -1,77 +0,0 @@ - - * @version $Id$ - * - * @package components\ILIAS/Test - * - * @ilCtrl_Calls ilMyTestSolutionsGUI: ilTestEvaluationGUI - * @ilCtrl_Calls ilMyTestSolutionsGUI: ilAssQuestionPageGUI - */ -class ilMyTestSolutionsGUI -{ - private const EVALGUI_CMD_SHOW_PASS_OVERVIEW = 'outUserListOfAnswerPasses'; - - public function __construct( - private readonly ?ilObjTest $test_obj, - private readonly ilTestAccess $test_access, - private readonly ilTestObjectiveOrientedContainer $objective_parent, - private readonly ilLanguage $lng, - private readonly ilCtrlInterface $ctrl, - private readonly ilGlobalTemplateInterface $tpl, - private readonly GeneralQuestionPropertiesRepository $questionrepository, - private readonly RequestDataCollector $testrequest - ) { - } - - public function executeCommand(): void - { - switch ($this->ctrl->getNextClass()) { - case "iltestevaluationgui": - $gui = new ilTestEvaluationGUI($this->test_obj); - if ($this->ctrl->getCmd() === '') { - $gui->{self::EVALGUI_CMD_SHOW_PASS_OVERVIEW}(); - break; - } - $this->ctrl->forwardCommand($gui); - break; - - case 'ilassquestionpagegui': - $forwarder = new ilAssQuestionPageCommandForwarder( - $this->test_obj, - $this->lng, - $this->ctrl, - $this->tpl, - $this->questionrepository, - $this->testrequest - ); - $forwarder->forward(); - break; - } - } -} diff --git a/components/ILIAS/Test/classes/class.ilTestResultsGUI.php b/components/ILIAS/Test/classes/class.ilTestResultsGUI.php index cea9b8df6fd5..7b09f59203d0 100755 --- a/components/ILIAS/Test/classes/class.ilTestResultsGUI.php +++ b/components/ILIAS/Test/classes/class.ilTestResultsGUI.php @@ -42,7 +42,6 @@ * * @ilCtrl_Calls ilTestResultsGUI: ilMyTestResultsGUI * @ilCtrl_Calls ilTestResultsGUI: ilTestEvalObjectiveOrientedGUI - * @ilCtrl_Calls ilTestResultsGUI: ilMyTestSolutionsGUI * @ilCtrl_Calls ilTestResultsGUI: ilTestToplistGUI * @ilCtrl_Calls ilTestResultsGUI: ilTestSkillEvaluationGUI */ @@ -88,13 +87,16 @@ public function executeCommand(): void ilObjTestGUI::accessViolationRedirect(); } - $this->test_tabs->activateSubTab(TabsManager::SUBTAB_ID_MY_RESULTS); + $this->test_tabs->activateSubTab( + $this->ctrl->getCmd() === 'outUserListOfAnswerPasses' + ? TabsManager::SUBTAB_ID_MY_SOLUTIONS + : TabsManager::SUBTAB_ID_MY_RESULTS + ); $gui = new ilMyTestResultsGUI( $this->test_object, $this->test_access, $this->objective_parent, - $this->user, $this->lng, $this->ctrl, $this->main_tpl, @@ -116,26 +118,6 @@ public function executeCommand(): void $this->ctrl->forwardCommand($gui); break; - case 'ilmytestsolutionsgui': - if (!$this->test_tabs->needsYourSolutionsSubTab()) { - ilObjTestGUI::accessViolationRedirect(); - } - - $this->test_tabs->activateSubTab(TabsManager::SUBTAB_ID_MY_SOLUTIONS); - - $gui = new ilMyTestSolutionsGUI( - $this->test_object, - $this->test_access, - $this->objective_parent, - $this->lng, - $this->ctrl, - $this->main_tpl, - $this->questionrepository, - $this->testrequest - ); - $this->ctrl->forwardCommand($gui); - break; - case 'iltesttoplistgui': if (!$this->test_tabs->needsHighSoreSubTab()) { ilObjTestGUI::accessViolationRedirect(); diff --git a/components/ILIAS/Test/src/Presentation/TabsManager.php b/components/ILIAS/Test/src/Presentation/TabsManager.php index 80ad7392ce46..84d741e77ebb 100755 --- a/components/ILIAS/Test/src/Presentation/TabsManager.php +++ b/components/ILIAS/Test/src/Presentation/TabsManager.php @@ -724,15 +724,11 @@ public function needsYourResultsTab(): bool protected function getYourResultsTabTarget(): string { - if ($this->needsLoResultsSubTab()) { - return $this->ctrl->getLinkTargetByClass([\ilObjTestGUI::class, \ilTestResultsGUI::class, \ilTestEvalObjectiveOrientedGUI::class]); - } - - if ($this->needsYourSolutionsSubTab()) { - return $this->ctrl->getLinkTargetByClass([\ilTestResultsGUI::class, \ilMyTestSolutionsGUI::class, \ilTestEvaluationGUI::class]); - } - - return $this->ctrl->getLinkTargetByClass([\ilTestResultsGUI::class, \ilMyTestResultsGUI::class, \ilTestEvaluationGUI::class]); + return $this->ctrl->getLinkTargetByClass( + $this->needsLoResultsSubTab() + ? [\ilObjTestGUI::class, \ilTestResultsGUI::class, \ilTestEvalObjectiveOrientedGUI::class] + : [\ilTestResultsGUI::class, \ilMyTestResultsGUI::class, \ilTestEvaluationGUI::class] + ); } protected function needsYourResultsSubTab(): bool @@ -816,7 +812,10 @@ public function getYourResultsSubTabs(): void $this->tabs->addSubTab( self::SUBTAB_ID_MY_SOLUTIONS, $this->lng->txt('tst_list_of_answers_show'), - $this->ctrl->getLinkTargetByClass([\ilTestResultsGUI::class, \ilMyTestSolutionsGUI::class, \ilTestEvaluationGUI::class]) + $this->ctrl->getLinkTargetByClass( + [\ilTestResultsGUI::class, \ilMyTestResultsGUI::class, \ilTestEvaluationGUI::class], + 'outUserListOfAnswerPasses' + ) ); } } diff --git a/components/ILIAS/Test/tests/ilMyTestResultsGUITest.php b/components/ILIAS/Test/tests/ilMyTestResultsGUITest.php index 280b51a47e81..a65fccd4ac11 100755 --- a/components/ILIAS/Test/tests/ilMyTestResultsGUITest.php +++ b/components/ILIAS/Test/tests/ilMyTestResultsGUITest.php @@ -42,7 +42,6 @@ protected function setUp(): void $this->test, $this->access, $this->objective_parent, - $this->createMock(ilObjUser::class), $this->createMock(ilLanguage::class), $this->createMock(ilCtrlInterface::class), $this->createMock(ilGlobalTemplateInterface::class), diff --git a/components/ILIAS/Test/tests/ilMyTestSolutionsGUITest.php b/components/ILIAS/Test/tests/ilMyTestSolutionsGUITest.php deleted file mode 100755 index f5bb8d6d98a6..000000000000 --- a/components/ILIAS/Test/tests/ilMyTestSolutionsGUITest.php +++ /dev/null @@ -1,55 +0,0 @@ - - */ -class ilMyTestSolutionsGUITest extends ilTestBaseTestCase -{ - private ilMyTestSolutionsGUI $testObj; - private ilObjTest $test; - private ilTestAccess $access; - private ilTestObjectiveOrientedContainer $objective_parent; - - protected function setUp(): void - { - parent::setUp(); - - $this->test = $this->getTestObjMock(); - $this->access = $this->createMock(ilTestAccess::class); - $this->objective_parent = $this->createMock(ilTestObjectiveOrientedContainer::class); - $this->testObj = new ilMyTestSolutionsGUI( - $this->test, - $this->access, - $this->objective_parent, - $this->createMock(ilLanguage::class), - $this->createMock(ilCtrlInterface::class), - $this->createMock(ilGlobalTemplateInterface::class), - $this->createMock(ILIAS\TestQuestionPool\Questions\GeneralQuestionPropertiesRepository::class), - $this->createMock(\ILIAS\Test\RequestDataCollector::class) - ); - } - - public function test_instantiateObject_shouldReturnInstance(): void - { - $this->assertInstanceOf(ilMyTestSolutionsGUI::class, $this->testObj); - } -}