diff options
| author | Elmar Ludwig <elmar.ludwig@uni-osnabrueck.de> | 2022-05-31 11:59:31 +0000 |
|---|---|---|
| committer | Elmar Ludwig <elmar.ludwig@uni-osnabrueck.de> | 2022-05-31 11:59:31 +0000 |
| commit | b7b4e67c1d9cfd8994ad0dff06d7a329361d9390 (patch) | |
| tree | 274f03c8a9b52bcce862b4045ca4376cedbe9669 /tests | |
| parent | 972e8b899c28a272ad74285b4f72cc90e1bb7fa8 (diff) | |
fix path handling in `action_url()`, fixes #1105
Closes #1105
Merge request studip/studip!661
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/unit/lib/classes/StudipControllerTest.php | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/tests/unit/lib/classes/StudipControllerTest.php b/tests/unit/lib/classes/StudipControllerTest.php index 3675f58..a7009fe 100644 --- a/tests/unit/lib/classes/StudipControllerTest.php +++ b/tests/unit/lib/classes/StudipControllerTest.php @@ -66,6 +66,19 @@ final class StudipControllerTest extends Codeception\Test\Unit } /** + * @dataProvider actionUrlProvider + * @covers StudipController::action_url + */ + public function testActionUrl(string $expected, ...$args): void + { + $url = $this->getController()->action_url(...$args); + $this->assertEquals( + $expected, + $this->getRelativeURL($url) + ); + } + + /** * @dataProvider RedirectProvider * @covers StudipController::redirect */ @@ -192,6 +205,19 @@ final class StudipControllerTest extends Codeception\Test\Unit ]; } + public function actionUrlProvider(): array + { + return [ + 'action' => ['dispatch.php/studip_controller_test/foo', 'foo'], + 'action-and-parameter' => ['dispatch.php/studip_controller_test/foo/23', 'foo/23'], + 'action-and-parameters' => ['dispatch.php/studip_controller_test/foo/23?bar=42', 'foo/23', ['bar' => 42]], + + 'fragment' => ['dispatch.php/studip_controller_test/foo/42/23#jump', 'foo/42/23#jump'], + 'fragment-and-parameters' => ['dispatch.php/studip_controller_test/foo/42/23#jump', 'foo#jump', 42, 23], + 'url-encoding-parameters' => ['dispatch.php/studip_controller_test/foo/%3Fabc/%2F', 'foo', '?abc', '/'], + ]; + } + public function RedirectProvider(): array { $result = $this->UrlForProvider(); |
