diff options
Diffstat (limited to 'tests')
-rw-r--r-- | tests/lib/app.php | 10 | ||||
-rw-r--r-- | tests/lib/share20/managertest.php | 41 | ||||
-rw-r--r-- | tests/lib/util.php | 14 |
3 files changed, 22 insertions, 43 deletions
diff --git a/tests/lib/app.php b/tests/lib/app.php index 065296827dd..e7255ad955a 100644 --- a/tests/lib/app.php +++ b/tests/lib/app.php @@ -287,7 +287,7 @@ class Test_App extends \Test\TestCase { * Tests that the app order is correct */ public function testGetEnabledAppsIsSorted() { - $apps = \OC_App::getEnabledApps(true); + $apps = \OC_App::getEnabledApps(); // copy array $sortedApps = $apps; sort($sortedApps); @@ -413,7 +413,7 @@ class Test_App extends \Test\TestCase { ) ); - $apps = \OC_App::getEnabledApps(true, $forceAll); + $apps = \OC_App::getEnabledApps(false, $forceAll); $this->restoreAppConfig(); \OC_User::setUserId(null); @@ -448,11 +448,11 @@ class Test_App extends \Test\TestCase { ) ); - $apps = \OC_App::getEnabledApps(true); + $apps = \OC_App::getEnabledApps(); $this->assertEquals(array('files', 'app3', 'dav', 'federatedfilesharing',), $apps); // mock should not be called again here - $apps = \OC_App::getEnabledApps(false); + $apps = \OC_App::getEnabledApps(); $this->assertEquals(array('files', 'app3', 'dav', 'federatedfilesharing',), $apps); $this->restoreAppConfig(); @@ -501,7 +501,7 @@ class Test_App extends \Test\TestCase { }); // Remove the cache of the mocked apps list with a forceRefresh - \OC_App::getEnabledApps(true); + \OC_App::getEnabledApps(); } /** diff --git a/tests/lib/share20/managertest.php b/tests/lib/share20/managertest.php index bb91ed0d51e..fe94b72c4e6 100644 --- a/tests/lib/share20/managertest.php +++ b/tests/lib/share20/managertest.php @@ -1404,28 +1404,21 @@ class ManagerTest extends \Test\TestCase { ->setMethods(['sharingDisabledForUser']) ->getMock(); - $manager->method('sharingDisabledForUser')->willReturn($disabledForUser); + $manager->method('sharingDisabledForUser') + ->with('user') + ->willReturn($disabledForUser); - $user = $this->getMock('\OCP\IUser'); $share = $this->manager->newShare(); $share->setSharedBy('user'); - $res = $this->invokePrivate($manager, 'canShare', [$share]); - $this->assertEquals($expected, $res); - } - - /** - * @expectedException Exception - * @expectedExceptionMessage The Share API is disabled - */ - public function testCreateShareCantShare() { - $manager = $this->createManagerMock() - ->setMethods(['canShare']) - ->getMock(); + $exception = false; + try { + $res = $this->invokePrivate($manager, 'canShare', [$share]); + } catch (\Exception $e) { + $exception = true; + } - $manager->expects($this->once())->method('canShare')->willReturn(false); - $share = $this->manager->newShare(); - $manager->createShare($share); + $this->assertEquals($expected, !$exception); } public function testCreateShareUser() { @@ -1945,20 +1938,6 @@ class ManagerTest extends \Test\TestCase { /** * @expectedException Exception - * @expectedExceptionMessage The Share API is disabled - */ - public function testUpdateShareCantShare() { - $manager = $this->createManagerMock() - ->setMethods(['canShare']) - ->getMock(); - - $manager->expects($this->once())->method('canShare')->willReturn(false); - $share = $this->manager->newShare(); - $manager->updateShare($share); - } - - /** - * @expectedException Exception * @expectedExceptionMessage Can't change share type */ public function testUpdateShareCantChangeShareType() { diff --git a/tests/lib/util.php b/tests/lib/util.php index 7880d56f63b..4d788353881 100644 --- a/tests/lib/util.php +++ b/tests/lib/util.php @@ -214,13 +214,13 @@ class Test_Util extends \Test\TestCase { array('..', false), array('back\\slash', false), array('sl/ash', false), - array('lt<lt', false), - array('gt>gt', false), - array('col:on', false), - array('double"quote', false), - array('pi|pe', false), - array('dont?ask?questions?', false), - array('super*star', false), + array('lt<lt', true), + array('gt>gt', true), + array('col:on', true), + array('double"quote', true), + array('pi|pe', true), + array('dont?ask?questions?', true), + array('super*star', true), array('new\nline', false), // better disallow these to avoid unexpected trimming to have side effects array(' ..', false), |