summaryrefslogtreecommitdiffstats
path: root/apps
diff options
context:
space:
mode:
authorRoeland Jago Douma <rullzer@users.noreply.github.com>2018-03-14 09:49:24 +0100
committerGitHub <noreply@github.com>2018-03-14 09:49:24 +0100
commit0e48afafed1c3f4048e5e78bd5bdd8ff1f9d3883 (patch)
treed303cbecd0aff49ee28cbf3246dca362334df83f /apps
parent7f00de841b3570f21c0be51dd9dced690f968210 (diff)
parentb93d26a20975c2568bc47d9470dac522dffa80c1 (diff)
downloadnextcloud-server-0e48afafed1c3f4048e5e78bd5bdd8ff1f9d3883.tar.gz
nextcloud-server-0e48afafed1c3f4048e5e78bd5bdd8ff1f9d3883.zip
Merge pull request #8804 from nextcloud/remove_httphelper
Remove deprecated HTTPHelper
Diffstat (limited to 'apps')
-rw-r--r--apps/federatedfilesharing/tests/Controller/RequestHandlerControllerTest.php32
-rw-r--r--apps/files_sharing/tests/Controller/ShareAPIControllerTest.php16
2 files changed, 15 insertions, 33 deletions
diff --git a/apps/federatedfilesharing/tests/Controller/RequestHandlerControllerTest.php b/apps/federatedfilesharing/tests/Controller/RequestHandlerControllerTest.php
index d04c75b9a86..035b7da15ca 100644
--- a/apps/federatedfilesharing/tests/Controller/RequestHandlerControllerTest.php
+++ b/apps/federatedfilesharing/tests/Controller/RequestHandlerControllerTest.php
@@ -85,13 +85,6 @@ class RequestHandlerControllerTest extends TestCase {
self::loginHelper(self::TEST_FILES_SHARING_API_USER1);
\OC\Share\Share::registerBackend('test', 'Test\Share\Backend');
- $config = $this->getMockBuilder(IConfig::class)
- ->disableOriginalConstructor()->getMock();
- $clientService = $this->getMockBuilder(IClientService::class)->getMock();
- $httpHelperMock = $this->getMockBuilder('\OC\HTTPHelper')
- ->setConstructorArgs([$config, $clientService])
- ->getMock();
- $httpHelperMock->expects($this->any())->method('post')->with($this->anything())->will($this->returnValue(true));
$this->share = $this->getMockBuilder(IShare::class)->getMock();
$this->federatedShareProvider = $this->getMockBuilder('OCA\FederatedFileSharing\FederatedShareProvider')
->disableOriginalConstructor()->getMock();
@@ -110,8 +103,6 @@ class RequestHandlerControllerTest extends TestCase {
$this->cloudIdManager = new CloudIdManager();
- $this->registerHttpHelper($httpHelperMock);
-
$this->s2s = new RequestHandlerController(
'federatedfilesharing',
\OC::$server->getRequest(),
@@ -134,33 +125,10 @@ class RequestHandlerControllerTest extends TestCase {
$query = \OCP\DB::prepare('DELETE FROM `*PREFIX*share`');
$query->execute();
- $this->restoreHttpHelper();
-
parent::tearDown();
}
/**
- * Register an http helper mock for testing purposes.
- * @param \OC\HTTPHelper $httpHelper helper mock
- */
- private function registerHttpHelper($httpHelper) {
- $this->oldHttpHelper = \OC::$server->query('HTTPHelper');
- \OC::$server->registerService('HTTPHelper', function ($c) use ($httpHelper) {
- return $httpHelper;
- });
- }
-
- /**
- * Restore the original http helper
- */
- private function restoreHttpHelper() {
- $oldHttpHelper = $this->oldHttpHelper;
- \OC::$server->registerService('HTTPHelper', function ($c) use ($oldHttpHelper) {
- return $oldHttpHelper;
- });
- }
-
- /**
* @medium
*/
function testCreateShare() {
diff --git a/apps/files_sharing/tests/Controller/ShareAPIControllerTest.php b/apps/files_sharing/tests/Controller/ShareAPIControllerTest.php
index a475474e3cf..4d944bfd58f 100644
--- a/apps/files_sharing/tests/Controller/ShareAPIControllerTest.php
+++ b/apps/files_sharing/tests/Controller/ShareAPIControllerTest.php
@@ -2068,7 +2068,7 @@ class ShareAPIControllerTest extends TestCase {
'file_parent' => 1,
'file_target' => 'myTarget',
'share_with' => 'user@server.com',
- 'share_with_displayname' => 'user@server.com',
+ 'share_with_displayname' => 'foobar',
'mail_send' => 0,
'mimetype' => 'myFolderMimeType',
], $share, [], false
@@ -2127,6 +2127,20 @@ class ShareAPIControllerTest extends TestCase {
->will($this->returnArgument(0));
}
+ $cm = $this->createMock(\OCP\Contacts\IManager::class);
+ $this->overwriteService(\OCP\Contacts\IManager::class, $cm);
+
+ $cm->method('search')
+ ->with('user@server.com', ['CLOUD'])
+ ->willReturn([
+ [
+ 'CLOUD' => [
+ 'user@server.com',
+ ],
+ 'FN' => 'foobar',
+ ],
+ ]);
+
try {
$result = $this->invokePrivate($this->ocs, 'formatShare', [$share]);
$this->assertFalse($exception);