diff options
author | Roeland Jago Douma <roeland@famdouma.nl> | 2019-11-22 13:23:56 +0100 |
---|---|---|
committer | Roeland Jago Douma <roeland@famdouma.nl> | 2019-11-27 13:34:42 +0100 |
commit | 8d4346d65688d2aabd6e144fe3f3609897a46230 (patch) | |
tree | 3f18b81fc97ce781ed16eb2eb2d9687d2daf3e32 /apps/files_sharing/tests/External/ManagerTest.php | |
parent | f2ef35dbf1401e15361c6535734fa77fbec636b7 (diff) | |
download | nextcloud-server-8d4346d65688d2aabd6e144fe3f3609897a46230.tar.gz nextcloud-server-8d4346d65688d2aabd6e144fe3f3609897a46230.zip |
Fix more tests
Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
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()) |