]> git.mxchange.org Git - friendica.git/blobdiff - tests/src/Core/InstallerTest.php
Merge pull request #11195 from annando/issue-10966
[friendica.git] / tests / src / Core / InstallerTest.php
index 8cd1a3fad91e8b117f38f61af02988fa26cca5c6..9256581b16ce8e8031a5a356a5b7aa68740c4a60 100644 (file)
@@ -1,6 +1,6 @@
 <?php
 /**
- * @copyright Copyright (C) 2010-2021, the Friendica project
+ * @copyright Copyright (C) 2010-2022, the Friendica project
  *
  * @license GNU AGPL version 3 or any later version
  *
 namespace Friendica\Core;
 
 use Dice\Dice;
-use Friendica\Core\Config\Cache;
+use DMS\PHPUnitExtensions\ArraySubset\ArraySubsetAsserts;
+use Friendica\Core\Config\ValueObject\Cache;
 use Friendica\DI;
-use Friendica\Network\CurlResult;
-use Friendica\Network\IHTTPRequest;
+use Friendica\Network\HTTPClient\Capability\ICanHandleHttpResponses;
+use Friendica\Network\HTTPClient\Capability\ICanSendHttpRequests;
 use Friendica\Test\MockedTest;
 use Friendica\Test\Util\VFSTrait;
 use Mockery;
@@ -35,6 +36,7 @@ use Mockery\MockInterface;
 class InstallerTest extends MockedTest
 {
        use VFSTrait;
+       use ArraySubsetAsserts;
 
        /**
         * @var L10n|MockInterface
@@ -319,30 +321,30 @@ class InstallerTest extends MockedTest
                $this->l10nMock->shouldReceive('t')->andReturnUsing(function ($args) { return $args; });
 
                // Mocking the CURL Response
-               $curlResult = Mockery::mock(CurlResult::class);
-               $curlResult
+               $IHTTPResult = Mockery::mock(ICanHandleHttpResponses::class);
+               $IHTTPResult
                        ->shouldReceive('getReturnCode')
                        ->andReturn('404');
-               $curlResult
+               $IHTTPResult
                        ->shouldReceive('getRedirectUrl')
                        ->andReturn('');
-               $curlResult
+               $IHTTPResult
                        ->shouldReceive('getError')
                        ->andReturn('test Error');
 
                // Mocking the CURL Request
-               $networkMock = Mockery::mock(IHTTPRequest::class);
+               $networkMock = Mockery::mock(ICanSendHttpRequests::class);
                $networkMock
                        ->shouldReceive('fetchFull')
                        ->with('https://test/install/testrewrite')
-                       ->andReturn($curlResult);
+                       ->andReturn($IHTTPResult);
                $networkMock
                        ->shouldReceive('fetchFull')
                        ->with('http://test/install/testrewrite')
-                       ->andReturn($curlResult);
+                       ->andReturn($IHTTPResult);
 
                $this->dice->shouldReceive('create')
-                    ->with(IHTTPRequest::class)
+                    ->with(ICanSendHttpRequests::class)
                     ->andReturn($networkMock);
 
                DI::init($this->dice);
@@ -366,30 +368,30 @@ class InstallerTest extends MockedTest
                $this->l10nMock->shouldReceive('t')->andReturnUsing(function ($args) { return $args; });
 
                // Mocking the failed CURL Response
-               $curlResultF = Mockery::mock(CurlResult::class);
-               $curlResultF
+               $IHTTPResultF = Mockery::mock(ICanHandleHttpResponses::class);
+               $IHTTPResultF
                        ->shouldReceive('getReturnCode')
                        ->andReturn('404');
 
                // Mocking the working CURL Response
-               $curlResultW = Mockery::mock(CurlResult::class);
-               $curlResultW
+               $IHTTPResultW = Mockery::mock(ICanHandleHttpResponses::class);
+               $IHTTPResultW
                        ->shouldReceive('getReturnCode')
                        ->andReturn('204');
 
                // Mocking the CURL Request
-               $networkMock = Mockery::mock(IHTTPRequest::class);
+               $networkMock = Mockery::mock(ICanSendHttpRequests::class);
                $networkMock
                        ->shouldReceive('fetchFull')
                        ->with('https://test/install/testrewrite')
-                       ->andReturn($curlResultF);
+                       ->andReturn($IHTTPResultF);
                $networkMock
                        ->shouldReceive('fetchFull')
                        ->with('http://test/install/testrewrite')
-                       ->andReturn($curlResultW);
+                       ->andReturn($IHTTPResultW);
 
                $this->dice->shouldReceive('create')
-                          ->with(IHTTPRequest::class)
+                          ->with(ICanSendHttpRequests::class)
                           ->andReturn($networkMock);
 
                DI::init($this->dice);