Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,8 @@ public function testRedirectToOriginalTarget(): void
$ctrl = $this->mock(ilCtrl::class);
$ctrl->expects(self::once())->method('redirectToURL')->with('some url');

$this->expectException(\PHPUnit\Framework\MockObject\NeverReturningMethodException::class);

(new Routing(
$ctrl,
$session,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,8 +59,6 @@ function (array $params): string {

public function testFinishAndLogout(): void
{
$called = false;

$auth_session = $this->mock(ilAuthSession::class);
$auth_session->expects(self::once())->method('logout');

Expand All @@ -72,14 +70,13 @@ public function testFinishAndLogout(): void
$ctrl,
$auth_session,
$this->fail(...),
function (int $x) use (&$called) {
function (int $x) {
$this->assertSame(ilSession::SESSION_CLOSE_USER, $x);
$called = true;
}
);

$instance->finishAndLogout(['bar' => 'baz']);
$this->expectException(\PHPUnit\Framework\MockObject\NeverReturningMethodException::class);

$this->assertTrue($called);
$instance->finishAndLogout(['bar' => 'baz']);
}
}
2 changes: 2 additions & 0 deletions components/ILIAS/LegalDocuments/tests/StartUpStepTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,8 @@ public function testExecute(): void
$this->mockTree(Intercept::class, ['intercept' => true, 'id' => 'baz', 'target' => ['guiName' => 'foo', 'guiPath' => ['foo'], 'command' => 'bar']]),
]]));

$this->expectException(\PHPUnit\Framework\MockObject\NeverReturningMethodException::class);

$instance->execute();
}

Expand Down
3 changes: 3 additions & 0 deletions components/ILIAS/Mail/tests/gui/ilMailOptionsGUITest.php
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,9 @@ public function testMailOptionsAreNotAccessibleIfGlobalAccessIsDeniedAndUserWill

$gui = $this->getMailOptionsGUI($http, $ctrl, $options);
$gui->setForm($form);

$this->expectException(\PHPUnit\Framework\MockObject\NeverReturningMethodException::class);

$gui->executeCommand();
}

Expand Down
8 changes: 6 additions & 2 deletions components/ILIAS/Test/tests/ilObjTestGUITest.php
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,8 @@ public function testRunObject(): void
->method('redirectByClass')
->with([ilRepositoryGUI::class, ilObjTestGUI::class, ilInfoScreenGUI::class]);

$this->expectException(\PHPUnit\Framework\MockObject\NeverReturningMethodException::class);

$testObj->runObject();
}

Expand All @@ -96,8 +98,10 @@ public function testCancelCreateQuestionObject(): void
$ctrl_mock
->expects($this->once())
->method('redirect')
->with($testObj, ilObjTestGUI::SHOW_QUESTIONS_CMD)
;
->with($testObj, ilObjTestGUI::SHOW_QUESTIONS_CMD);

$this->expectException(\PHPUnit\Framework\MockObject\NeverReturningMethodException::class);

$testObj->cancelCreateQuestionObject();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,8 @@ protected function setUp(): void
$tabs = $this->createMock(ilTabsGUI::class);
$lng = $this->createMock(ilLanguage::class);

$this->expectException(\PHPUnit\Framework\MockObject\NeverReturningMethodException::class);

$this->object = new ilAssQuestionFeedbackPageObjectCommandForwarder($questionOBJ, $ctrl, $tabs, $lng);
}

Expand Down
6 changes: 3 additions & 3 deletions components/ILIAS/UICore/classes/class.ilCtrl.php
Original file line number Diff line number Diff line change
Expand Up @@ -395,7 +395,7 @@ public function redirect(
?string $a_cmd = null,
?string $a_anchor = null,
bool $is_async = false
): void {
): never {
$this->redirectByClass(
$this->getClassByObject($a_gui_obj),
$a_cmd,
Expand All @@ -412,7 +412,7 @@ public function redirectByClass(
?string $a_cmd = null,
?string $a_anchor = null,
bool $is_async = false
): void {
): never {
$this->redirectToURL(
$this->getLinkTargetByClass(
$a_class,
Expand All @@ -426,7 +426,7 @@ public function redirectByClass(
/**
* @inheritDoc
*/
public function redirectToURL(string $target_url): void
public function redirectToURL(string $target_url): never
{
// prepend the ILIAS HTTP path if it wasn't already.
if (defined("ILIAS_HTTP_PATH") &&
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -305,7 +305,7 @@ public function redirect(
?string $a_cmd = null,
?string $a_anchor = null,
bool $is_async = false
): void;
): never;

/**
* Redirects to the provided GUI class.
Expand All @@ -321,14 +321,14 @@ public function redirectByClass(
?string $a_cmd = null,
?string $a_anchor = null,
bool $is_async = false
): void;
): never;

/**
* Redirects to the given target URL.
*
* @param string $target_url
*/
public function redirectToURL(string $target_url): void;
public function redirectToURL(string $target_url): never;

/**
* Sets the current object (id and type) of ilCtrl's context.
Expand Down
Loading