Restructure HTTPClient for new paradigm

This commit is contained in:
Philipp 2021-10-23 12:50:31 +02:00
parent fa55928ea3
commit 409d909d0f
No known key found for this signature in database
GPG key ID: 24A7501396EB5432
25 changed files with 210 additions and 198 deletions

View file

@ -0,0 +1,33 @@
<?php
namespace Friendica\Test\src\Network\HTTPClient\Client;
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:///']),
]));
self::assertFalse(DI::httpClient()->get('https://friendica.local')->isSuccess());
}
}