]> git.mxchange.org Git - friendica.git/commitdiff
Add test for https://github.com/friendica/friendica/issues/10473#issuecomment-907749093
authorPhilipp <admin@philipp.info>
Sun, 29 Aug 2021 11:49:10 +0000 (13:49 +0200)
committerPhilipp <admin@philipp.info>
Sun, 29 Aug 2021 11:49:10 +0000 (13:49 +0200)
tests/src/Network/HTTPClientTest.php [new file with mode: 0644]

diff --git a/tests/src/Network/HTTPClientTest.php b/tests/src/Network/HTTPClientTest.php
new file mode 100644 (file)
index 0000000..89f2510
--- /dev/null
@@ -0,0 +1,36 @@
+<?php
+
+namespace Friendica\Test\src\Network;
+
+use Friendica\DI;
+use Friendica\Test\DiceHttpMockHandlerTrait;
+use Friendica\Test\MockedTest;
+use GuzzleHttp\Handler\MockHandler;
+use GuzzleHttp\Psr7\Response;
+
+class HTTPClientTest extends MockedTest
+{
+       use DiceHttpMockHandlerTrait;
+
+       protected function setUp(): void
+       {
+               parent::setUp();
+
+               $this->setupHttpMockHandler();
+       }
+
+       /**
+        * Test for issue https://github.com/friendica/friendica/issues/10473#issuecomment-907749093
+        */
+       public function testInvalidURI()
+       {
+               $this->httpRequestHandler->setHandler(new MockHandler([
+                       new Response(301, ['Location' => 'https:///']),
+               ]));
+
+               $httpClient = DI::httpClient();
+               $httpClient->get('https:///');
+
+               self::assertEquals(1,1);
+       }
+}