requestStack = self::getContainer()->get(RequestStack::class); $this->appRuntime = self::getContainer()->get(AppRuntime::class); } public function testTheReturnUrlIsPassedOnUntouched(): void { $encoded = rawurlencode('/administrative/assignment?page=3'); $this->requestStack->push(Request::create('/administrative/assignment/detail/abc?r='.$encoded)); // The raw query value, handed straight back to the url generator, which // re-encodes it. No decoding of its own, that stays the consumer's job. self::assertSame('/administrative/assignment?page=3', $this->appRuntime->getForwardedReturnUrl()); } /** * Null rather than an empty string, so the url generator drops the parameter * instead of emitting "r=". */ public function testNothingIsPassedOnWithoutAReturnUrl(): void { $this->requestStack->push(Request::create('/administrative/assignment/detail/abc')); self::assertNull($this->appRuntime->getForwardedReturnUrl()); } public function testNothingIsPassedOnForAnEmptyReturnUrl(): void { $this->requestStack->push(Request::create('/administrative/assignment/detail/abc?r=')); self::assertNull($this->appRuntime->getForwardedReturnUrl()); } }