]> git.mxchange.org Git - friendica.git/blob - tests/src/Network/HTTPClient/Client/HTTPClientTest.php
Fix test
[friendica.git] / tests / src / Network / HTTPClient / Client / HTTPClientTest.php
1 <?php
2
3 namespace Friendica\Test\src\Network\HTTPClient\Client;
4
5 use Friendica\DI;
6 use Friendica\Test\DiceHttpMockHandlerTrait;
7 use Friendica\Test\MockedTest;
8 use GuzzleHttp\Handler\MockHandler;
9 use GuzzleHttp\Psr7\Response;
10
11 class HTTPClientTest extends MockedTest
12 {
13         use DiceHttpMockHandlerTrait;
14
15         protected function setUp(): void
16         {
17                 parent::setUp();
18
19                 $this->setupHttpMockHandler();
20         }
21
22         /**
23          * Test for issue https://github.com/friendica/friendica/issues/10473#issuecomment-907749093
24          */
25         public function testInvalidURI()
26         {
27                 $this->httpRequestHandler->setHandler(new MockHandler([
28                         new Response(301, ['Location' => 'https:///']),
29                 ]));
30
31                 self::assertFalse(DI::httpClient()->get('https://friendica.local')->isSuccess());
32         }
33 }