mirror of
https://github.com/friendica/friendica
synced 2025-04-27 21:50:11 +00:00
Restructure HTTPClient for new paradigm
This commit is contained in:
parent
fa55928ea3
commit
409d909d0f
25 changed files with 210 additions and 198 deletions
|
@ -25,8 +25,8 @@ namespace Friendica\Core;
|
|||
use Dice\Dice;
|
||||
use Friendica\Core\Config\ValueObject\Cache;
|
||||
use Friendica\DI;
|
||||
use Friendica\Network\IHTTPResult;
|
||||
use Friendica\Network\IHTTPClient;
|
||||
use Friendica\Network\HTTPClient\Capability\ICanHandleHttpResponses;
|
||||
use Friendica\Network\HTTPClient\Capability\ICanRequestPerHttp;
|
||||
use Friendica\Test\MockedTest;
|
||||
use Friendica\Test\Util\VFSTrait;
|
||||
use Mockery;
|
||||
|
@ -319,7 +319,7 @@ class InstallerTest extends MockedTest
|
|||
$this->l10nMock->shouldReceive('t')->andReturnUsing(function ($args) { return $args; });
|
||||
|
||||
// Mocking the CURL Response
|
||||
$IHTTPResult = Mockery::mock(IHTTPResult::class);
|
||||
$IHTTPResult = Mockery::mock(ICanHandleHttpResponses::class);
|
||||
$IHTTPResult
|
||||
->shouldReceive('getReturnCode')
|
||||
->andReturn('404');
|
||||
|
@ -331,7 +331,7 @@ class InstallerTest extends MockedTest
|
|||
->andReturn('test Error');
|
||||
|
||||
// Mocking the CURL Request
|
||||
$networkMock = Mockery::mock(IHTTPClient::class);
|
||||
$networkMock = Mockery::mock(ICanRequestPerHttp::class);
|
||||
$networkMock
|
||||
->shouldReceive('fetchFull')
|
||||
->with('https://test/install/testrewrite')
|
||||
|
@ -342,7 +342,7 @@ class InstallerTest extends MockedTest
|
|||
->andReturn($IHTTPResult);
|
||||
|
||||
$this->dice->shouldReceive('create')
|
||||
->with(IHTTPClient::class)
|
||||
->with(ICanRequestPerHttp::class)
|
||||
->andReturn($networkMock);
|
||||
|
||||
DI::init($this->dice);
|
||||
|
@ -366,19 +366,19 @@ class InstallerTest extends MockedTest
|
|||
$this->l10nMock->shouldReceive('t')->andReturnUsing(function ($args) { return $args; });
|
||||
|
||||
// Mocking the failed CURL Response
|
||||
$IHTTPResultF = Mockery::mock(IHTTPResult::class);
|
||||
$IHTTPResultF = Mockery::mock(ICanHandleHttpResponses::class);
|
||||
$IHTTPResultF
|
||||
->shouldReceive('getReturnCode')
|
||||
->andReturn('404');
|
||||
|
||||
// Mocking the working CURL Response
|
||||
$IHTTPResultW = Mockery::mock(IHTTPResult::class);
|
||||
$IHTTPResultW = Mockery::mock(ICanHandleHttpResponses::class);
|
||||
$IHTTPResultW
|
||||
->shouldReceive('getReturnCode')
|
||||
->andReturn('204');
|
||||
|
||||
// Mocking the CURL Request
|
||||
$networkMock = Mockery::mock(IHTTPClient::class);
|
||||
$networkMock = Mockery::mock(ICanRequestPerHttp::class);
|
||||
$networkMock
|
||||
->shouldReceive('fetchFull')
|
||||
->with('https://test/install/testrewrite')
|
||||
|
@ -389,7 +389,7 @@ class InstallerTest extends MockedTest
|
|||
->andReturn($IHTTPResultW);
|
||||
|
||||
$this->dice->shouldReceive('create')
|
||||
->with(IHTTPClient::class)
|
||||
->with(ICanRequestPerHttp::class)
|
||||
->andReturn($networkMock);
|
||||
|
||||
DI::init($this->dice);
|
||||
|
|
|
@ -40,7 +40,7 @@ use Friendica\DI;
|
|||
use Friendica\Core\Config\Factory\Config;
|
||||
use Friendica\Core\Config\Repository;
|
||||
use Friendica\Core\Storage\Type;
|
||||
use Friendica\Network\HTTPClient;
|
||||
use Friendica\Network\HTTPClient\Client\HttpClientCan;
|
||||
use Friendica\Test\DatabaseTest;
|
||||
use Friendica\Test\Util\Database\StaticDatabase;
|
||||
use Friendica\Test\Util\VFSTrait;
|
||||
|
@ -61,7 +61,7 @@ class StorageManagerTest extends DatabaseTest
|
|||
private $logger;
|
||||
/** @var L10n */
|
||||
private $l10n;
|
||||
/** @var HTTPClient */
|
||||
/** @var HttpClientCan */
|
||||
private $httpRequest;
|
||||
|
||||
protected function setUp(): void
|
||||
|
@ -93,7 +93,7 @@ class StorageManagerTest extends DatabaseTest
|
|||
|
||||
$this->l10n = \Mockery::mock(L10n::class);
|
||||
|
||||
$this->httpRequest = \Mockery::mock(HTTPClient::class);
|
||||
$this->httpRequest = \Mockery::mock(HttpClientCan::class);
|
||||
}
|
||||
|
||||
protected function tearDown(): void
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue