Merge pull request #18064 from nextcloud/feature/php74

Add php7.4 support
This commit is contained in:
Roeland Jago Douma 2019-11-28 08:36:10 +01:00 committed by GitHub
commit 669302e570
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
714 changed files with 3078 additions and 3012 deletions

View File

@ -52,7 +52,7 @@ steps:
commands:
- git submodule update --init
- name: checkers
image: nextcloudci/php7.2:php7.2-12
image: nextcloudci/php7.2:php7.2-13
commands:
- ./autotest-checkers.sh
secrets: [ github_token ]
@ -94,22 +94,27 @@ steps:
commands:
- git submodule update --init
- name: syntax-php7.2
image: nextcloudci/php7.2:php7.2-12
image: nextcloudci/php7.2:php7.2-13
commands:
- composer install
- ./lib/composer/bin/parallel-lint --exclude lib/composer/jakub-onderka/ --exclude 3rdparty/symfony/polyfill-php70/Resources/stubs/ --exclude 3rdparty/patchwork/utf8/src/Patchwork/Utf8/Bootup/ --exclude lib/composer/composer/autoload_static.php --exclude 3rdparty/composer/autoload_static.php --exclude 3rdparty/doctrine/cache/lib/Doctrine/Common/Cache/RiakCache.php .
- name: syntax-php7.3
image: nextcloudci/php7.3:php7.3-1
image: nextcloudci/php7.3:php7.3-4
commands:
- composer install
- ./lib/composer/bin/parallel-lint --exclude lib/composer/jakub-onderka/ --exclude 3rdparty/symfony/polyfill-php70/Resources/stubs/ --exclude 3rdparty/patchwork/utf8/src/Patchwork/Utf8/Bootup/ --exclude 3rdparty/paragonie/random_compat/lib/ --exclude lib/composer/composer/autoload_static.php --exclude 3rdparty/composer/autoload_static.php --exclude 3rdparty/doctrine/cache/lib/Doctrine/Common/Cache/RiakCache.php .
- name: phan
image: nextcloudci/php7.2:php7.2-12
- name: syntax-php7.4
image: nextcloudci/php7.4:2
commands:
- composer install
- composer require --dev "phan/phan:0.11.1"
- ./lib/composer/phan/phan/phan -k build/.phan/config.php
- php ./build/.phan/plugin-checker.php
- ./lib/composer/bin/parallel-lint --exclude lib/composer/jakub-onderka/ --exclude 3rdparty/symfony/polyfill-php70/Resources/stubs/ --exclude 3rdparty/patchwork/utf8/src/Patchwork/Utf8/Bootup/ --exclude 3rdparty/paragonie/random_compat/lib/ --exclude lib/composer/composer/autoload_static.php --exclude 3rdparty/composer/autoload_static.php --exclude 3rdparty/doctrine/cache/lib/Doctrine/Common/Cache/RiakCache.php .
#- name: phan
# image: nextcloudci/php7.2:php7.2-13
# commands:
# - composer install
# - composer require --dev "phan/phan:0.11.1"
# - ./lib/composer/phan/phan/phan -k build/.phan/config.php
# - php ./build/.phan/plugin-checker.php
trigger:
branch:
@ -323,11 +328,15 @@ steps:
commands:
- git submodule update --init
- name: nodb-php7.2
image: nextcloudci/php7.2:php7.2-11
image: nextcloudci/php7.2:php7.2-13
commands:
- NOCOVERAGE=true TEST_SELECTION=NODB ./autotest.sh sqlite
- name: nodb-php7.3
image: nextcloudci/php7.3:php7.3-1
image: nextcloudci/php7.3:php7.3-4
commands:
- NOCOVERAGE=true TEST_SELECTION=NODB ./autotest.sh sqlite
- name: nodb-php7.4
image: nextcloudci/php7.4:2
commands:
- NOCOVERAGE=true TEST_SELECTION=NODB ./autotest.sh sqlite
@ -353,11 +362,15 @@ steps:
commands:
- git submodule update --init
- name: sqlite-php7.2
image: nextcloudci/php7.2:php7.2-12
image: nextcloudci/php7.2:php7.2-13
commands:
- NOCOVERAGE=true TEST_SELECTION=DB ./autotest.sh sqlite
- name: sqlite-php7.3
image: nextcloudci/php7.3:php7.3-1
image: nextcloudci/php7.3:php7.3-4
commands:
- NOCOVERAGE=true TEST_SELECTION=DB ./autotest.sh sqlite
- name: sqlite-php7.4
image: nextcloudci/php7.4:2
commands:
- NOCOVERAGE=true TEST_SELECTION=DB ./autotest.sh sqlite
@ -383,7 +396,7 @@ steps:
commands:
- git submodule update --init
- name: mariadb10.1-php7.2
image: nextcloudci/php7.2:php7.2-12
image: nextcloudci/php7.2:php7.2-13
commands:
- NOCOVERAGE=true TEST_SELECTION=DB ./autotest.sh mariadb
@ -418,7 +431,7 @@ steps:
commands:
- git submodule update --init
- name: mariadb10.2-php7.2
image: nextcloudci/php7.2:php7.2-12
image: nextcloudci/php7.2:php7.2-13
commands:
- NOCOVERAGE=true TEST_SELECTION=DB ./autotest.sh mariadb
@ -452,7 +465,7 @@ steps:
commands:
- git submodule update --init
- name: mariadb10.3-php7.2
image: nextcloudci/php7.2:php7.2-12
image: nextcloudci/php7.2:php7.2-13
commands:
- NOCOVERAGE=true TEST_SELECTION=DB ./autotest.sh mariadb
@ -486,7 +499,7 @@ steps:
commands:
- git submodule update --init
- name: mariadb10.4-php7.3
image: nextcloudci/php7.3:php7.3-1
image: nextcloudci/php7.3:php7.3-4
commands:
- NOCOVERAGE=true TEST_SELECTION=DB ./autotest.sh mariadb
@ -521,7 +534,7 @@ steps:
commands:
- git submodule update --init
- name: mysql-php7.2
image: nextcloudci/php7.2:php7.2-12
image: nextcloudci/php7.2:php7.2-13
commands:
- NOCOVERAGE=true TEST_SELECTION=DB ./autotest.sh mysql
@ -557,7 +570,7 @@ steps:
commands:
- git submodule update --init
- name: mysql-php7.2
image: nextcloudci/php7.2:php7.2-12
image: nextcloudci/php7.2:php7.2-13
commands:
- NOCOVERAGE=true TEST_SELECTION=DB ./autotest.sh mysql
@ -589,7 +602,7 @@ steps:
commands:
- git submodule update --init
- name: mysql-php7.3
image: nextcloudci/php7.3:php7.3-1
image: nextcloudci/php7.3:php7.3-4
commands:
- NOCOVERAGE=true TEST_SELECTION=DB ./autotest.sh mysql
@ -621,7 +634,7 @@ steps:
commands:
- git submodule update --init
- name: mysql5.6-php7.2
image: nextcloudci/php7.2:php7.2-12
image: nextcloudci/php7.2:php7.2-13
commands:
- NOCOVERAGE=true TEST_SELECTION=DB ./autotest.sh mysql
@ -655,7 +668,7 @@ steps:
commands:
- git submodule update --init
- name: postgres-php7.3
image: nextcloudci/php7.3:php7.3-1
image: nextcloudci/php7.3:php7.3-4
commands:
- sleep 10 # gives the database enough time to initialize
- POSTGRES=9 NOCOVERAGE=true TEST_SELECTION=DB ./autotest.sh pgsql
@ -690,7 +703,7 @@ steps:
commands:
- git submodule update --init
- name: postgres-php7.2
image: nextcloudci/php7.2:php7.2-12
image: nextcloudci/php7.2:php7.2-13
commands:
- sleep 10 # gives the database enough time to initialize
- POSTGRES=10 NOCOVERAGE=true TEST_SELECTION=DB ./autotest.sh pgsql
@ -724,7 +737,7 @@ steps:
commands:
- git submodule update --init
- name: postgres-php7.2
image: nextcloudci/php7.2:php7.2-12
image: nextcloudci/php7.2:php7.2-13
commands:
- sleep 10 # gives the database enough time to initialize
- POSTGRES=11 NOCOVERAGE=true TEST_SELECTION=DB ./autotest.sh pgsql
@ -759,7 +772,7 @@ steps:
commands:
- git submodule update --init
- name: mysqlmb4-php7.2
image: nextcloudci/php7.2:php7.2-12
image: nextcloudci/php7.2:php7.2-13
commands:
- NOCOVERAGE=true TEST_SELECTION=DB ./autotest.sh mysqlmb4
@ -794,7 +807,7 @@ steps:
commands:
- git submodule update --init
- name: mysqlmb4-php7.3
image: nextcloudci/php7.3:php7.3-1
image: nextcloudci/php7.3:php7.3-4
commands:
- NOCOVERAGE=true TEST_SELECTION=DB ./autotest.sh mysqlmb4
@ -2041,7 +2054,7 @@ steps:
commands:
- git submodule update --init
- name: nodb-codecov
image: nextcloudci/php7.2:php7.2-12
image: nextcloudci/php7.2:php7.2-13
commands:
- phpenmod xdebug
- TEST_SELECTION=NODB ./autotest.sh sqlite
@ -2070,7 +2083,7 @@ steps:
commands:
- git submodule update --init
- name: db-codecov
image: nextcloudci/php7.2:php7.2-12
image: nextcloudci/php7.2:php7.2-13
commands:
- phpenmod xdebug
- TEST_SELECTION=QUICKDB ./autotest.sh sqlite
@ -2099,7 +2112,7 @@ steps:
commands:
- git submodule update --init
- name: object-store
image: nextcloudci/php7.2:php7.2-12
image: nextcloudci/php7.2:php7.2-13
commands:
- phpenmod xdebug
- ./tests/drone-wait-objectstore.sh
@ -2130,7 +2143,7 @@ steps:
commands:
- git submodule update --init
- name: object-store
image: nextcloudci/php7.2:php7.2-12
image: nextcloudci/php7.2:php7.2-13
commands:
- phpenmod xdebug
- ./tests/drone-wait-objectstore.sh
@ -2235,7 +2248,7 @@ steps:
commands:
- git submodule update --init
- name: memcache-memcached
image: nextcloudci/php7.3-memcached:php7.3-memcached-2
image: nextcloudci/php7.3-memcached:php7.3-memcached-3
commands:
- phpenmod xdebug
- service memcached restart
@ -2262,7 +2275,7 @@ trigger:
# commands:
# - git submodule update --init
#- name: memcache-redis-cluster
# image: nextcloudci/php7.2:php7.2-12
# image: nextcloudci/php7.2:php7.2-13
# commands:
# - phpenmod xdebug
# - sleep 20

View File

