diff options
Diffstat (limited to 'apps/files_sharing/tests/External/ManagerTest.php')
-rw-r--r-- | apps/files_sharing/tests/External/ManagerTest.php | 34 |
1 files changed, 28 insertions, 6 deletions
diff --git a/apps/files_sharing/tests/External/ManagerTest.php b/apps/files_sharing/tests/External/ManagerTest.php index 2224b767083..5e90b358ee9 100644 --- a/apps/files_sharing/tests/External/ManagerTest.php +++ b/apps/files_sharing/tests/External/ManagerTest.php @@ -35,6 +35,7 @@ use OCA\Files_Sharing\Tests\TestCase; use OCP\Federation\ICloudFederationFactory; use OCP\Federation\ICloudFederationProviderManager; use OCP\Http\Client\IClientService; +use OCP\Http\Client\IResponse; use OCP\IGroupManager; use OCP\IUserManager; use Test\Traits\UserTrait; @@ -172,8 +173,15 @@ class ManagerTest extends TestCase { $this->clientService->expects($this->at(0)) ->method('newClient') ->willReturn($client); - $response = $this->getMockBuilder('OCP\Http\Client\IResponse') - ->disableOriginalConstructor()->getMock(); + $response = $this->createMock(IResponse::class); + $response->method('getBody') + ->willReturn(json_encode([ + 'ocs' => [ + 'meta' => [ + 'statuscode' => 200, + ] + ] + ])); $client->expects($this->once()) ->method('post') ->with($this->stringStartsWith('http://localhost/ocs/v2.php/cloud/shares/' . $openShares[0]['remote_id']), $this->anything()) @@ -215,8 +223,15 @@ class ManagerTest extends TestCase { $this->clientService->expects($this->at(0)) ->method('newClient') ->willReturn($client); - $response = $this->getMockBuilder('OCP\Http\Client\IResponse') - ->disableOriginalConstructor()->getMock(); + $response = $this->createMock(IResponse::class); + $response->method('getBody') + ->willReturn(json_encode([ + 'ocs' => [ + 'meta' => [ + 'statuscode' => 200, + ] + ] + ])); $client->expects($this->once()) ->method('post') ->with($this->stringStartsWith('http://localhost/ocs/v2.php/cloud/shares/' . $openShares[1]['remote_id'] . '/decline'), $this->anything()) @@ -255,8 +270,15 @@ class ManagerTest extends TestCase { $this->clientService->expects($this->at(1)) ->method('newClient') ->willReturn($client2); - $response = $this->getMockBuilder('OCP\Http\Client\IResponse') - ->disableOriginalConstructor()->getMock(); + $response = $this->createMock(IResponse::class); + $response->method('getBody') + ->willReturn(json_encode([ + 'ocs' => [ + 'meta' => [ + 'statuscode' => 200, + ] + ] + ])); $client1->expects($this->once()) ->method('post') ->with($this->stringStartsWith('http://localhost/ocs/v2.php/cloud/shares/' . $openShares[0]['remote_id'] . '/decline'), $this->anything()) |