summaryrefslogtreecommitdiffstats
path: root/tests/lib/Share
diff options
context:
space:
mode:
authorJoas Schilling <coding@schilljs.com>2016-10-20 15:11:01 +0200
committerJoas Schilling <coding@schilljs.com>2016-10-20 15:19:41 +0200
commit122edcd0c1b652f25c36c52cc7541eb62695bf37 (patch)
treeb9fa6b1f1a4229aa63ea33bda790747a1933eb02 /tests/lib/Share
parentb946e3ecfb2478f7aaca82c11367a2be8455a2d0 (diff)
downloadnextcloud-server-122edcd0c1b652f25c36c52cc7541eb62695bf37.tar.gz
nextcloud-server-122edcd0c1b652f25c36c52cc7541eb62695bf37.zip
Make sure all tests use the TestCase method to overwrite services
Signed-off-by: Joas Schilling <coding@schilljs.com>
Diffstat (limited to 'tests/lib/Share')
-rw-r--r--tests/lib/Share/ShareTest.php20
1 files changed, 6 insertions, 14 deletions
diff --git a/tests/lib/Share/ShareTest.php b/tests/lib/Share/ShareTest.php
index 42adee21d0c..63289529843 100644
--- a/tests/lib/Share/ShareTest.php
+++ b/tests/lib/Share/ShareTest.php
@@ -119,12 +119,6 @@ class ShareTest extends \Test\TestCase {
parent::tearDown();
}
- protected function setHttpHelper($httpHelper) {
- \OC::$server->registerService('HTTPHelper', function () use ($httpHelper) {
- return $httpHelper;
- });
- }
-
public function testShareInvalidShareType() {
$message = 'Share type foobar is not valid for test.txt';
try {
@@ -1046,11 +1040,10 @@ class ShareTest extends \Test\TestCase {
* @param string $urlHost
*/
public function testRemoteShareUrlCalls($shareWith, $urlHost) {
- $oldHttpHelper = \OC::$server->query('HTTPHelper');
- $httpHelperMock = $this->getMockBuilder('OC\HttpHelper')
+ $httpHelperMock = $this->getMockBuilder('OC\HTTPHelper')
->disableOriginalConstructor()
->getMock();
- $this->setHttpHelper($httpHelperMock);
+ $this->overwriteService('HTTPHelper', $httpHelperMock);
$httpHelperMock->expects($this->at(0))
->method('post')
@@ -1075,7 +1068,7 @@ class ShareTest extends \Test\TestCase {
->willReturn(['success' => true, 'result' => json_encode(['ocs' => ['meta' => ['statuscode' => 100]]])]);
\OCP\Share::unshare('test', 'test.txt', \OCP\Share::SHARE_TYPE_REMOTE, $shareWith);
- $this->setHttpHelper($oldHttpHelper);
+ $this->restoreService('HTTPHelper');
}
/**
@@ -1473,11 +1466,10 @@ class ShareTest extends \Test\TestCase {
* Make sure that a user cannot have multiple identical shares to remote users
*/
public function testOnlyOneRemoteShare() {
- $oldHttpHelper = \OC::$server->query('HTTPHelper');
- $httpHelperMock = $this->getMockBuilder('OC\HttpHelper')
+ $httpHelperMock = $this->getMockBuilder('OC\HTTPHelper')
->disableOriginalConstructor()
->getMock();
- $this->setHttpHelper($httpHelperMock);
+ $this->overwriteService('HTTPHelper', $httpHelperMock);
$httpHelperMock->expects($this->at(0))
->method('post')
@@ -1502,7 +1494,7 @@ class ShareTest extends \Test\TestCase {
->willReturn(['success' => true, 'result' => json_encode(['ocs' => ['meta' => ['statuscode' => 100]]])]);
\OCP\Share::unshare('test', 'test.txt', \OCP\Share::SHARE_TYPE_REMOTE, 'foo@localhost');
- $this->setHttpHelper($oldHttpHelper);
+ $this->restoreService('HTTPHelper');
}
/**