@ -39,7 +39,7 @@ class SecurityTest extends TestCase {
/** @var IUser|\PHPUnit_Framework_MockObject_MockObject */
private $user;
public function setUp() {
protected function setUp(): void {
parent::setUp();
$this->logger = $this->createMock(ILogger::class);

View File

@ -63,7 +63,7 @@ class ListenerTest extends TestCase {
/** @var IShareHelper|\PHPUnit_Framework_MockObject_MockObject */
protected $shareHelper;
protected function setUp() {
protected function setUp(): void {
parent::setUp();
$this->activityManager = $this->createMock(IManager::class);

View File

@ -35,13 +35,13 @@ use Test\TestCase;
* @package OCA\Comments\Tests\Unit\AppInfo
*/
class ApplicationTest extends TestCase {
protected function setUp() {
protected function setUp(): void {
parent::setUp();
\OC::$server->getUserManager()->createUser('dummy', '456');
\OC::$server->getUserSession()->setUser(\OC::$server->getUserManager()->get('dummy'));
}
protected function tearDown() {
protected function tearDown(): void {
\OC::$server->getUserManager()->get('dummy')->delete();
parent::tearDown();
}

View File

@ -36,7 +36,7 @@ class CommentersSorterTest extends TestCase {
/** @var CommentersSorter */
protected $sorter;
public function setUp() {
protected function setUp(): void {
parent::setUp();
$this->commentsManager = $this->createMock(ICommentsManager::class);

View File

@ -59,7 +59,7 @@ class NotificationsTest extends TestCase {
/** @var IURLGenerator|\PHPUnit_Framework_MockObject_MockObject */
protected $urlGenerator;
protected function setUp() {
protected function setUp(): void {
parent::setUp();
$this->commentsManager = $this->createMock(ICommentsManager::class);

View File

@ -40,7 +40,7 @@ class EventHandlerTest extends TestCase {
/** @var NotificationListener|\PHPUnit_Framework_MockObject_MockObject */
protected $notificationListener;
protected function setUp() {
protected function setUp(): void {
parent::setUp();
$this->activityListener = $this->getMockBuilder(ActivityListener::class)

View File

@ -34,7 +34,7 @@ class JSSettingsHelperTest extends TestCase {
/** @var JSSettingsHelper */
protected $helper;
public function setUp() {
protected function setUp(): void {
parent::setUp();
$this->c = $this->createMock(IServerContainer::class);

View File

@ -46,7 +46,7 @@ class ListenerTest extends TestCase {
/** @var Listener */
protected $listener;
protected function setUp() {
protected function setUp(): void {
parent::setUp();
$this->notificationManager = $this->createMock(\OCP\Notification\IManager::class);

View File

@ -62,7 +62,7 @@ class NotifierTest extends TestCase {
/** @var string */
protected $lc = 'tlh_KX';
protected function setUp() {
protected function setUp(): void {
parent::setUp();
$this->l10nFactory = $this->createMock(IFactory::class);
@ -339,10 +339,10 @@ class NotifierTest extends TestCase {
$this->notifier->prepare($this->notification, $this->lc);
}
/**
* @expectedException \InvalidArgumentException
*/
public function testPrepareDifferentApp() {
$this->expectException(\InvalidArgumentException::class);
$this->folder
->expects($this->never())
->method('getById');
@ -376,10 +376,10 @@ class NotifierTest extends TestCase {
$this->notifier->prepare($this->notification, $this->lc);
}
/**
* @expectedException \InvalidArgumentException
*/
public function testPrepareNotFound() {
$this->expectException(\InvalidArgumentException::class);
$this->folder
->expects($this->never())
->method('getById');
@ -414,10 +414,10 @@ class NotifierTest extends TestCase {
$this->notifier->prepare($this->notification, $this->lc);
}
/**
* @expectedException \InvalidArgumentException
*/
public function testPrepareDifferentSubject() {
$this->expectException(\InvalidArgumentException::class);
$displayName = 'Huraga';
/** @var IUser|\PHPUnit_Framework_MockObject_MockObject $user */
@ -477,10 +477,10 @@ class NotifierTest extends TestCase {
$this->notifier->prepare($this->notification, $this->lc);
}
/**
* @expectedException \InvalidArgumentException
*/
public function testPrepareNotFiles() {
$this->expectException(\InvalidArgumentException::class);
$displayName = 'Huraga';
/** @var IUser|\PHPUnit_Framework_MockObject_MockObject $user */
@ -541,10 +541,10 @@ class NotifierTest extends TestCase {
$this->notifier->prepare($this->notification, $this->lc);
}
/**
* @expectedException \OCP\Notification\AlreadyProcessedException
*/
public function testPrepareUnresolvableFileID() {
$this->expectException(\OCP\Notification\AlreadyProcessedException::class);
$displayName = 'Huraga';
/** @var IUser|\PHPUnit_Framework_MockObject_MockObject $user */

View File

@ -108,9 +108,7 @@ class CachedSubscription extends \Sabre\CalDAV\Calendar {
return parent::getOwner();
}
/**
*
*/
public function delete() {
$this->caldavBackend->deleteSubscription($this->calendarInfo['id']);
}

View File

@ -154,9 +154,7 @@ class CalendarHome extends \Sabre\CalDAV\CalendarHome {
return $this->caldavBackend->calendarSearch($principalUri, $filters, $limit, $offset);
}
/**
*
*/
public function enableCachedSubscriptionsForThisRequest() {
$this->returnCachedSubscriptions = true;
}

View File

@ -40,17 +40,18 @@ class AvatarHomeTest extends TestCase {
/** @var IAvatarManager | \PHPUnit_Framework_MockObject_MockObject */
private $avatarManager;
public function setUp() {
protected function setUp(): void {
parent::setUp();
$this->avatarManager = $this->createMock(IAvatarManager::class);
$this->home = new AvatarHome(['uri' => 'principals/users/admin'], $this->avatarManager);
}
/**
* @expectedException \Sabre\DAV\Exception\Forbidden
* @dataProvider providesForbiddenMethods
*/
public function testForbiddenMethods($method) {
$this->expectException(\Sabre\DAV\Exception\Forbidden::class);
$this->home->$method('');
}

View File

@ -41,7 +41,7 @@ class CleanupInvitationTokenJobTest extends TestCase {
/** @var \OCA\DAV\BackgroundJob\GenerateBirthdayCalendarBackgroundJob */
private $backgroundJob;
protected function setUp() {
protected function setUp(): void {
parent::setUp();
$this->dbConnection = $this->createMock(IDBConnection::class);

View File

@ -40,7 +40,7 @@ class EventReminderJobTest extends TestCase {
/** @var EventReminderJob|\PHPUnit\Framework\MockObject\MockObject */
private $backgroundJob;
protected function setUp() {
protected function setUp(): void {
parent::setUp();
$this->reminderService = $this->createMock(ReminderService::class);

View File

@ -38,7 +38,7 @@ class GenerateBirthdayCalendarBackgroundJobTest extends TestCase {
/** @var \OCA\DAV\BackgroundJob\GenerateBirthdayCalendarBackgroundJob */
private $backgroundJob;
protected function setUp() {
protected function setUp(): void {
parent::setUp();
$this->birthdayService = $this->createMock(BirthdayService::class);

View File

@ -56,7 +56,7 @@ class RefreshWebcalJobTest extends TestCase {
/** @var IJobList | \PHPUnit_Framework_MockObject_MockObject */
private $jobList;
protected function setUp() {
protected function setUp(): void {
parent::setUp();
$this->caldavBackend = $this->createMock(CalDavBackend::class);

View File

@ -49,7 +49,7 @@ class RegisterRegenerateBirthdayCalendarsTest extends TestCase {
/** @var RegisterRegenerateBirthdayCalendars */
private $backgroundJob;
protected function setUp() {
protected function setUp(): void {
parent::setUp();
$this->time = $this->createMock(ITimeFactory::class);

View File

@ -47,7 +47,7 @@ class UpdateCalendarResourcesRoomsBackgroundJobTest extends TestCase {
/** @var CalDavBackend | \PHPUnit_Framework_MockObject_MockObject */
private $calDavBackend;
protected function setUp() {
protected function setUp(): void {
parent::setUp();
$this->resourceManager = $this->createMock(IResourceManager::class);
@ -59,7 +59,7 @@ class UpdateCalendarResourcesRoomsBackgroundJobTest extends TestCase {
$this->calDavBackend);
}
protected function tearDown() {
protected function tearDown(): void {
$query = self::$realDatabase->getQueryBuilder();
$query->delete('calendar_resources')->execute();
$query->delete('calendar_resources_md')->execute();

View File

@ -72,7 +72,7 @@ abstract class AbstractCalDavBackend extends TestCase {
const UNIT_TEST_GROUP = 'principals/groups/caldav-unit-test-group';
const UNIT_TEST_GROUP2 = 'principals/groups/caldav-unit-test-group2';
public function setUp() {
protected function setUp(): void {
parent::setUp();
$this->userManager = $this->createMock(IUserManager::class);
@ -106,7 +106,7 @@ abstract class AbstractCalDavBackend extends TestCase {
$this->cleanUpBackend();
}
public function tearDown() {
protected function tearDown(): void {
$this->cleanUpBackend();
parent::tearDown();
}

View File

@ -44,7 +44,7 @@ class BackendTest extends TestCase {
/** @var IUserSession|\PHPUnit_Framework_MockObject_MockObject */
protected $userSession;
protected function setUp() {
protected function setUp(): void {
parent::setUp();
$this->activityManager = $this->createMock(IManager::class);
$this->groupManager = $this->createMock(IGroupManager::class);

View File

@ -37,7 +37,7 @@ class CalendarTest extends TestCase {
/** @var IFilter|\PHPUnit_Framework_MockObject_MockObject */
protected $filter;
protected function setUp() {
protected function setUp(): void {
parent::setUp();
$this->url = $this->createMock(IURLGenerator::class);
$l = $this->createMock(IL10N::class);

View File

@ -56,7 +56,7 @@ class GenericTest extends TestCase {
public function testGetIdentifier($filterClass) {
/** @var IFilter $filter */
$filter = \OC::$server->query($filterClass);
$this->assertInternalType('string', $filter->getIdentifier());
$this->assertIsString($filter->getIdentifier());
}
/**
@ -66,7 +66,7 @@ class GenericTest extends TestCase {
public function testGetName($filterClass) {
/** @var IFilter $filter */
$filter = \OC::$server->query($filterClass);
$this->assertInternalType('string', $filter->getName());
$this->assertIsString($filter->getName());
}
/**
@ -77,7 +77,7 @@ class GenericTest extends TestCase {
/** @var IFilter $filter */
$filter = \OC::$server->query($filterClass);
$priority = $filter->getPriority();
$this->assertInternalType('int', $filter->getPriority());
$this->assertIsInt($filter->getPriority());
$this->assertGreaterThanOrEqual(0, $priority);
$this->assertLessThanOrEqual(100, $priority);
}
@ -89,7 +89,7 @@ class GenericTest extends TestCase {
public function testGetIcon($filterClass) {
/** @var IFilter $filter */
$filter = \OC::$server->query($filterClass);
$this->assertInternalType('string', $filter->getIcon());
$this->assertIsString($filter->getIcon());
$this->assertStringStartsWith('http', $filter->getIcon());
}
@ -100,7 +100,7 @@ class GenericTest extends TestCase {
public function testFilterTypes($filterClass) {
/** @var IFilter $filter */
$filter = \OC::$server->query($filterClass);
$this->assertInternalType('array', $filter->filterTypes([]));
$this->assertIsArray($filter->filterTypes([]));
}
/**
@ -110,6 +110,6 @@ class GenericTest extends TestCase {
public function testAllowedApps($filterClass) {
/** @var IFilter $filter */
$filter = \OC::$server->query($filterClass);
$this->assertInternalType('array', $filter->allowedApps());
$this->assertIsArray($filter->allowedApps());
}
}

View File

@ -37,7 +37,7 @@ class TodoTest extends TestCase {
/** @var IFilter|\PHPUnit_Framework_MockObject_MockObject */
protected $filter;
protected function setUp() {
protected function setUp(): void {
parent::setUp();
$this->url = $this->createMock(IURLGenerator::class);
$l = $this->createMock(IL10N::class);

View File

@ -43,7 +43,7 @@ class BaseTest extends TestCase {
/** @var IProvider|Base|\PHPUnit_Framework_MockObject_MockObject */
protected $provider;
protected function setUp() {
protected function setUp(): void {
parent::setUp();
$this->userManager = $this->createMock(IUserManager::class);
$this->groupManager = $this->createMock(IGroupManager::class);
@ -113,10 +113,11 @@ class BaseTest extends TestCase {
/**
* @dataProvider dataGenerateObjectParameterThrows
* @expectedException \InvalidArgumentException
* @param mixed $eventData
*/
public function testGenerateObjectParameterThrows($eventData) {
$this->expectException(\InvalidArgumentException::class);
$this->invokePrivate($this->provider, 'generateObjectParameter', [$eventData]);
}

View File

@ -55,7 +55,7 @@ class GenericTest extends TestCase {
public function testGetIdentifier($settingClass) {
/** @var ISetting $setting */
$setting = \OC::$server->query($settingClass);
$this->assertInternalType('string', $setting->getIdentifier());
$this->assertIsString($setting->getIdentifier());
}
/**
@ -65,7 +65,7 @@ class GenericTest extends TestCase {
public function testGetName($settingClass) {
/** @var ISetting $setting */
$setting = \OC::$server->query($settingClass);
$this->assertInternalType('string', $setting->getName());
$this->assertIsString($setting->getName());
}
/**
@ -76,7 +76,7 @@ class GenericTest extends TestCase {
/** @var ISetting $setting */
$setting = \OC::$server->query($settingClass);
$priority = $setting->getPriority();
$this->assertInternalType('int', $setting->getPriority());
$this->assertIsInt($setting->getPriority());
$this->assertGreaterThanOrEqual(0, $priority);
$this->assertLessThanOrEqual(100, $priority);
}
@ -88,7 +88,7 @@ class GenericTest extends TestCase {
public function testCanChangeStream($settingClass) {
/** @var ISetting $setting */
$setting = \OC::$server->query($settingClass);
$this->assertInternalType('bool', $setting->canChangeStream());
$this->assertIsBool($setting->canChangeStream());
}
/**
@ -98,7 +98,7 @@ class GenericTest extends TestCase {
public function testIsDefaultEnabledStream($settingClass) {
/** @var ISetting $setting */
$setting = \OC::$server->query($settingClass);
$this->assertInternalType('bool', $setting->isDefaultEnabledStream());
$this->assertIsBool($setting->isDefaultEnabledStream());
}
/**
@ -108,7 +108,7 @@ class GenericTest extends TestCase {
public function testCanChangeMail($settingClass) {
/** @var ISetting $setting */
$setting = \OC::$server->query($settingClass);
$this->assertInternalType('bool', $setting->canChangeMail());
$this->assertIsBool($setting->canChangeMail());
}
/**
@ -118,6 +118,6 @@ class GenericTest extends TestCase {
public function testIsDefaultEnabledMail($settingClass) {
/** @var ISetting $setting */
$setting = \OC::$server->query($settingClass);
$this->assertInternalType('bool', $setting->isDefaultEnabledMail());
$this->assertIsBool($setting->isDefaultEnabledMail());
}
}

View File

@ -46,7 +46,7 @@ class EnablePluginTest extends TestCase {
protected $response;
public function setUp() {
protected function setUp(): void {
parent::setUp();
$this->server = $this->createMock(\Sabre\DAV\Server::class);

View File

@ -52,11 +52,11 @@ class CachedSubscriptionObjectTest extends \Test\TestCase {
$this->assertEquals('BEGIN...', $calendarObject->get());
}
/**
* @expectedException \Sabre\DAV\Exception\MethodNotAllowed
* @expectedExceptionMessage Creating objects in a cached subscription is not allowed
*/
public function testPut() {
$this->expectException(\Sabre\DAV\Exception\MethodNotAllowed::class);
$this->expectExceptionMessage('Creating objects in a cached subscription is not allowed');
$backend = $this->createMock(CalDavBackend::class);
$calendarInfo = [
'{http://owncloud.org/ns}owner-principal' => 'user1',
@ -72,11 +72,11 @@ class CachedSubscriptionObjectTest extends \Test\TestCase {
$calendarObject->put('');
}
/**
* @expectedException \Sabre\DAV\Exception\MethodNotAllowed
* @expectedExceptionMessage Deleting objects in a cached subscription is not allowed
*/
public function testDelete() {
$this->expectException(\Sabre\DAV\Exception\MethodNotAllowed::class);
$this->expectExceptionMessage('Deleting objects in a cached subscription is not allowed');
$backend = $this->createMock(CalDavBackend::class);
$calendarInfo = [
'{http://owncloud.org/ns}owner-principal' => 'user1',

View File

@ -140,11 +140,11 @@ class CachedSubscriptionTest extends \Test\TestCase {
$calendar->propPatch($propPatch);
}
/**
* @expectedException \Sabre\DAV\Exception\NotFound
* @expectedExceptionMessage Calendar object not found
*/
public function testGetChild() {
$this->expectException(\Sabre\DAV\Exception\NotFound::class);
$this->expectExceptionMessage('Calendar object not found');
$backend = $this->createMock(CalDavBackend::class);
$calendarInfo = [
'{http://owncloud.org/ns}owner-principal' => 'user1',
@ -235,11 +235,11 @@ class CachedSubscriptionTest extends \Test\TestCase {
$this->assertInstanceOf(CachedSubscriptionObject::class, $res[1]);
}
/**
* @expectedException \Sabre\DAV\Exception\MethodNotAllowed
* @expectedExceptionMessage Creating objects in cached subscription is not allowed
*/
public function testCreateFile() {
$this->expectException(\Sabre\DAV\Exception\MethodNotAllowed::class);
$this->expectExceptionMessage('Creating objects in cached subscription is not allowed');
$backend = $this->createMock(CalDavBackend::class);
$calendarInfo = [
'{http://owncloud.org/ns}owner-principal' => 'user1',

View File

@ -279,11 +279,11 @@ EOD;
$this->assertCount(0, $calendarObjects);
}
/**
* @expectedException \Sabre\DAV\Exception\BadRequest
* @expectedExceptionMessage Calendar object with uid already exists in this calendar collection.
*/
public function testMultipleCalendarObjectsWithSameUID() {
$this->expectException(\Sabre\DAV\Exception\BadRequest::class);
$this->expectExceptionMessage('Calendar object with uid already exists in this calendar collection.');
$calendarId = $this->createTestCalendar();
$calData = <<<'EOD'

View File

@ -39,7 +39,7 @@ class CalendarHomeTest extends TestCase {
/** @var CalendarHome */
private $calendarHome;
protected function setUp() {
protected function setUp(): void {
parent::setUp();
$this->backend = $this->createMock(CalDavBackend::class);
@ -68,11 +68,11 @@ class CalendarHomeTest extends TestCase {
$this->calendarHome->createExtendedCollection('name123', $mkCol);
}
/**
* @expectedException \Sabre\DAV\Exception\MethodNotAllowed
* @expectedExceptionMessage The resource you tried to create has a reserved name
*/
public function testCreateCalendarReservedName() {
$this->expectException(\Sabre\DAV\Exception\MethodNotAllowed::class);
$this->expectExceptionMessage('The resource you tried to create has a reserved name');
/** @var MkCol | \PHPUnit_Framework_MockObject_MockObject $mkCol */
$mkCol = $this->createMock(MkCol::class);

View File

@ -41,7 +41,7 @@ class CalendarImplTest extends \Test\TestCase {
/** @var CalDavBackend | \PHPUnit_Framework_MockObject_MockObject */
private $backend;
protected function setUp() {
protected function setUp(): void {
parent::setUp();
$this->calendar = $this->createMock(Calendar::class);

View File

@ -45,7 +45,7 @@ class CalendarManagerTest extends \Test\TestCase {
/** @var CalendarManager */
private $manager;
protected function setUp() {
protected function setUp(): void {
parent::setUp();
$this->backend = $this->createMock(CalDavBackend::class);
$this->l10n = $this->createMock(IL10N::class);

View File

@ -43,7 +43,7 @@ class CalendarTest extends TestCase {
/** @var IConfig */
protected $config;
public function setUp() {
protected function setUp(): void {
parent::setUp();
$this->l10n = $this->getMockBuilder(IL10N::class)
->disableOriginalConstructor()->getMock();
@ -73,10 +73,10 @@ class CalendarTest extends TestCase {
$c->delete();
}
/**
* @expectedException \Sabre\DAV\Exception\Forbidden
*/
public function testDeleteFromGroup() {
$this->expectException(\Sabre\DAV\Exception\Forbidden::class);
/** @var \PHPUnit_Framework_MockObject_MockObject | CalDavBackend $backend */
$backend = $this->getMockBuilder(CalDavBackend::class)->disableOriginalConstructor()->getMock();
$backend->expects($this->never())->method('updateShares');

View File

@ -34,7 +34,7 @@ class OutboxTest extends TestCase {
/** @var Outbox */
private $outbox;
protected function setUp() {
protected function setUp(): void {
parent::setUp();
$this->config = $this->createMock(IConfig::class);

View File

@ -30,7 +30,7 @@ class PluginTest extends TestCase {
/** @var Plugin */
private $plugin;
public function setUp() {
protected function setUp(): void {
parent::setUp();
$this->plugin = new Plugin();

View File

@ -72,7 +72,7 @@ class PublicCalendarRootTest extends TestCase {
/** @var ILogger */
private $logger;
public function setUp() {
protected function setUp(): void {
parent::setUp();
$db = \OC::$server->getDatabaseConnection();
@ -108,7 +108,7 @@ class PublicCalendarRootTest extends TestCase {
$this->l10n, $this->config);
}
public function tearDown() {
protected function tearDown(): void {
parent::tearDown();
if (is_null($this->backend)) {

View File

@ -48,7 +48,7 @@ class PluginTest extends TestCase {
/** @var IURLGenerator | \PHPUnit_Framework_MockObject_MockObject */
private $urlGenerator;
public function setUp() {
protected function setUp(): void {
parent::setUp();
$this->config = $this->getMockBuilder(IConfig::class)->

View File

@ -42,7 +42,7 @@ class BackendTest extends TestCase {
/** @var ITimeFactory|\PHPUnit\Framework\MockObject\MockObject */
private $timeFactory;
public function setUp() {
protected function setUp(): void {
parent::setUp();
$query = self::$realDatabase->getQueryBuilder();
@ -56,7 +56,7 @@ class BackendTest extends TestCase {
$this->createRemindersTestSet();
}
protected function tearDown() {
protected function tearDown(): void {
$query = self::$realDatabase->getQueryBuilder();
$query->delete('calendar_reminders')->execute();
$query->delete('calendarobjects')->execute();

View File

@ -68,7 +68,7 @@ abstract class AbstractNotificationProviderTest extends TestCase {
*/
protected $user;
public function setUp() {
protected function setUp(): void {
parent::setUp();
$this->logger = $this->createMock(ILogger::class);

View File

@ -61,7 +61,7 @@ class EmailProviderTest extends AbstractNotificationProviderTest {
/** @var IMailer|\PHPUnit\Framework\MockObject\MockObject */
private $mailer;
public function setUp() {
protected function setUp(): void {
parent::setUp();
$this->mailer = $this->createMock(IMailer::class);

View File

@ -61,7 +61,7 @@ class PushProviderTest extends AbstractNotificationProviderTest {
/** @var ITimeFactory|\PHPUnit\Framework\MockObject\MockObject */
private $timeFactory;
public function setUp() {
protected function setUp(): void {
parent::setUp();
$this->config = $this->createMock(IConfig::class);

View File

@ -41,7 +41,7 @@ class NotificationProviderManagerTest extends TestCase {
/**
* @throws \OCP\AppFramework\QueryException
*/
public function setUp() {
protected function setUp(): void {
parent::setUp();
$this->providerManager = new NotificationProviderManager();
@ -49,22 +49,24 @@ class NotificationProviderManagerTest extends TestCase {
}
/**
* @expectedException OCA\DAV\CalDAV\Reminder\NotificationTypeDoesNotExistException
* @expectedExceptionMessage Type NOT EXISTENT is not an accepted type of notification
* @throws ProviderNotAvailableException
* @throws NotificationTypeDoesNotExistException
*/
public function testGetProviderForUnknownType(): void{
$this->expectException(\OCA\DAV\CalDAV\Reminder\NotificationTypeDoesNotExistException::class);
$this->expectExceptionMessage('Type NOT EXISTENT is not an accepted type of notification');
$this->providerManager->getProvider('NOT EXISTENT');
}
/**
* @expectedException OCA\DAV\CalDAV\Reminder\NotificationProvider\ProviderNotAvailableException
* @expectedExceptionMessage No notification provider for type AUDIO available
* @throws NotificationTypeDoesNotExistException
* @throws ProviderNotAvailableException
*/
public function testGetProviderForUnRegisteredType(): void{
$this->expectException(\OCA\DAV\CalDAV\Reminder\NotificationProvider\ProviderNotAvailableException::class);
$this->expectExceptionMessage('No notification provider for type AUDIO available');
$this->providerManager->getProvider('AUDIO');
}
@ -80,11 +82,12 @@ class NotificationProviderManagerTest extends TestCase {
}
/**
* @expectedExceptionMessage Invalid notification provider registered
* @expectedException \InvalidArgumentException
* @throws \OCP\AppFramework\QueryException
*/
public function testRegisterBadProvider(): void{
$this->expectException(\InvalidArgumentException::class);
$this->expectExceptionMessage('Invalid notification provider registered');
$this->providerManager->registerProvider(Capabilities::class);
}

View File

@ -50,7 +50,7 @@ class NotifierTest extends TestCase {
/** @var ITimeFactory|\PHPUnit\Framework\MockObject\MockObject */
protected $timeFactory;
protected function setUp() {
protected function setUp(): void {
parent::setUp();
$this->urlGenerator = $this->createMock(IURLGenerator::class);
@ -98,12 +98,12 @@ class NotifierTest extends TestCase {
$this->assertEquals($this->notifier->getName(), 'Calendar');
}
/**
* @expectedException \InvalidArgumentException
* @expectedExceptionMessage Notification not from this app
*/
public function testPrepareWrongApp(): void
{
$this->expectException(\InvalidArgumentException::class);
$this->expectExceptionMessage('Notification not from this app');
/** @var INotification|\PHPUnit\Framework\MockObject\MockObject $notification */
$notification = $this->createMock(INotification::class);
@ -116,11 +116,11 @@ class NotifierTest extends TestCase {
$this->notifier->prepare($notification, 'en');
}
/**
* @expectedException \InvalidArgumentException
* @expectedExceptionMessage Unknown subject
*/
public function testPrepareWrongSubject() {
$this->expectException(\InvalidArgumentException::class);
$this->expectExceptionMessage('Unknown subject');
/** @var INotification|\PHPUnit\Framework\MockObject\MockObject $notification */
$notification = $this->createMock(INotification::class);

View File

@ -184,7 +184,7 @@ END:VEVENT
END:VCALENDAR
EOD;
public function setUp() {
protected function setUp(): void {
parent::setUp();
$this->backend = $this->createMock(Backend::class);

View File

@ -64,7 +64,7 @@ abstract class AbstractPrincipalBackendTest extends TestCase {
/** @var string */
protected $expectedCUType;
public function setUp() {
protected function setUp(): void {
parent::setUp();
$this->userSession = $this->createMock(IUserSession::class);
@ -73,7 +73,7 @@ abstract class AbstractPrincipalBackendTest extends TestCase {
$this->proxyMapper = $this->createMock(ProxyMapper::class);
}
protected function tearDown() {
protected function tearDown(): void {
$query = self::$realDatabase->getQueryBuilder();
$query->delete('calendar_resources')->execute();

View File

@ -25,7 +25,7 @@ namespace OCA\DAV\Tests\unit\CalDAV\ResourceBooking;
use OCA\DAV\CalDAV\ResourceBooking\ResourcePrincipalBackend;
Class ResourcePrincipalBackendTest extends AbstractPrincipalBackendTest {
public function setUp() {
protected function setUp(): void {
parent::setUp();
$this->principalBackend = new ResourcePrincipalBackend(self::$realDatabase,

View File

@ -25,7 +25,7 @@ namespace OCA\DAV\Tests\unit\CalDAV\ResourceBooking;
use OCA\DAV\CalDAV\ResourceBooking\RoomPrincipalBackend;
Class RoomPrincipalBackendTest extends AbstractPrincipalBackendTest {
public function setUp() {
protected function setUp(): void {
parent::setUp();
$this->principalBackend = new RoomPrincipalBackend(self::$realDatabase,

View File

@ -48,7 +48,7 @@ use Test\TestCase;
class IMipPluginTest extends TestCase {
public function setUp() {
protected function setUp(): void {
$this->mailMessage = $this->createMock(IMessage::class);
$this->mailMessage->method('setFrom')->willReturn($this->mailMessage);
$this->mailMessage->method('setReplyTo')->willReturn($this->mailMessage);

View File

@ -36,7 +36,7 @@ class PluginTest extends TestCase {
/** @var Server|\PHPUnit_Framework_MockObject_MockObject */
private $server;
public function setUp() {
protected function setUp(): void {
parent::setUp();
$this->server = $this->createMock(Server::class);

View File

@ -131,11 +131,11 @@ XML;
);
}
/**
* @expectedException \Sabre\DAV\Exception\BadRequest
* @expectedExceptionMessage {http://nextcloud.com/ns}prop-filter or {http://nextcloud.com/ns}param-filter given without any {http://nextcloud.com/ns}comp-filter
*/
public function testRequiresCompFilter() {
$this->expectException(\Sabre\DAV\Exception\BadRequest::class);
$this->expectExceptionMessage('{http://nextcloud.com/ns}prop-filter or {http://nextcloud.com/ns}param-filter given without any {http://nextcloud.com/ns}comp-filter');
$xml = <<<XML
<?xml version="1.0" encoding="UTF-8"?>
<nc:calendar-search xmlns:nc="http://nextcloud.com/ns" xmlns:c="urn:ietf:params:xml:ns:caldav" xmlns:d="DAV:">
@ -158,11 +158,11 @@ XML;
$this->parse($xml);
}
/**
* @expectedException \Sabre\DAV\Exception\BadRequest
* @expectedExceptionMessage The {http://nextcloud.com/ns}filter element is required for this request
*/
public function testRequiresFilter() {
$this->expectException(\Sabre\DAV\Exception\BadRequest::class);
$this->expectExceptionMessage('The {http://nextcloud.com/ns}filter element is required for this request');
$xml = <<<XML
<?xml version="1.0" encoding="UTF-8"?>
<nc:calendar-search xmlns:nc="http://nextcloud.com/ns" xmlns:c="urn:ietf:params:xml:ns:caldav" xmlns:d="DAV:">
@ -176,11 +176,11 @@ XML;
$this->parse($xml);
}
/**
* @expectedException \Sabre\DAV\Exception\BadRequest
* @expectedExceptionMessage {http://nextcloud.com/ns}search-term is required for this request
*/
public function testNoSearchTerm() {
$this->expectException(\Sabre\DAV\Exception\BadRequest::class);
$this->expectExceptionMessage('{http://nextcloud.com/ns}search-term is required for this request');
$xml = <<<XML
<?xml version="1.0" encoding="UTF-8"?>
<nc:calendar-search xmlns:nc="http://nextcloud.com/ns" xmlns:c="urn:ietf:params:xml:ns:caldav" xmlns:d="DAV:">
@ -204,11 +204,11 @@ XML;
$this->parse($xml);
}
/**
* @expectedException \Sabre\DAV\Exception\BadRequest
* @expectedExceptionMessage At least one{http://nextcloud.com/ns}prop-filter or {http://nextcloud.com/ns}param-filter is required for this request
*/
public function testCompOnly() {
$this->expectException(\Sabre\DAV\Exception\BadRequest::class);
$this->expectExceptionMessage('At least one{http://nextcloud.com/ns}prop-filter or {http://nextcloud.com/ns}param-filter is required for this request');
$xml = <<<XML
<?xml version="1.0" encoding="UTF-8"?>
<nc:calendar-search xmlns:nc="http://nextcloud.com/ns" xmlns:c="urn:ietf:params:xml:ns:caldav" xmlns:d="DAV:">

View File

@ -26,6 +26,7 @@ namespace OCA\DAV\Tests\unit\CalDAV\Search;
use OCA\DAV\CalDAV\CalendarHome;
use OCA\DAV\CalDAV\Search\SearchPlugin;
use OCA\DAV\CalDAV\Search\Xml\Request\CalendarSearchReport;
use Sabre\Xml\Service;
use Test\TestCase;
class SearchPluginTest extends TestCase {
@ -35,12 +36,13 @@ class SearchPluginTest extends TestCase {
/** @var \OCA\DAV\CalDAV\Search\SearchPlugin $plugin */
protected $plugin;
public function setUp() {
protected function setUp(): void {
parent::setUp();
$this->server = $this->createMock(\Sabre\DAV\Server::class);
$this->server->tree = $this->createMock(\Sabre\DAV\Tree::class);
$this->server->httpResponse = $this->createMock(\Sabre\HTTP\Response::class);
$this->server->xml = new Service();
$this->plugin = new SearchPlugin();
$this->plugin->initialize($this->server);
@ -62,6 +64,7 @@ class SearchPluginTest extends TestCase {
$server->expects($this->at(0))
->method('on')
->with('report', [$plugin, 'report']);
$server->xml = new Service();
$plugin->initialize($server);
@ -93,6 +96,11 @@ class SearchPluginTest extends TestCase {
->method('getHTTPDepth')
->with(2)
->will($this->returnValue(2));
$this->server
->method('getHTTPPrefer')
->willReturn([
'return' => null
]);
$calendarHome->expects($this->at(0))
->method('calendarSearch')
->will($this->returnValue([]));

View File

@ -55,7 +55,7 @@ class AddressBookImplTest extends TestCase {
/** @var VCard | \PHPUnit_Framework_MockObject_MockObject */
private $vCard;
public function setUp() {
protected function setUp(): void {
parent::setUp();
$this->addressBookInfo = [

View File

@ -51,10 +51,10 @@ class AddressBookTest extends TestCase {
$c->delete();
}
/**
* @expectedException \Sabre\DAV\Exception\Forbidden
*/
public function testDeleteFromGroup() {
$this->expectException(\Sabre\DAV\Exception\Forbidden::class);
/** @var \PHPUnit_Framework_MockObject_MockObject | CardDavBackend $backend */
$backend = $this->getMockBuilder(CardDavBackend::class)->disableOriginalConstructor()->getMock();
$backend->expects($this->never())->method('updateShares');
@ -73,10 +73,10 @@ class AddressBookTest extends TestCase {
$c->delete();
}
/**
* @expectedException \Sabre\DAV\Exception\Forbidden
*/
public function testPropPatch() {
$this->expectException(\Sabre\DAV\Exception\Forbidden::class);
/** @var \PHPUnit_Framework_MockObject_MockObject | CardDavBackend $backend */
$backend = $this->getMockBuilder(CardDavBackend::class)->disableOriginalConstructor()->getMock();
$calendarInfo = [

View File

@ -52,7 +52,7 @@ class BirthdayServiceTest extends TestCase {
/** @var IL10N | \PHPUnit_Framework_MockObject_MockObject */
private $l10n;
public function setUp() {
protected function setUp(): void {
parent::setUp();
$this->calDav = $this->createMock(CalDavBackend::class);

View File

@ -121,7 +121,7 @@ class CardDavBackendTest extends TestCase {
'N:TestNoUID;;;;'.PHP_EOL.
'END:VCARD';
public function setUp() {
protected function setUp(): void {
parent::setUp();
$this->userManager = $this->createMock(IUserManager::class);
@ -159,7 +159,7 @@ class CardDavBackendTest extends TestCase {
$this->tearDown();
}
public function tearDown() {
protected function tearDown(): void {
parent::tearDown();
if (is_null($this->backend)) {
@ -631,10 +631,10 @@ class CardDavBackendTest extends TestCase {
$this->invokePrivate($this->backend, 'getCardId', [1, 'uri']));
}
/**
* @expectedException InvalidArgumentException
*/
public function testGetCardIdFailed() {
$this->expectException(\InvalidArgumentException::class);
$this->invokePrivate($this->backend, 'getCardId', [1, 'uri']);
}
@ -784,10 +784,10 @@ class CardDavBackendTest extends TestCase {
$this->assertSame('uri', $this->backend->getCardUri($id));
}
/**
* @expectedException InvalidArgumentException
*/
public function testGetCardUriFailed() {
$this->expectException(\InvalidArgumentException::class);
$this->backend->getCardUri(1);
}

View File

@ -39,7 +39,7 @@ class ConverterTest extends TestCase {
/** @var AccountManager | PHPUnit_Framework_MockObject_MockObject */
private $accountManager;
public function setUp() {
protected function setUp(): void {
parent::setUp();
$this->accountManager = $this->createMock(AccountManager::class);

View File

@ -53,7 +53,7 @@ class ImageExportPluginTest extends TestCase {
/** @var PhotoCache|\PHPUnit_Framework_MockObject_MockObject */
private $cache;
function setUp() {
protected function setUp(): void {
parent::setUp();
$this->request = $this->createMock(RequestInterface::class);

View File

@ -44,7 +44,7 @@ class PluginTest extends TestCase {
/** @var IShareable | \PHPUnit_Framework_MockObject_MockObject */
private $book;
public function setUp() {
protected function setUp(): void {
parent::setUp();
/** @var Auth | \PHPUnit_Framework_MockObject_MockObject $authBackend */

View File

@ -113,6 +113,10 @@ class SyncServiceTest extends TestCase {
'carddata' => "BEGIN:VCARD\r\nVERSION:3.0\r\nPRODID:-//Sabre//Sabre VObject 3.4.8//EN\r\nUID:test-user\r\nFN:test-user\r\nN:test-user;;;;\r\nEND:VCARD\r\n\r\n"
]);
$backend->method('getAddressBooksByUri')
->with('principals/system/system', 'system')
->willReturn(['id' => -1]);
/** @var IUserManager | \PHPUnit_Framework_MockObject_MockObject $userManager */
$userManager = $this->getMockBuilder(IUserManager::class)->disableOriginalConstructor()->getMock();

View File

@ -46,7 +46,7 @@ class ListCalendarsTest extends TestCase {
const USERNAME = 'username';
protected function setUp() {
protected function setUp(): void {
parent::setUp();
$this->userManager = $this->createMock(IUserManager::class);
@ -58,11 +58,11 @@ class ListCalendarsTest extends TestCase {
);
}
/**
* @expectedException InvalidArgumentException
*/
public function testWithBadUser()
{
$this->expectException(\InvalidArgumentException::class);
$this->userManager->expects($this->once())
->method('userExists')
->with(self::USERNAME)

View File

@ -59,7 +59,7 @@ class MoveCalendarTest extends TestCase {
/** @var MoveCalendar */
private $command;
protected function setUp() {
protected function setUp(): void {
parent::setUp();
$this->userManager = $this->createMock(IUserManager::class);
@ -89,12 +89,13 @@ class MoveCalendarTest extends TestCase {
/**
* @dataProvider dataExecute
*
* @expectedException InvalidArgumentException
* @param $userOriginExists
* @param $userDestinationExists
*/
public function testWithBadUserOrigin($userOriginExists, $userDestinationExists)
{
$this->expectException(\InvalidArgumentException::class);
$this->userManager->expects($this->at(0))
->method('userExists')
->with('user')
@ -115,12 +116,12 @@ class MoveCalendarTest extends TestCase {
]);
}
/**
* @expectedException InvalidArgumentException
* @expectedExceptionMessage User <user> has no calendar named <personal>. You can run occ dav:list-calendars to list calendars URIs for this user.
*/
public function testMoveWithInexistantCalendar()
{
$this->expectException(\InvalidArgumentException::class);
$this->expectExceptionMessage('User <user> has no calendar named <personal>. You can run occ dav:list-calendars to list calendars URIs for this user.');
$this->userManager->expects($this->at(0))
->method('userExists')
->with('user')
@ -143,12 +144,12 @@ class MoveCalendarTest extends TestCase {
]);
}
/**
* @expectedException InvalidArgumentException
* @expectedExceptionMessage User <user2> already has a calendar named <personal>.
*/
public function testMoveWithExistingDestinationCalendar()
{
$this->expectException(\InvalidArgumentException::class);
$this->expectExceptionMessage('User <user2> already has a calendar named <personal>.');
$this->userManager->expects($this->at(0))
->method('userExists')
->with('user')

View File

@ -37,7 +37,7 @@ use Test\TestCase;
*/
class RemoveInvalidSharesTest extends TestCase {
public function setUp() {
protected function setUp(): void {
parent::setUp();
$db = \OC::$server->getDatabaseConnection();

View File

@ -47,7 +47,7 @@ class CommentsNodeTest extends \Test\TestCase {
protected $logger;
protected $userSession;
public function setUp() {
protected function setUp(): void {
parent::setUp();
$this->commentsManager = $this->getMockBuilder(ICommentsManager::class)
@ -107,10 +107,10 @@ class CommentsNodeTest extends \Test\TestCase {
$this->node->delete();
}
/**
* @expectedException \Sabre\DAV\Exception\Forbidden
*/
public function testDeleteForbidden() {
$this->expectException(\Sabre\DAV\Exception\Forbidden::class);
$user = $this->getMockBuilder(IUser::class)
->disableOriginalConstructor()
->getMock();
@ -149,10 +149,10 @@ class CommentsNodeTest extends \Test\TestCase {
$this->assertSame($this->node->getName(), $id);
}
/**
* @expectedException \Sabre\DAV\Exception\MethodNotAllowed
*/
public function testSetName() {
$this->expectException(\Sabre\DAV\Exception\MethodNotAllowed::class);
$this->node->setName('666');
}
@ -194,11 +194,11 @@ class CommentsNodeTest extends \Test\TestCase {
$this->assertTrue($this->node->updateComment($msg));
}
/**
* @expectedException \Exception
* @expectedExceptionMessage buh!
*/
public function testUpdateCommentLogException() {
$this->expectException(\Exception::class);
$this->expectExceptionMessage('buh!');
$msg = null;
$user = $this->getMockBuilder(IUser::class)
@ -235,11 +235,11 @@ class CommentsNodeTest extends \Test\TestCase {
$this->node->updateComment($msg);
}
/**
* @expectedException \Sabre\DAV\Exception\BadRequest
* @expectedExceptionMessage Message exceeds allowed character limit of
*/
public function testUpdateCommentMessageTooLongException() {
$this->expectException(\Sabre\DAV\Exception\BadRequest::class);
$this->expectExceptionMessage('Message exceeds allowed character limit of');
$user = $this->getMockBuilder(IUser::class)
->disableOriginalConstructor()
->getMock();
@ -274,10 +274,10 @@ class CommentsNodeTest extends \Test\TestCase {
$this->node->updateComment('foo');
}
/**
* @expectedException \Sabre\DAV\Exception\Forbidden
*/
public function testUpdateForbiddenByUser() {
$this->expectException(\Sabre\DAV\Exception\Forbidden::class);
$msg = 'HaXX0r';
$user = $this->getMockBuilder(IUser::class)
@ -309,10 +309,10 @@ class CommentsNodeTest extends \Test\TestCase {
$this->node->updateComment($msg);
}
/**
* @expectedException \Sabre\DAV\Exception\Forbidden
*/
public function testUpdateForbiddenByType() {
$this->expectException(\Sabre\DAV\Exception\Forbidden::class);
$msg = 'HaXX0r';
$user = $this->getMockBuilder(IUser::class)
@ -339,10 +339,10 @@ class CommentsNodeTest extends \Test\TestCase {
$this->node->updateComment($msg);
}
/**
* @expectedException \Sabre\DAV\Exception\Forbidden
*/
public function testUpdateForbiddenByNotLoggedIn() {
$this->expectException(\Sabre\DAV\Exception\Forbidden::class);
$msg = 'HaXX0r';
$this->userSession->expects($this->once())

View File

@ -54,7 +54,7 @@ class CommentsPluginTest extends \Test\TestCase {
/** @var CommentsPluginImplementation */
private $plugin;
public function setUp() {
protected function setUp(): void {
parent::setUp();
$this->tree = $this->getMockBuilder(Tree::class)
->disableOriginalConstructor()
@ -170,10 +170,10 @@ class CommentsPluginTest extends \Test\TestCase {
$this->plugin->httpPost($request, $response);
}
/**
* @expectedException \Sabre\DAV\Exception\NotFound
*/
public function testCreateCommentInvalidObject() {
$this->expectException(\Sabre\DAV\Exception\NotFound::class);
$commentData = [
'actorType' => 'users',
'verb' => 'comment',
@ -252,10 +252,10 @@ class CommentsPluginTest extends \Test\TestCase {
$this->plugin->httpPost($request, $response);
}
/**
* @expectedException \Sabre\DAV\Exception\BadRequest
*/
public function testCreateCommentInvalidActor() {
$this->expectException(\Sabre\DAV\Exception\BadRequest::class);
$commentData = [
'actorType' => 'robots',
'verb' => 'comment',
@ -340,10 +340,10 @@ class CommentsPluginTest extends \Test\TestCase {
$this->plugin->httpPost($request, $response);
}
/**
* @expectedException \Sabre\DAV\Exception\UnsupportedMediaType
*/
public function testCreateCommentUnsupportedMediaType() {
$this->expectException(\Sabre\DAV\Exception\UnsupportedMediaType::class);
$commentData = [
'actorType' => 'users',
'verb' => 'comment',
@ -428,10 +428,10 @@ class CommentsPluginTest extends \Test\TestCase {
$this->plugin->httpPost($request, $response);
}
/**
* @expectedException \Sabre\DAV\Exception\BadRequest
*/
public function testCreateCommentInvalidPayload() {
$this->expectException(\Sabre\DAV\Exception\BadRequest::class);
$commentData = [
'actorType' => 'users',
'verb' => '',
@ -522,11 +522,11 @@ class CommentsPluginTest extends \Test\TestCase {
$this->plugin->httpPost($request, $response);
}
/**
* @expectedException \Sabre\DAV\Exception\BadRequest
* @expectedExceptionMessage Message exceeds allowed character limit of
*/
public function testCreateCommentMessageTooLong() {
$this->expectException(\Sabre\DAV\Exception\BadRequest::class);
$this->expectExceptionMessage('Message exceeds allowed character limit of');
$commentData = [
'actorType' => 'users',
'verb' => 'comment',
@ -616,10 +616,10 @@ class CommentsPluginTest extends \Test\TestCase {
$this->plugin->httpPost($request, $response);
}
/**
* @expectedException \Sabre\DAV\Exception\ReportNotSupported
*/
public function testOnReportInvalidNode() {
$this->expectException(\Sabre\DAV\Exception\ReportNotSupported::class);
$path = 'totally/unrelated/13';
$this->tree->expects($this->any())
@ -639,10 +639,10 @@ class CommentsPluginTest extends \Test\TestCase {
$this->plugin->onReport(CommentsPluginImplementation::REPORT_NAME, [], '/' . $path);
}
/**
* @expectedException \Sabre\DAV\Exception\ReportNotSupported
*/
public function testOnReportInvalidReportName() {
$this->expectException(\Sabre\DAV\Exception\ReportNotSupported::class);
$path = 'comments/files/42';
$this->tree->expects($this->any())

View File

@ -45,7 +45,7 @@ class EntityCollectionTest extends \Test\TestCase {
/** @var IUserSession|\PHPUnit_Framework_MockObject_MockObject */
protected $userSession;
public function setUp() {
protected function setUp(): void {
parent::setUp();
$this->commentsManager = $this->getMockBuilder(ICommentsManager::class)
@ -89,10 +89,10 @@ class EntityCollectionTest extends \Test\TestCase {
$this->assertTrue($node instanceof \OCA\DAV\Comments\CommentNode);
}
/**
* @expectedException \Sabre\DAV\Exception\NotFound
*/
public function testGetChildException() {
$this->expectException(\Sabre\DAV\Exception\NotFound::class);
$this->commentsManager->expects($this->once())
->method('get')
->with('55')

View File

@ -46,7 +46,7 @@ class EntityTypeCollectionTest extends \Test\TestCase {
protected $childMap = [];
public function setUp() {
protected function setUp(): void {
parent::setUp();
$this->commentsManager = $this->getMockBuilder(ICommentsManager::class)
@ -92,17 +92,17 @@ class EntityTypeCollectionTest extends \Test\TestCase {
$this->assertTrue($ec instanceof EntityCollectionImplemantation);
}
/**
* @expectedException \Sabre\DAV\Exception\NotFound
*/
public function testGetChildException() {
$this->expectException(\Sabre\DAV\Exception\NotFound::class);
$this->collection->getChild('17');
}
/**
* @expectedException \Sabre\DAV\Exception\MethodNotAllowed
*/
public function testGetChildren() {
$this->expectException(\Sabre\DAV\Exception\MethodNotAllowed::class);
$this->collection->getChildren();
}
}

View File

@ -53,7 +53,7 @@ class RootCollectionTest extends \Test\TestCase {
/** @var \OCP\IUser|\PHPUnit_Framework_MockObject_MockObject */
protected $user;
public function setUp() {
protected function setUp(): void {
parent::setUp();
$this->user = $this->getMockBuilder(IUser::class)
@ -106,17 +106,17 @@ class RootCollectionTest extends \Test\TestCase {
});
}
/**
* @expectedException \Sabre\DAV\Exception\Forbidden
*/
public function testCreateFile() {
$this->expectException(\Sabre\DAV\Exception\Forbidden::class);
$this->collection->createFile('foo');
}
/**
* @expectedException \Sabre\DAV\Exception\Forbidden
*/
public function testCreateDirectory() {
$this->expectException(\Sabre\DAV\Exception\Forbidden::class);
$this->collection->createDirectory('foo');
}
@ -126,18 +126,18 @@ class RootCollectionTest extends \Test\TestCase {
$this->assertTrue($etc instanceof EntityTypeCollectionImplementation);
}
/**
* @expectedException \Sabre\DAV\Exception\NotFound
*/
public function testGetChildInvalid() {
$this->expectException(\Sabre\DAV\Exception\NotFound::class);
$this->prepareForInitCollections();
$this->collection->getChild('robots');
}
/**
* @expectedException \Sabre\DAV\Exception\NotAuthenticated
*/
public function testGetChildNoAuth() {
$this->expectException(\Sabre\DAV\Exception\NotAuthenticated::class);
$this->collection->getChild('files');
}
@ -150,10 +150,10 @@ class RootCollectionTest extends \Test\TestCase {
}
}
/**
* @expectedException \Sabre\DAV\Exception\NotAuthenticated
*/
public function testGetChildrenNoAuth() {
$this->expectException(\Sabre\DAV\Exception\NotAuthenticated::class);
$this->collection->getChildren();
}
@ -167,17 +167,17 @@ class RootCollectionTest extends \Test\TestCase {
$this->assertFalse($this->collection->childExists('robots'));
}
/**
* @expectedException \Sabre\DAV\Exception\NotAuthenticated
*/
public function testChildExistsNoAuth() {
$this->expectException(\Sabre\DAV\Exception\NotAuthenticated::class);
$this->collection->childExists('files');
}
/**
* @expectedException \Sabre\DAV\Exception\Forbidden
*/
public function testDelete() {
$this->expectException(\Sabre\DAV\Exception\Forbidden::class);
$this->collection->delete();
}
@ -185,10 +185,10 @@ class RootCollectionTest extends \Test\TestCase {
$this->assertSame('comments', $this->collection->getName());
}
/**
* @expectedException \Sabre\DAV\Exception\Forbidden
*/
public function testSetName() {
$this->expectException(\Sabre\DAV\Exception\Forbidden::class);
$this->collection->setName('foobar');
}

View File

@ -54,7 +54,7 @@ class PublicAuthTest extends \Test\TestCase {
/** @var string */
private $oldUser;
protected function setUp() {
protected function setUp(): void {
parent::setUp();
$this->session = $this->getMockBuilder(ISession::class)
@ -77,7 +77,7 @@ class PublicAuthTest extends \Test\TestCase {
$this->oldUser = \OC_User::getUser();
}
protected function tearDown() {
protected function tearDown(): void {
\OC_User::setIncognitoMode(false);
// Set old user

View File

@ -60,7 +60,7 @@ class AuthTest extends TestCase {
/** @var Throttler */
private $throttler;
public function setUp() {
protected function setUp(): void {
parent::setUp();
$this->session = $this->getMockBuilder(ISession::class)
->disableOriginalConstructor()->getMock();
@ -220,10 +220,10 @@ class AuthTest extends TestCase {
$this->assertFalse($this->invokePrivate($this->auth, 'validateUserPass', ['MyTestUser', 'MyTestPassword']));
}
/**
* @expectedException \OCA\DAV\Connector\Sabre\Exception\PasswordLoginForbidden
*/
public function testValidateUserPassWithPasswordLoginForbidden() {
$this->expectException(\OCA\DAV\Connector\Sabre\Exception\PasswordLoginForbidden::class);
$this->userSession
->expects($this->once())
->method('isLoggedIn')
@ -329,11 +329,11 @@ class AuthTest extends TestCase {
$this->auth->check($request, $response);
}
/**
* @expectedException \Sabre\DAV\Exception\NotAuthenticated
* @expectedExceptionMessage 2FA challenge not passed.
*/
public function testAuthenticateAlreadyLoggedInWithoutTwoFactorChallengePassed() {
$this->expectException(\Sabre\DAV\Exception\NotAuthenticated::class);
$this->expectExceptionMessage('2FA challenge not passed.');
$request = $this->getMockBuilder(RequestInterface::class)
->disableOriginalConstructor()
->getMock();
@ -383,11 +383,11 @@ class AuthTest extends TestCase {
$this->auth->check($request, $response);
}
/**
* @expectedException \Sabre\DAV\Exception\NotAuthenticated
* @expectedExceptionMessage CSRF check not passed.
*/
public function testAuthenticateAlreadyLoggedInWithoutCsrfTokenAndIncorrectlyDavAuthenticated() {
$this->expectException(\Sabre\DAV\Exception\NotAuthenticated::class);
$this->expectExceptionMessage('CSRF check not passed.');
$request = $this->getMockBuilder(RequestInterface::class)
->disableOriginalConstructor()
->getMock();
@ -564,11 +564,11 @@ class AuthTest extends TestCase {
$this->assertEquals([false, 'No \'Authorization: Basic\' header found. Either the client didn\'t send one, or the server is misconfigured'], $response);
}
/**
* @expectedException \Sabre\DAV\Exception\NotAuthenticated
* @expectedExceptionMessage Cannot authenticate over ajax calls
*/
public function testAuthenticateNoBasicAuthenticateHeadersProvidedWithAjax() {
$this->expectException(\Sabre\DAV\Exception\NotAuthenticated::class);
$this->expectExceptionMessage('Cannot authenticate over ajax calls');
/** @var \Sabre\HTTP\RequestInterface $httpRequest */
$httpRequest = $this->getMockBuilder(RequestInterface::class)
->disableOriginalConstructor()

View File

@ -45,7 +45,7 @@ class BearerAuthTest extends TestCase {
/** @var BearerAuth */
private $bearerAuth;
public function setUp() {
protected function setUp(): void {
parent::setUp();
$this->userSession = $this->createMock(\OC\User\Session::class);

View File

@ -42,7 +42,7 @@ class BlockLegacyClientPluginTest extends TestCase {
/** @var BlockLegacyClientPlugin */
private $blockLegacyClientVersionPlugin;
public function setUp() {
protected function setUp(): void {
parent::setUp();
$this->config = $this->getMockBuilder(IConfig::class)
@ -67,10 +67,11 @@ class BlockLegacyClientPluginTest extends TestCase {
/**
* @dataProvider oldDesktopClientProvider
* @param string $userAgent
* @expectedException \Sabre\DAV\Exception\Forbidden
* @expectedExceptionMessage Unsupported client version.
*/
public function testBeforeHandlerException($userAgent) {
$this->expectException(\Sabre\DAV\Exception\Forbidden::class);
$this->expectExceptionMessage('Unsupported client version.');
/** @var \Sabre\HTTP\RequestInterface | PHPUnit_Framework_MockObject_MockObject $request */
$request = $this->createMock('\Sabre\HTTP\RequestInterface');
$request

View File

@ -40,7 +40,7 @@ class CommentsPropertiesPluginTest extends \Test\TestCase {
protected $userSession;
protected $server;
public function setUp() {
protected function setUp(): void {
parent::setUp();
$this->commentsManager = $this->getMockBuilder(ICommentsManager::class)

View File

@ -45,7 +45,7 @@ class CopyEtagHeaderPluginTest extends TestCase {
/** @var Server */
private $server;
public function setUp() {
protected function setUp(): void {
parent::setUp();
$this->server = new \Sabre\DAV\Server();
$this->plugin = new CopyEtagHeaderPlugin();

View File

@ -67,7 +67,7 @@ class CustomPropertiesBackendTest extends \Test\TestCase {
*/
private $user;
public function setUp() {
protected function setUp(): void {
parent::setUp();
$this->server = new \Sabre\DAV\Server();
$this->tree = $this->getMockBuilder(Tree::class)
@ -90,7 +90,7 @@ class CustomPropertiesBackendTest extends \Test\TestCase {
);
}
public function tearDown() {
protected function tearDown(): void {
$connection = \OC::$server->getDatabaseConnection();
$deleteStatement = $connection->prepare(
'DELETE FROM `*PREFIX*properties`' .

View File

@ -75,7 +75,7 @@ class DirectoryTest extends \Test\TestCase {
/** @var \OC\Files\FileInfo | \PHPUnit_Framework_MockObject_MockObject */
private $info;
protected function setUp() {
protected function setUp(): void {
parent::setUp();
$this->view = $this->createMock('OC\Files\View');
@ -97,10 +97,10 @@ class DirectoryTest extends \Test\TestCase {
return new Directory($this->view, $this->info);
}
/**
* @expectedException \Sabre\DAV\Exception\Forbidden
*/
public function testDeleteRootFolderFails() {
$this->expectException(\Sabre\DAV\Exception\Forbidden::class);
$this->info->expects($this->any())
->method('isDeletable')
->will($this->returnValue(true));
@ -110,10 +110,10 @@ class DirectoryTest extends \Test\TestCase {
$dir->delete();
}
/**
* @expectedException \OCA\DAV\Connector\Sabre\Exception\Forbidden
*/
public function testDeleteForbidden() {
$this->expectException(\OCA\DAV\Connector\Sabre\Exception\Forbidden::class);
// deletion allowed
$this->info->expects($this->once())
->method('isDeletable')
@ -129,9 +129,7 @@ class DirectoryTest extends \Test\TestCase {
$dir->delete();
}
/**
*
*/
public function testDeleteFolderWhenAllowed() {
// deletion allowed
$this->info->expects($this->once())
@ -148,10 +146,10 @@ class DirectoryTest extends \Test\TestCase {
$dir->delete();
}
/**
* @expectedException \Sabre\DAV\Exception\Forbidden
*/
public function testDeleteFolderFailsWhenNotAllowed() {
$this->expectException(\Sabre\DAV\Exception\Forbidden::class);
$this->info->expects($this->once())
->method('isDeletable')
->will($this->returnValue(false));
@ -160,10 +158,10 @@ class DirectoryTest extends \Test\TestCase {
$dir->delete();
}
/**
* @expectedException \Sabre\DAV\Exception\Forbidden
*/
public function testDeleteFolderThrowsWhenDeletionFailed() {
$this->expectException(\Sabre\DAV\Exception\Forbidden::class);
// deletion allowed
$this->info->expects($this->once())
->method('isDeletable')
@ -218,10 +216,10 @@ class DirectoryTest extends \Test\TestCase {
$dir->getChildren();
}
/**
* @expectedException \Sabre\DAV\Exception\Forbidden
*/
public function testGetChildrenNoPermission() {
$this->expectException(\Sabre\DAV\Exception\Forbidden::class);
$info = $this->createMock(FileInfo::class);
$info->expects($this->any())
->method('isReadable')
@ -231,10 +229,10 @@ class DirectoryTest extends \Test\TestCase {
$dir->getChildren();
}
/**
* @expectedException \Sabre\DAV\Exception\NotFound
*/
public function testGetChildNoPermission() {
$this->expectException(\Sabre\DAV\Exception\NotFound::class);
$this->info->expects($this->any())
->method('isReadable')
->will($this->returnValue(false));
@ -243,10 +241,10 @@ class DirectoryTest extends \Test\TestCase {
$dir->getChild('test');
}
/**
* @expectedException \Sabre\DAV\Exception\ServiceUnavailable
*/
public function testGetChildThrowStorageNotAvailableException() {
$this->expectException(\Sabre\DAV\Exception\ServiceUnavailable::class);
$this->view->expects($this->once())
->method('getFileInfo')
->willThrowException(new \OCP\Files\StorageNotAvailableException());
@ -255,10 +253,10 @@ class DirectoryTest extends \Test\TestCase {
$dir->getChild('.');
}
/**
* @expectedException \OCA\DAV\Connector\Sabre\Exception\InvalidPath
*/
public function testGetChildThrowInvalidPath() {
$this->expectException(\OCA\DAV\Connector\Sabre\Exception\InvalidPath::class);
$this->view->expects($this->once())
->method('verifyPath')
->willThrowException(new \OCP\Files\InvalidPathException());
@ -334,9 +332,10 @@ class DirectoryTest extends \Test\TestCase {
/**
* @dataProvider moveFailedProvider
* @expectedException \Sabre\DAV\Exception\Forbidden
*/
public function testMoveFailed($source, $destination, $updatables, $deletables) {
$this->expectException(\Sabre\DAV\Exception\Forbidden::class);
$this->moveTest($source, $destination, $updatables, $deletables);
}
@ -350,9 +349,10 @@ class DirectoryTest extends \Test\TestCase {
/**
* @dataProvider moveFailedInvalidCharsProvider
* @expectedException \OCA\DAV\Connector\Sabre\Exception\InvalidPath
*/
public function testMoveFailedInvalidChars($source, $destination, $updatables, $deletables) {
$this->expectException(\OCA\DAV\Connector\Sabre\Exception\InvalidPath::class);
$this->moveTest($source, $destination, $updatables, $deletables);
}
@ -403,11 +403,11 @@ class DirectoryTest extends \Test\TestCase {
$this->assertTrue($targetNode->moveInto(basename($destination), $source, $sourceNode));
}
/**
* @expectedException \Sabre\DAV\Exception\Forbidden
* @expectedExceptionMessage Could not copy directory b, target exists
*/
public function testFailingMove() {
$this->expectException(\Sabre\DAV\Exception\Forbidden::class);
$this->expectExceptionMessage('Could not copy directory b, target exists');
$source = 'a/b';
$destination = 'c/b';
$updatables = ['a' => true, 'a/b' => true, 'b' => true, 'c/b' => false];

View File

@ -41,7 +41,7 @@ class DummyGetResponsePluginTest extends TestCase {
/** @var DummyGetResponsePlugin */
private $dummyGetResponsePlugin;
public function setUp() {
protected function setUp(): void {
parent::setUp();
$this->dummyGetResponsePlugin = new DummyGetResponsePlugin();

View File

@ -44,7 +44,7 @@ class FakeLockerPluginTest extends TestCase {
/** @var FakeLockerPlugin */
private $fakeLockerPlugin;
public function setUp() {
protected function setUp(): void {
parent::setUp();
$this->fakeLockerPlugin = new FakeLockerPlugin();
}

View File

@ -62,7 +62,7 @@ class FileTest extends TestCase {
/** @var IConfig | \PHPUnit_Framework_MockObject_MockObject */
protected $config;
public function setUp() {
protected function setUp(): void {
parent::setUp();
unset($_SERVER['HTTP_OC_CHUNKED']);
unset($_SERVER['CONTENT_LENGTH']);
@ -78,7 +78,7 @@ class FileTest extends TestCase {
$this->config = $this->getMockBuilder('\OCP\IConfig')->getMock();
}
public function tearDown() {
protected function tearDown(): void {
$userManager = \OC::$server->getUserManager();
$userManager->get($this->user)->delete();
unset($_SERVER['HTTP_OC_CHUNKED']);
@ -194,7 +194,7 @@ class FileTest extends TestCase {
} else {
$storage->expects($this->once())
->method('writeStream')
->will($this->returnValue(false));
->will($this->returnValue(0));
}
$view->expects($this->any())
@ -815,9 +815,10 @@ class FileTest extends TestCase {
/**
* Test setting name with setName() with invalid chars
*
* @expectedException \OCA\DAV\Connector\Sabre\Exception\InvalidPath
*/
public function testSetNameInvalidChars() {
$this->expectException(\OCA\DAV\Connector\Sabre\Exception\InvalidPath::class);
// setup
$view = $this->getMockBuilder(View::class)
->setMethods(['getRelativePath'])
@ -834,8 +835,7 @@ class FileTest extends TestCase {
$file->setName('/super*star.txt');
}
/**
*/
public function testUploadAbort() {
// setup
$view = $this->getMockBuilder(View::class)
@ -879,9 +879,7 @@ class FileTest extends TestCase {
$this->assertEmpty($this->listPartFiles($view, ''), 'No stray part files');
}
/**
*
*/
public function testDeleteWhenAllowed() {
// setup
$view = $this->getMockBuilder(View::class)
@ -901,10 +899,10 @@ class FileTest extends TestCase {
$file->delete();
}
/**
* @expectedException \Sabre\DAV\Exception\Forbidden
*/
public function testDeleteThrowsWhenDeletionNotAllowed() {
$this->expectException(\Sabre\DAV\Exception\Forbidden::class);
// setup
$view = $this->getMockBuilder(View::class)
->getMock();
@ -919,10 +917,10 @@ class FileTest extends TestCase {
$file->delete();
}
/**
* @expectedException \Sabre\DAV\Exception\Forbidden
*/
public function testDeleteThrowsWhenDeletionFailed() {
$this->expectException(\Sabre\DAV\Exception\Forbidden::class);
// setup
$view = $this->getMockBuilder(View::class)
->getMock();
@ -942,10 +940,10 @@ class FileTest extends TestCase {
$file->delete();
}
/**
* @expectedException \OCA\DAV\Connector\Sabre\Exception\Forbidden
*/
public function testDeleteThrowsWhenDeletionThrows() {
$this->expectException(\OCA\DAV\Connector\Sabre\Exception\Forbidden::class);
// setup
$view = $this->getMockBuilder(View::class)
->getMock();
@ -1112,10 +1110,10 @@ class FileTest extends TestCase {
];
}
/**
* @expectedException \Sabre\DAV\Exception\ServiceUnavailable
*/
public function testGetFopenFails() {
$this->expectException(\Sabre\DAV\Exception\ServiceUnavailable::class);
$view = $this->getMockBuilder(View::class)
->setMethods(['fopen'])
->getMock();
@ -1132,10 +1130,10 @@ class FileTest extends TestCase {
$file->get();
}
/**
* @expectedException \OCA\DAV\Connector\Sabre\Exception\Forbidden
*/
public function testGetFopenThrows() {
$this->expectException(\OCA\DAV\Connector\Sabre\Exception\Forbidden::class);
$view = $this->getMockBuilder(View::class)
->setMethods(['fopen'])
->getMock();
@ -1152,10 +1150,10 @@ class FileTest extends TestCase {
$file->get();
}
/**
* @expectedException \Sabre\DAV\Exception\NotFound
*/
public function testGetThrowsIfNoPermission() {
$this->expectException(\Sabre\DAV\Exception\NotFound::class);
$view = $this->getMockBuilder(View::class)
->setMethods(['fopen'])
->getMock();

View File

@ -45,6 +45,7 @@ use Sabre\DAV\Server;
use Sabre\DAV\Tree;
use Sabre\HTTP\RequestInterface;
use Sabre\HTTP\ResponseInterface;
use Sabre\Xml\Service;
use Test\TestCase;
/**
@ -96,7 +97,7 @@ class FilesPluginTest extends TestCase {
*/
private $previewManager;
public function setUp() {
protected function setUp(): void {
parent::setUp();
$this->server = $this->getMockBuilder(Server::class)
->disableOriginalConstructor()
@ -126,6 +127,7 @@ class FilesPluginTest extends TestCase {
->disableOriginalConstructor()
->getMock();
$this->server->httpResponse = $response;
$this->server->xml = new Service();
$this->plugin->initialize($this->server);
}
@ -460,10 +462,11 @@ class FilesPluginTest extends TestCase {
* FolderA is an incoming shared folder and there are no delete permissions.
* Thus moving /FolderA/test.txt to /test.txt should fail already on that check
*
* @expectedException \Sabre\DAV\Exception\Forbidden
* @expectedExceptionMessage FolderA/test.txt cannot be deleted
*/
public function testMoveSrcNotDeletable() {
$this->expectException(\Sabre\DAV\Exception\Forbidden::class);
$this->expectExceptionMessage('FolderA/test.txt cannot be deleted');
$fileInfoFolderATestTXT = $this->getMockBuilder(FileInfo::class)
->disableOriginalConstructor()
->getMock();
@ -505,11 +508,11 @@ class FilesPluginTest extends TestCase {
$this->plugin->checkMove('FolderA/test.txt', 'test.txt');
}
/**
* @expectedException \Sabre\DAV\Exception\NotFound
* @expectedExceptionMessage FolderA/test.txt does not exist
*/
public function testMoveSrcNotExist() {
$this->expectException(\Sabre\DAV\Exception\NotFound::class);
$this->expectExceptionMessage('FolderA/test.txt does not exist');
$node = $this->getMockBuilder(Node::class)
->disableOriginalConstructor()
->getMock();

View File

@ -85,7 +85,7 @@ class FilesReportPluginTest extends \Test\TestCase {
/** @var IAppManager|\PHPUnit_Framework_MockObject_MockObject * */
private $appManager;
public function setUp() {
protected function setUp(): void {
parent::setUp();
$this->tree = $this->getMockBuilder(Tree::class)
->disableOriginalConstructor()
@ -603,10 +603,10 @@ class FilesReportPluginTest extends \Test\TestCase {
$this->assertEquals(['222'], array_values($this->invokePrivate($this->plugin, 'processFilterRules', [$rules])));
}
/**
* @expectedException \OCP\SystemTag\TagNotFoundException
*/
public function testProcessFilterRulesInvisibleTagAsUser() {
$this->expectException(\OCP\SystemTag\TagNotFoundException::class);
$this->groupManager->expects($this->any())
->method('isAdmin')
->will($this->returnValue(false));

View File

@ -39,18 +39,18 @@ class MaintenancePluginTest extends TestCase {
/** @var MaintenancePlugin */
private $maintenancePlugin;
public function setUp() {
protected function setUp(): void {
parent::setUp();
$this->config = $this->getMockBuilder(IConfig::class)->getMock();
$this->maintenancePlugin = new MaintenancePlugin($this->config);
}
/**
* @expectedException \Sabre\DAV\Exception\ServiceUnavailable
* @expectedExceptionMessage System in maintenance mode.
*/
public function testMaintenanceMode() {
$this->expectException(\Sabre\DAV\Exception\ServiceUnavailable::class);
$this->expectExceptionMessage('System in maintenance mode.');
$this->config
->expects($this->exactly(1))
->method('getSystemValueBool')

View File

@ -103,9 +103,10 @@ class ObjectTreeTest extends \Test\TestCase {
/**
* @dataProvider copyDataProvider
* @expectedException \Sabre\DAV\Exception\Forbidden
*/
public function testCopyFailNotCreatable($sourcePath, $targetPath, $targetParent) {
$this->expectException(\Sabre\DAV\Exception\Forbidden::class);
$view = $this->createMock(View::class);
$view->expects($this->never())
->method('verifyPath');
@ -268,10 +269,10 @@ class ObjectTreeTest extends \Test\TestCase {
);
}
/**
* @expectedException \OCA\DAV\Connector\Sabre\Exception\InvalidPath
*/
public function testGetNodeForPathInvalidPath() {
$this->expectException(\OCA\DAV\Connector\Sabre\Exception\InvalidPath::class);
$path = '/foo\bar';

View File

@ -65,7 +65,7 @@ class PrincipalTest extends TestCase {
/** @var ProxyMapper | \PHPUnit_Framework_MockObject_MockObject */
private $proxyMapper;
public function setUp() {
protected function setUp(): void {
$this->userManager = $this->createMock(IUserManager::class);
$this->groupManager = $this->createMock(IGroupManager::class);
$this->shareManager = $this->createMock(IManager::class);
@ -209,11 +209,11 @@ class PrincipalTest extends TestCase {
$this->assertSame([], $response);
}
/**
* @expectedException \Sabre\DAV\Exception
* @expectedExceptionMessage Principal not found
*/
public function testGetGroupMemberSetEmpty() {
$this->expectException(\Sabre\DAV\Exception::class);
$this->expectExceptionMessage('Principal not found');
$this->userManager
->expects($this->once())
->method('get')
@ -334,11 +334,11 @@ class PrincipalTest extends TestCase {
$this->assertSame($expectedResponse, $response);
}
/**
* @expectedException \Sabre\DAV\Exception
* @expectedExceptionMessage Principal not found
*/
public function testGetGroupMembershipEmpty() {
$this->expectException(\Sabre\DAV\Exception::class);
$this->expectExceptionMessage('Principal not found');
$this->userManager
->expects($this->once())
->method('get')
@ -348,11 +348,11 @@ class PrincipalTest extends TestCase {
$this->connector->getGroupMembership('principals/users/foo');
}
/**
* @expectedException \Sabre\DAV\Exception
* @expectedExceptionMessage Setting members of the group is not supported yet
*/
public function testSetGroupMembership() {
$this->expectException(\Sabre\DAV\Exception::class);
$this->expectExceptionMessage('Setting members of the group is not supported yet');
$this->connector->setGroupMemberSet('principals/users/foo', ['foo']);
}

View File

@ -85,10 +85,11 @@ class QuotaPluginTest extends TestCase {
}
/**
* @expectedException \Sabre\DAV\Exception\InsufficientStorage
* @dataProvider quotaExceededProvider
*/
public function testCheckExceededQuota($quota, $headers) {
$this->expectException(\Sabre\DAV\Exception\InsufficientStorage::class);
$this->init($quota);
$this->plugin->expects($this->never())
->method('getFileChunking');
@ -209,9 +210,10 @@ class QuotaPluginTest extends TestCase {
/**
* @dataProvider quotaChunkedFailProvider
* @expectedException \Sabre\DAV\Exception\InsufficientStorage
*/
public function testCheckQuotaChunkedFail($quota, $chunkTotalSize, $headers) {
$this->expectException(\Sabre\DAV\Exception\InsufficientStorage::class);
$this->init($quota, 'sub/test.txt');
$mockChunking = $this->getMockBuilder(\OC_FileChunking::class)

View File

@ -35,7 +35,7 @@ use OCP\IConfig;
* @package OCA\DAV\Tests\unit\Connector\Sabre\RequestTest
*/
class PartFileInRootUploadTest extends UploadTest {
protected function setUp() {
protected function setUp(): void {
$config = \OC::$server->getConfig();
$mockConfig = $this->getMockBuilder(IConfig::class)
->disableOriginalConstructor()
@ -53,8 +53,8 @@ class PartFileInRootUploadTest extends UploadTest {
parent::setUp();
}
protected function tearDown() {
protected function tearDown(): void {
$this->restoreService('AllConfig');
return parent::tearDown();
parent::tearDown();
}
}

View File

@ -52,7 +52,7 @@ abstract class RequestTestCase extends TestCase {
return $stream;
}
protected function setUp() {
protected function setUp(): void {
parent::setUp();
unset($_SERVER['HTTP_OC_CHUNKED']);

View File

@ -66,7 +66,7 @@ class SharesPluginTest extends \Test\TestCase {
*/
private $plugin;
public function setUp() {
protected function setUp(): void {
parent::setUp();
$this->server = new \Sabre\DAV\Server();
$this->tree = $this->createMock(Tree::class);

View File

@ -70,7 +70,7 @@ class TagsPluginTest extends \Test\TestCase {
*/
private $plugin;
public function setUp() {
protected function setUp(): void {
parent::setUp();
$this->server = new \Sabre\DAV\Server();
$this->tree = $this->getMockBuilder(Tree::class)

View File

@ -57,7 +57,7 @@ class BirthdayCalendarControllerTest extends TestCase {
/** @var BirthdayCalendarController|\PHPUnit_Framework_MockObject_MockObject */
private $controller;
public function setUp() {
protected function setUp(): void {
parent::setUp();
$this->config = $this->createMock(IConfig::class);

View File

@ -59,7 +59,7 @@ class DirectControllerTest extends TestCase {
/** @var DirectController */
private $controller;
public function setUp() {
protected function setUp(): void {
parent::setUp();
$this->rootFolder = $this->createMock(IRootFolder::class);

View File

@ -52,7 +52,7 @@ class InvitationResponseControllerTest extends TestCase {
/** @var InvitationResponseServer|\PHPUnit_Framework_MockObject_MockObject */
private $responseServer;
public function setUp() {
protected function setUp(): void {
parent::setUp();
$this->dbConnection = $this->createMock(IDBConnection::class);

View File

@ -45,7 +45,7 @@ class CustomPropertiesBackendTest extends TestCase {
/** @var CustomPropertiesBackend | \PHPUnit_Framework_MockObject_MockObject */
private $backend;
public function setUp() {
protected function setUp(): void {
parent::setUp();
$this->tree = $this->createMock(Tree::class);

View File

@ -49,7 +49,7 @@ class GroupPrincipalTest extends \Test\TestCase {
/** @var GroupPrincipalBackend */
private $connector;
public function setUp() {
protected function setUp(): void {
$this->groupManager = $this->createMock(IGroupManager::class);
$this->userSession = $this->createMock(IUserSession::class);
$this->shareManager = $this->createMock(IManager::class);
@ -174,11 +174,11 @@ class GroupPrincipalTest extends \Test\TestCase {
$this->assertSame([], $response);
}
/**
* @expectedException \Sabre\DAV\Exception
* @expectedExceptionMessage Setting members of the group is not supported yet
*/
public function testSetGroupMembership() {
$this->expectException(\Sabre\DAV\Exception::class);
$this->expectExceptionMessage('Setting members of the group is not supported yet');
$this->connector->setGroupMemberSet('principals/groups/foo', ['foo']);
}

View File

@ -46,7 +46,7 @@ class HookManagerTest extends TestCase {
/** @var EventDispatcherInterface | \PHPUnit_Framework_MockObject_MockObject */
private $eventDispatcher;
public function setUp() {
protected function setUp(): void {
parent::setUp();
$this->eventDispatcher = $this->createMock(EventDispatcherInterface::class);
$this->l10n = $this->createMock(IL10N::class);

View File

@ -44,7 +44,7 @@ class PluginTest extends TestCase {
/** @var IShareable | \PHPUnit_Framework_MockObject_MockObject */
private $book;
public function setUp() {
protected function setUp(): void {
parent::setUp();
/** @var Auth | \PHPUnit_Framework_MockObject_MockObject $authBackend */

View File

@ -80,13 +80,14 @@ class SystemPrincipalBackendTest extends TestCase {
/**
* @dataProvider providesPrincipalForGetGroupMemberSet
* @expectedException \Sabre\DAV\Exception
* @expectedExceptionMessage Principal not found
*
* @param string $principal
* @throws \Sabre\DAV\Exception
*/
public function testGetGroupMemberSetExceptional($principal) {
$this->expectException(\Sabre\DAV\Exception::class);
$this->expectExceptionMessage('Principal not found');
$backend = new SystemPrincipalBackend();
$backend->getGroupMemberSet($principal);
}
@ -109,13 +110,14 @@ class SystemPrincipalBackendTest extends TestCase {
/**
* @dataProvider providesPrincipalForGetGroupMembership
* @expectedException \Sabre\DAV\Exception
* @expectedExceptionMessage Principal not found
*
* @param string $principal
* @throws \Sabre\DAV\Exception
*/
public function testGetGroupMembershipExceptional($principal) {
$this->expectException(\Sabre\DAV\Exception::class);
$this->expectExceptionMessage('Principal not found');
$backend = new SystemPrincipalBackend();
$backend->getGroupMembership($principal);
}

View File

@ -49,7 +49,7 @@ class DirectFileTest extends TestCase {
/** @var DirectFile */
private $directFile;
public function setUp() {
protected function setUp(): void {
parent::setUp();
$this->direct = Direct::fromParams([

View File

@ -58,7 +58,7 @@ class DirectHomeTest extends TestCase {
/** @var DirectHome */
private $directHome;
public function setUp() {
protected function setUp(): void {
parent::setUp();
$this->directMapper = $this->createMock(DirectMapper::class);

View File

@ -72,7 +72,7 @@ class FileSearchBackendTest extends TestCase {
/** @var Directory|\PHPUnit_Framework_MockObject_MockObject */
private $davFolder;
protected function setUp() {
protected function setUp(): void {
parent::setUp();
$this->user = $this->createMock(IUser::class);
@ -258,10 +258,10 @@ class FileSearchBackendTest extends TestCase {
$this->assertEquals('/files/test/test/path', $result[0]->href);
}
/**
* @expectedException \InvalidArgumentException
*/
public function testSearchInvalidProp() {
$this->expectException(\InvalidArgumentException::class);
$this->tree->expects($this->any())
->method('getNodeForPath')
->willReturn($this->davFolder);
@ -295,10 +295,10 @@ class FileSearchBackendTest extends TestCase {
return new Query($select, $from, $where, $orderBy, $limit);
}
/**
* @expectedException \InvalidArgumentException
*/
public function testSearchNonFolder() {
$this->expectException(\InvalidArgumentException::class);
$davNode = $this->createMock(File::class);
$this->tree->expects($this->any())

Some files were not shown because too many files have changed in this diff Show More