forked from ILIAS-eLearning/ILIAS
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
TA: Ordering Table for Questionlist, tests
- Loading branch information
Showing
5 changed files
with
99 additions
and
44 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -20,6 +20,17 @@ | |
|
||
use ILIAS\DI\Container; | ||
|
||
class QuestionsTableQueryMock extends QuestionsTableQuery | ||
{ | ||
public function __construct() | ||
{ | ||
} | ||
private function getHereURL(): string | ||
{ | ||
return 'http://www.ilias.de'; | ||
} | ||
} | ||
|
||
/** | ||
* Class ilObjTestGUITest | ||
* @author Marvin Beym <[email protected]> | ||
|
@@ -33,6 +44,9 @@ protected function setUp(): void | |
if (!defined('ANONYMOUS_USER_ID')) { | ||
define('ANONYMOUS_USER_ID', 13); | ||
} | ||
if (!defined('CLIENT_DATA_DIR')) { | ||
define('CLIENT_DATA_DIR', 'data/'); | ||
} | ||
|
||
global $DIC; | ||
|
||
|
@@ -74,18 +88,13 @@ protected function setUp(): void | |
$this->addGlobal_objectService(); | ||
$this->addGlobal_GlobalScreenService(); | ||
|
||
$table_query_mock = new class () extends QuestionsTableQuery { | ||
private function getHereURL(): string | ||
{ | ||
return 'http://www.ilias.de'; | ||
} | ||
}; | ||
|
||
$table_query = $this->getMockBuilder($table_query_mock) | ||
->disableOriginalConstructor() | ||
->getMock(); | ||
$this->testObj = $this->getNewTestGUI(); | ||
} | ||
|
||
$this->testObj = new class ($table_query) extends ilObjTestGUI { | ||
protected function getNewTestGUI(): ilObjTestGUI | ||
{ | ||
$table_query = $this->getMockBuilder(QuestionsTableQueryMock::class)->getMock(); | ||
return new class ($table_query) extends ilObjTestGUI { | ||
public function __construct( | ||
protected QuestionsTableQuery $mock_table_query | ||
) { | ||
|
@@ -98,6 +107,7 @@ protected function getQuestionsTableQuery(): QuestionsTableQuery | |
}; | ||
} | ||
|
||
|
||
protected function tearDown(): void | ||
{ | ||
global $DIC; | ||
|
@@ -132,7 +142,7 @@ public function testRunObject(): void | |
{ | ||
$ctrl_mock = $this->createMock(ilCtrl::class); | ||
$this->setGlobalVariable('ilCtrl', $ctrl_mock); | ||
$testObj = new ilObjTestGUI(); | ||
$testObj = $this->getNewTestGUI(); | ||
$ctrl_mock | ||
->expects($this->once()) | ||
->method('redirect') | ||
|
@@ -151,7 +161,7 @@ public function testOutEvaluationObject(): void | |
; | ||
$this->setGlobalVariable('ilCtrl', $ctrl_mock); | ||
|
||
$testObj = new ilObjTestGUI(); | ||
$testObj = $this->getNewTestGUI(); | ||
|
||
$testObj->outEvaluationObject(); | ||
} | ||
|
@@ -160,7 +170,7 @@ public function testBackObject(): void | |
{ | ||
$ctrl_mock = $this->createMock(ilCtrl::class); | ||
$this->setGlobalVariable('ilCtrl', $ctrl_mock); | ||
$testObj = new ilObjTestGUI(); | ||
$testObj = $this->getNewTestGUI(); | ||
$ctrl_mock | ||
->expects($this->once()) | ||
->method('redirect') | ||
|
@@ -173,7 +183,7 @@ public function testCancelCreateQuestionObject(): void | |
{ | ||
$ctrl_mock = $this->createMock(ilCtrl::class); | ||
$this->setGlobalVariable('ilCtrl', $ctrl_mock); | ||
$testObj = new ilObjTestGUI(); | ||
$testObj = $this->getNewTestGUI(); | ||
$ctrl_mock | ||
->expects($this->once()) | ||
->method('redirect') | ||
|
@@ -186,7 +196,7 @@ public function testCancelRemoveQuestionsObject(): void | |
{ | ||
$ctrl_mock = $this->createMock(ilCtrl::class); | ||
$this->setGlobalVariable('ilCtrl', $ctrl_mock); | ||
$testObj = new ilObjTestGUI(); | ||
$testObj = $this->getNewTestGUI(); | ||
$ctrl_mock | ||
->expects($this->once()) | ||
->method('redirect') | ||
|
@@ -199,7 +209,7 @@ public function testMoveQuestionsObject(): void | |
{ | ||
$ctrl_mock = $this->createMock(ilCtrl::class); | ||
$this->setGlobalVariable('ilCtrl', $ctrl_mock); | ||
$testObj = new ilObjTestGUI(); | ||
$testObj = $this->getNewTestGUI(); | ||
$ctrl_mock | ||
->expects($this->once()) | ||
->method('redirect') | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters