From: Philipp Date: Tue, 12 Jul 2022 17:49:39 +0000 (+0200) Subject: Add test case for https://github.com/friendica/friendica/issues/11726 X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=83a16ac114bb0f3f021742d1c5f1b90b27836030;p=friendica.git Add test case for https://github.com/friendica/friendica/issues/11726 --- diff --git a/tests/src/Network/HTTPClient/Client/HTTPClientTest.php b/tests/src/Network/HTTPClient/Client/HTTPClientTest.php index a6a873c83a..cbe2a84366 100644 --- a/tests/src/Network/HTTPClient/Client/HTTPClientTest.php +++ b/tests/src/Network/HTTPClient/Client/HTTPClientTest.php @@ -49,4 +49,19 @@ class HTTPClientTest extends MockedTest self::assertFalse(DI::httpClient()->get('https://friendica.local')->isSuccess()); } + + /** + * Test for issue https://github.com/friendica/friendica/issues/11726 + */ + public function testRedirect() + { + $this->httpRequestHandler->setHandler(new MockHandler([ + new Response(302, ['Location' => 'https://mastodon.social/about']), + new Response(200, ['Location' => 'https://mastodon.social']), + ])); + + $result = DI::httpClient()->get('https://mastodon.social'); + self::assertEquals('https://mastodon.social', $result->getUrl()); + self::assertEquals('https://mastodon.social/about', $result->getRedirectUrl()); + } }