summaryrefslogtreecommitdiffstats
path: root/apps
diff options
context:
space:
mode:
authorRoeland Jago Douma <rullzer@users.noreply.github.com>2017-04-21 09:35:01 +0200
committerGitHub <noreply@github.com>2017-04-21 09:35:01 +0200
commite9b00f84b85e97283b83cf951f9bd262e627ae9a (patch)
treebcc89a56e67397461a1afd54e0836315fd06e08a /apps
parentc4bd01456b7fc8e531af1e8cc37dbff4f1ca8578 (diff)
parent73b6cd1061480078ec252c1e5e1d97ac48ea892a (diff)
downloadnextcloud-server-e9b00f84b85e97283b83cf951f9bd262e627ae9a.tar.gz
nextcloud-server-e9b00f84b85e97283b83cf951f9bd262e627ae9a.zip
Merge pull request #4406 from nextcloud/fix-unit-test-problems
Fix unit test problems
Diffstat (limited to 'apps')
-rw-r--r--apps/dav/tests/unit/CalDAV/CalendarTest.php8
-rw-r--r--apps/dav/tests/unit/CalDAV/PublicCalendarTest.php16
-rw-r--r--apps/files_sharing/tests/Controller/ShareAPIControllerTest.php7
-rw-r--r--apps/theming/lib/Controller/IconController.php8
-rw-r--r--apps/theming/tests/Controller/IconControllerTest.php12
5 files changed, 31 insertions, 20 deletions
diff --git a/apps/dav/tests/unit/CalDAV/CalendarTest.php b/apps/dav/tests/unit/CalDAV/CalendarTest.php
index b80d510356e..4ede886d31e 100644
--- a/apps/dav/tests/unit/CalDAV/CalendarTest.php
+++ b/apps/dav/tests/unit/CalDAV/CalendarTest.php
@@ -225,8 +225,8 @@ class CalendarTest extends TestCase {
/**
* @dataProvider providesConfidentialClassificationData
- * @param $expectedChildren
- * @param $isShared
+ * @param int $expectedChildren
+ * @param bool $isShared
*/
public function testPrivateClassification($expectedChildren, $isShared) {
@@ -268,8 +268,8 @@ class CalendarTest extends TestCase {
/**
* @dataProvider providesConfidentialClassificationData
- * @param $expectedChildren
- * @param $isShared
+ * @param int $expectedChildren
+ * @param bool $isShared
*/
public function testConfidentialClassification($expectedChildren, $isShared) {
$start = '20160609';
diff --git a/apps/dav/tests/unit/CalDAV/PublicCalendarTest.php b/apps/dav/tests/unit/CalDAV/PublicCalendarTest.php
index 85a6a4c5614..6b2bf58d392 100644
--- a/apps/dav/tests/unit/CalDAV/PublicCalendarTest.php
+++ b/apps/dav/tests/unit/CalDAV/PublicCalendarTest.php
@@ -28,7 +28,12 @@ use Sabre\VObject\Reader;
class PublicCalendarTest extends CalendarTest {
- public function testPrivateClassification() {
+ /**
+ * @dataProvider providesConfidentialClassificationData
+ * @param int $expectedChildren
+ * @param bool $isShared
+ */
+ public function testPrivateClassification($expectedChildren, $isShared) {
$calObject0 = ['uri' => 'event-0', 'classification' => CalDavBackend::CLASSIFICATION_PUBLIC];
$calObject1 = ['uri' => 'event-1', 'classification' => CalDavBackend::CLASSIFICATION_CONFIDENTIAL];
@@ -63,7 +68,12 @@ class PublicCalendarTest extends CalendarTest {
$this->assertFalse($c->childExists('event-2'));
}
- public function testConfidentialClassification() {
+ /**
+ * @dataProvider providesConfidentialClassificationData
+ * @param int $expectedChildren
+ * @param bool $isShared
+ */
+ public function testConfidentialClassification($expectedChildren, $isShared) {
$start = '20160609';
$end = '20160610';
@@ -150,4 +160,4 @@ EOD;
$this->assertArrayNotHasKey('DESCRIPTION', $event->VEVENT);
$this->assertArrayNotHasKey('ORGANIZER', $event->VEVENT);
}
-} \ No newline at end of file
+}
diff --git a/apps/files_sharing/tests/Controller/ShareAPIControllerTest.php b/apps/files_sharing/tests/Controller/ShareAPIControllerTest.php
index 6dfa8ec6c77..f5df9b62b19 100644
--- a/apps/files_sharing/tests/Controller/ShareAPIControllerTest.php
+++ b/apps/files_sharing/tests/Controller/ShareAPIControllerTest.php
@@ -39,6 +39,7 @@ use OCP\Lock\LockedException;
use OCP\Share\IManager;
use OCP\Share;
use Test\TestCase;
+use OCP\Share\IShare;
/**
* Class ShareAPIControllerTest
@@ -549,18 +550,18 @@ class ShareAPIControllerTest extends TestCase {
]));
$this->assertTrue($this->invokePrivate($this->ocs, 'canAccessShare', [$share]));
- $share = $this->getMockBuilder('OCP\Share\IShare')->getMock();
+ $share = $this->createMock(IShare::class);
$share->method('getShareType')->willReturn(\OCP\Share::SHARE_TYPE_GROUP);
$share->method('getSharedWith')->willReturn('group2');
$this->assertFalse($this->invokePrivate($this->ocs, 'canAccessShare', [$share]));
// null group
- $share = $this->getMock('OCP\Share\IShare');
+ $share = $this->createMock(IShare::class);
$share->method('getShareType')->willReturn(\OCP\Share::SHARE_TYPE_GROUP);
$share->method('getSharedWith')->willReturn('groupnull');
$this->assertFalse($this->invokePrivate($this->ocs, 'canAccessShare', [$share]));
- $share = $this->getMockBuilder('OCP\Share\IShare')->getMock();
+ $share = $this->createMock(IShare::class);
$share->method('getShareType')->willReturn(\OCP\Share::SHARE_TYPE_LINK);
$this->assertFalse($this->invokePrivate($this->ocs, 'canAccessShare', [$share]));
}
diff --git a/apps/theming/lib/Controller/IconController.php b/apps/theming/lib/Controller/IconController.php
index ddd1240fab8..7c4e209d0df 100644
--- a/apps/theming/lib/Controller/IconController.php
+++ b/apps/theming/lib/Controller/IconController.php
@@ -24,19 +24,19 @@ namespace OCA\Theming\Controller;
use OCA\Theming\IconBuilder;
use OCA\Theming\ImageManager;
+use OCA\Theming\ThemingDefaults;
use OCP\AppFramework\Controller;
use OCP\AppFramework\Http;
use OCP\AppFramework\Http\NotFoundResponse;
use OCP\AppFramework\Http\FileDisplayResponse;
use OCP\AppFramework\Utility\ITimeFactory;
-use OCP\Defaults;
use OCP\Files\NotFoundException;
use OCP\IRequest;
use OCA\Theming\Util;
use OCP\IConfig;
class IconController extends Controller {
- /** @var Defaults */
+ /** @var ThemingDefaults */
private $themingDefaults;
/** @var Util */
private $util;
@@ -54,7 +54,7 @@ class IconController extends Controller {
*
* @param string $appName
* @param IRequest $request
- * @param Defaults $themingDefaults
+ * @param ThemingDefaults $themingDefaults
* @param Util $util
* @param ITimeFactory $timeFactory
* @param IConfig $config
@@ -64,7 +64,7 @@ class IconController extends Controller {
public function __construct(
$appName,
IRequest $request,
- Defaults $themingDefaults,
+ ThemingDefaults $themingDefaults,
Util $util,
ITimeFactory $timeFactory,
IConfig $config,
diff --git a/apps/theming/tests/Controller/IconControllerTest.php b/apps/theming/tests/Controller/IconControllerTest.php
index ce053ff0eab..add11df3e6d 100644
--- a/apps/theming/tests/Controller/IconControllerTest.php
+++ b/apps/theming/tests/Controller/IconControllerTest.php
@@ -24,11 +24,11 @@ namespace OCA\Theming\Tests\Controller;
use OC\Files\SimpleFS\SimpleFile;
+use OCA\Theming\IconBuilder;
use OCA\Theming\ImageManager;
+use OCA\Theming\ThemingDefaults;
use OCP\AppFramework\Http;
use OCP\AppFramework\Http\NotFoundResponse;
-use OCP\Defaults;
-use OCP\Files\IRootFolder;
use OCP\Files\NotFoundException;
use OCP\IConfig;
use OCP\IRequest;
@@ -41,7 +41,7 @@ use OCP\AppFramework\Http\FileDisplayResponse;
class IconControllerTest extends TestCase {
/** @var IRequest|\PHPUnit_Framework_MockObject_MockObject */
private $request;
- /** @var Defaults|\PHPUnit_Framework_MockObject_MockObject */
+ /** @var ThemingDefaults|\PHPUnit_Framework_MockObject_MockObject */
private $themingDefaults;
/** @var Util */
private $util;
@@ -51,14 +51,14 @@ class IconControllerTest extends TestCase {
private $iconController;
/** @var IConfig|\PHPUnit_Framework_MockObject_MockObject */
private $config;
- /** @var IRootFolder|\PHPUnit_Framework_MockObject_MockObject */
+ /** @var IconBuilder|\PHPUnit_Framework_MockObject_MockObject */
private $iconBuilder;
/** @var ImageManager */
private $imageManager;
public function setUp() {
$this->request = $this->getMockBuilder('OCP\IRequest')->getMock();
- $this->themingDefaults = $this->getMockBuilder('OCP\Defaults')
+ $this->themingDefaults = $this->getMockBuilder('OCA\Theming\ThemingDefaults')
->disableOriginalConstructor()->getMock();
$this->util = $this->getMockBuilder('\OCA\Theming\Util')->disableOriginalConstructor()
->setMethods(['getAppImage', 'getAppIcon', 'elementColor'])->getMock();
@@ -109,7 +109,7 @@ class IconControllerTest extends TestCase {
$expires->add(new \DateInterval('PT24H'));
$expected->addHeader('Expires', $expires->format(\DateTime::RFC2822));
$expected->addHeader('Pragma', 'cache');
- @$this->assertEquals($expected, $this->iconController->getThemedIcon('core', 'filetypes/folder.svg'));
+ $this->assertEquals($expected, $this->iconController->getThemedIcon('core', 'filetypes/folder.svg'));
}
public function testGetFaviconDefault() {