]> git.mxchange.org Git - friendica.git/commitdiff
Add test case for https://github.com/friendica/friendica/issues/11726
authorPhilipp <admin@philipp.info>
Tue, 12 Jul 2022 17:49:39 +0000 (19:49 +0200)
committerPhilipp <admin@philipp.info>
Tue, 12 Jul 2022 18:10:17 +0000 (20:10 +0200)
tests/src/Network/HTTPClient/Client/HTTPClientTest.php

index a6a873c83ad1e24c5eeac9762452b5bc469c7a4b..cbe2a843667964ea136df635896972e231ca9d05 100644 (file)
@@ -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());
+       }
 }