Browse Source

Mode to modern phpunit

Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
Roeland Jago Douma 4 years ago
parent
commit
3a7cf40aaa
100 changed files with 551 additions and 546 deletions
  1. 1 1
      apps/admin_audit/tests/Actions/SecurityTest.php
  2. 1 1
      apps/comments/tests/Unit/Collaboration/CommentersSorterTest.php
  3. 1 1
      apps/comments/tests/Unit/JSSettingsHelperTest.php
  4. 15 15
      apps/comments/tests/Unit/Notification/NotifierTest.php
  5. 1 3
      apps/dav/lib/CalDAV/CachedSubscription.php
  6. 1 3
      apps/dav/lib/CalDAV/CalendarHome.php
  7. 3 2
      apps/dav/tests/unit/Avatars/AvatarHomeTest.php
  8. 2 2
      apps/dav/tests/unit/CalDAV/AbstractCalDavBackend.php
  9. 6 6
      apps/dav/tests/unit/CalDAV/Activity/Filter/GenericTest.php
  10. 2 1
      apps/dav/tests/unit/CalDAV/Activity/Provider/BaseTest.php
  11. 7 7
      apps/dav/tests/unit/CalDAV/Activity/Setting/GenericTest.php
  12. 1 1
      apps/dav/tests/unit/CalDAV/BirthdayCalendar/EnablePluginTest.php
  13. 8 8
      apps/dav/tests/unit/CalDAV/CachedSubscriptionObjectTest.php
  14. 8 8
      apps/dav/tests/unit/CalDAV/CachedSubscriptionTest.php
  15. 4 4
      apps/dav/tests/unit/CalDAV/CalDavBackendTest.php
  16. 4 4
      apps/dav/tests/unit/CalDAV/CalendarHomeTest.php
  17. 4 4
      apps/dav/tests/unit/CalDAV/CalendarTest.php
  18. 1 1
      apps/dav/tests/unit/CalDAV/PluginTest.php
  19. 2 2
      apps/dav/tests/unit/CalDAV/PublicCalendarRootTest.php
  20. 1 1
      apps/dav/tests/unit/CalDAV/Publishing/PublishingTest.php
  21. 1 1
      apps/dav/tests/unit/CalDAV/Reminder/BackendTest.php
  22. 1 1
      apps/dav/tests/unit/CalDAV/Reminder/NotificationProvider/AbstractNotificationProviderTest.php
  23. 1 1
      apps/dav/tests/unit/CalDAV/Reminder/NotificationProvider/EmailProviderTest.php
  24. 1 1
      apps/dav/tests/unit/CalDAV/Reminder/NotificationProvider/PushProviderTest.php
  25. 10 7
      apps/dav/tests/unit/CalDAV/Reminder/NotificationProviderManagerTest.php
  26. 8 8
      apps/dav/tests/unit/CalDAV/Reminder/NotifierTest.php
  27. 1 1
      apps/dav/tests/unit/CalDAV/Reminder/ReminderServiceTest.php
  28. 1 1
      apps/dav/tests/unit/CalDAV/ResourceBooking/AbstractPrincipalBackendTest.php
  29. 1 1
      apps/dav/tests/unit/CalDAV/ResourceBooking/ResourcePrincipalBackendTest.php
  30. 1 1
      apps/dav/tests/unit/CalDAV/ResourceBooking/RoomPrincipalBackendTest.php
  31. 1 1
      apps/dav/tests/unit/CalDAV/Schedule/IMipPluginTest.php
  32. 1 1
      apps/dav/tests/unit/CalDAV/Schedule/PluginTest.php
  33. 16 16
      apps/dav/tests/unit/CalDAV/Search/Request/CalendarSearchReportTest.php
  34. 1 1
      apps/dav/tests/unit/CalDAV/Search/SearchPluginTest.php
  35. 1 1
      apps/dav/tests/unit/CardDAV/AddressBookImplTest.php
  36. 6 6
      apps/dav/tests/unit/CardDAV/AddressBookTest.php
  37. 1 1
      apps/dav/tests/unit/CardDAV/BirthdayServiceTest.php
  38. 8 8
      apps/dav/tests/unit/CardDAV/CardDavBackendTest.php
  39. 1 1
      apps/dav/tests/unit/CardDAV/ConverterTest.php
  40. 1 1
      apps/dav/tests/unit/CardDAV/ImageExportPluginTest.php
  41. 1 1
      apps/dav/tests/unit/CardDAV/Sharing/PluginTest.php
  42. 3 3
      apps/dav/tests/unit/Command/ListCalendarsTest.php
  43. 10 9
      apps/dav/tests/unit/Command/MoveCalendarTest.php
  44. 1 1
      apps/dav/tests/unit/Command/RemoveInvalidSharesTest.php
  45. 24 24
      apps/dav/tests/unit/Comments/CommentsNodeTest.php
  46. 23 23
      apps/dav/tests/unit/Comments/CommentsPluginTest.php
  47. 4 4
      apps/dav/tests/unit/Comments/EntityCollectionTest.php
  48. 7 7
      apps/dav/tests/unit/Comments/EntityTypeCollectionTest.php
  49. 25 25
      apps/dav/tests/unit/Comments/RootCollectionTest.php
  50. 16 16
      apps/dav/tests/unit/Connector/Sabre/AuthTest.php
  51. 1 1
      apps/dav/tests/unit/Connector/Sabre/BearerAuthTest.php
  52. 4 3
      apps/dav/tests/unit/Connector/Sabre/BlockLegacyClientPluginTest.php
  53. 1 1
      apps/dav/tests/unit/Connector/Sabre/CommentsPropertiesPluginTest.php
  54. 1 1
      apps/dav/tests/unit/Connector/Sabre/CopyEtagHeaderPluginTest.php
  55. 2 2
      apps/dav/tests/unit/Connector/Sabre/CustomPropertiesBackendTest.php
  56. 33 33
      apps/dav/tests/unit/Connector/Sabre/DirectoryTest.php
  57. 1 1
      apps/dav/tests/unit/Connector/Sabre/DummyGetResponsePluginTest.php
  58. 1 1
      apps/dav/tests/unit/Connector/Sabre/FakeLockerPluginTest.php
  59. 24 26
      apps/dav/tests/unit/Connector/Sabre/FileTest.php
  60. 8 7
      apps/dav/tests/unit/Connector/Sabre/FilesPluginTest.php
  61. 4 4
      apps/dav/tests/unit/Connector/Sabre/FilesReportPluginTest.php
  62. 5 5
      apps/dav/tests/unit/Connector/Sabre/MaintenancePluginTest.php
  63. 5 4
      apps/dav/tests/unit/Connector/Sabre/ObjectTreeTest.php
  64. 13 13
      apps/dav/tests/unit/Connector/Sabre/PrincipalTest.php
  65. 4 2
      apps/dav/tests/unit/Connector/Sabre/QuotaPluginTest.php
  66. 1 1
      apps/dav/tests/unit/Connector/Sabre/SharesPluginTest.php
  67. 1 1
      apps/dav/tests/unit/Connector/Sabre/TagsPluginTest.php
  68. 1 1
      apps/dav/tests/unit/Controller/BirthdayCalendarControllerTest.php
  69. 1 1
      apps/dav/tests/unit/Controller/DirectControllerTest.php
  70. 1 1
      apps/dav/tests/unit/Controller/InvitationResponseControllerTest.php
  71. 1 1
      apps/dav/tests/unit/DAV/CustomPropertiesBackendTest.php
  72. 5 5
      apps/dav/tests/unit/DAV/GroupPrincipalTest.php
  73. 1 1
      apps/dav/tests/unit/DAV/HookManagerTest.php
  74. 1 1
      apps/dav/tests/unit/DAV/Sharing/PluginTest.php
  75. 6 4
      apps/dav/tests/unit/DAV/SystemPrincipalBackendTest.php
  76. 1 1
      apps/dav/tests/unit/Direct/DirectFileTest.php
  77. 1 1
      apps/dav/tests/unit/Direct/DirectHomeTest.php
  78. 6 6
      apps/dav/tests/unit/Files/FileSearchBackendTest.php
  79. 1 1
      apps/dav/tests/unit/Files/Sharing/FilesDropPluginTest.php
  80. 1 1
      apps/dav/tests/unit/Migration/CalDAVRemoveEmptyValueTest.php
  81. 13 13
      apps/dav/tests/unit/Provisioning/Apple/AppleProvisioningNodeTest.php
  82. 1 1
      apps/dav/tests/unit/Provisioning/Apple/AppleProvisioningPluginTest.php
  83. 1 1
      apps/dav/tests/unit/Settings/CalDAVSettingsTest.php
  84. 3 3
      apps/dav/tests/unit/SystemTag/SystemTagMappingNodeTest.php
  85. 12 12
      apps/dav/tests/unit/SystemTag/SystemTagNodeTest.php
  86. 15 13
      apps/dav/tests/unit/SystemTag/SystemTagPluginTest.php
  87. 18 18
      apps/dav/tests/unit/SystemTag/SystemTagsByIdCollectionTest.php
  88. 27 27
      apps/dav/tests/unit/SystemTag/SystemTagsObjectMappingCollectionTest.php
  89. 18 18
      apps/dav/tests/unit/SystemTag/SystemTagsObjectTypeCollectionTest.php
  90. 5 5
      apps/dav/tests/unit/Upload/ChunkingPluginTest.php
  91. 6 6
      apps/dav/tests/unit/Upload/FutureFileTest.php
  92. 1 1
      apps/encryption/tests/Command/TestEnableMasterKey.php
  93. 7 4
      apps/encryption/tests/Crypto/CryptTest.php
  94. 1 1
      apps/encryption/tests/Crypto/DecryptAllTest.php
  95. 1 1
      apps/encryption/tests/Crypto/EncryptAllTest.php
  96. 7 6
      apps/encryption/tests/Crypto/EncryptionTest.php
  97. 3 9
      apps/encryption/tests/HookManagerTest.php
  98. 10 10
      apps/encryption/tests/KeyManagerTest.php
  99. 15 17
      apps/encryption/tests/SessionTest.php
  100. 1 1
      apps/encryption/tests/Settings/AdminTest.php

+ 1 - 1
apps/admin_audit/tests/Actions/SecurityTest.php

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

+ 1 - 1
apps/comments/tests/Unit/Collaboration/CommentersSorterTest.php

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

+ 1 - 1
apps/comments/tests/Unit/JSSettingsHelperTest.php

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

+ 15 - 15
apps/comments/tests/Unit/Notification/NotifierTest.php

@@ -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 */

+ 1 - 3
apps/dav/lib/CalDAV/CachedSubscription.php

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

+ 1 - 3
apps/dav/lib/CalDAV/CalendarHome.php

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

+ 3 - 2
apps/dav/tests/unit/Avatars/AvatarHomeTest.php

@@ -40,17 +40,18 @@ class AvatarHomeTest extends TestCase {
 	/** @var IAvatarManager | \PHPUnit_Framework_MockObject_MockObject */
 	private $avatarManager;
 
-	public function setUp(): void {
+	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('');
 	}
 

+ 2 - 2
apps/dav/tests/unit/CalDAV/AbstractCalDavBackend.php

@@ -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(): void {
+	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(): void {
+	protected function tearDown(): void {
 		$this->cleanUpBackend();
 		parent::tearDown();
 	}

+ 6 - 6
apps/dav/tests/unit/CalDAV/Activity/Filter/GenericTest.php

@@ -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());
 	}
 }

+ 2 - 1
apps/dav/tests/unit/CalDAV/Activity/Provider/BaseTest.php

@@ -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]);
 	}
 

+ 7 - 7
apps/dav/tests/unit/CalDAV/Activity/Setting/GenericTest.php

@@ -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());
 	}
 }

+ 1 - 1
apps/dav/tests/unit/CalDAV/BirthdayCalendar/EnablePluginTest.php

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

+ 8 - 8
apps/dav/tests/unit/CalDAV/CachedSubscriptionObjectTest.php

@@ -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',

+ 8 - 8
apps/dav/tests/unit/CalDAV/CachedSubscriptionTest.php

@@ -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',

+ 4 - 4
apps/dav/tests/unit/CalDAV/CalDavBackendTest.php

@@ -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'

+ 4 - 4
apps/dav/tests/unit/CalDAV/CalendarHomeTest.php

@@ -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);
 

+ 4 - 4
apps/dav/tests/unit/CalDAV/CalendarTest.php

@@ -43,7 +43,7 @@ class CalendarTest extends TestCase {
 	/** @var IConfig */
 	protected $config;
 
-	public function setUp(): void {
+	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');

+ 1 - 1
apps/dav/tests/unit/CalDAV/PluginTest.php

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

+ 2 - 2
apps/dav/tests/unit/CalDAV/PublicCalendarRootTest.php

@@ -72,7 +72,7 @@ class PublicCalendarRootTest extends TestCase {
 	/** @var ILogger */
 	private $logger;
 
-	public function setUp(): void {
+	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(): void {
+	protected function tearDown(): void {
 		parent::tearDown();
 
 		if (is_null($this->backend)) {

+ 1 - 1
apps/dav/tests/unit/CalDAV/Publishing/PublishingTest.php

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

+ 1 - 1
apps/dav/tests/unit/CalDAV/Reminder/BackendTest.php

@@ -42,7 +42,7 @@ class BackendTest extends TestCase {
 	/** @var ITimeFactory|\PHPUnit\Framework\MockObject\MockObject */
 	private $timeFactory;
 
-	public function setUp(): void {
+	protected function setUp(): void {
 		parent::setUp();
 
 		$query = self::$realDatabase->getQueryBuilder();

+ 1 - 1
apps/dav/tests/unit/CalDAV/Reminder/NotificationProvider/AbstractNotificationProviderTest.php

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

+ 1 - 1
apps/dav/tests/unit/CalDAV/Reminder/NotificationProvider/EmailProviderTest.php

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

+ 1 - 1
apps/dav/tests/unit/CalDAV/Reminder/NotificationProvider/PushProviderTest.php

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

+ 10 - 7
apps/dav/tests/unit/CalDAV/Reminder/NotificationProviderManagerTest.php

@@ -41,7 +41,7 @@ class NotificationProviderManagerTest extends TestCase {
 	/**
 	 * @throws \OCP\AppFramework\QueryException
 	 */
-	public function setUp(): void {
+	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);
 	}
 

+ 8 - 8
apps/dav/tests/unit/CalDAV/Reminder/NotifierTest.php

@@ -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);
 

+ 1 - 1
apps/dav/tests/unit/CalDAV/Reminder/ReminderServiceTest.php

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

+ 1 - 1
apps/dav/tests/unit/CalDAV/ResourceBooking/AbstractPrincipalBackendTest.php

@@ -64,7 +64,7 @@ abstract class AbstractPrincipalBackendTest extends TestCase {
 	/** @var string */
 	protected $expectedCUType;
 
-	public function setUp(): void {
+	protected function setUp(): void {
 		parent::setUp();
 
 		$this->userSession = $this->createMock(IUserSession::class);

+ 1 - 1
apps/dav/tests/unit/CalDAV/ResourceBooking/ResourcePrincipalBackendTest.php

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

+ 1 - 1
apps/dav/tests/unit/CalDAV/ResourceBooking/RoomPrincipalBackendTest.php

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

+ 1 - 1
apps/dav/tests/unit/CalDAV/Schedule/IMipPluginTest.php

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

+ 1 - 1
apps/dav/tests/unit/CalDAV/Schedule/PluginTest.php

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

+ 16 - 16
apps/dav/tests/unit/CalDAV/Search/Request/CalendarSearchReportTest.php

@@ -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:">

+ 1 - 1
apps/dav/tests/unit/CalDAV/Search/SearchPluginTest.php

@@ -36,7 +36,7 @@ class SearchPluginTest extends TestCase {
 	/** @var \OCA\DAV\CalDAV\Search\SearchPlugin $plugin */
 	protected $plugin;
 
-	public function setUp(): void {
+	protected function setUp(): void {
 		parent::setUp();
 
 		$this->server = $this->createMock(\Sabre\DAV\Server::class);

+ 1 - 1
apps/dav/tests/unit/CardDAV/AddressBookImplTest.php

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

+ 6 - 6
apps/dav/tests/unit/CardDAV/AddressBookTest.php

@@ -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 = [

+ 1 - 1
apps/dav/tests/unit/CardDAV/BirthdayServiceTest.php

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

+ 8 - 8
apps/dav/tests/unit/CardDAV/CardDavBackendTest.php

@@ -121,7 +121,7 @@ class CardDavBackendTest extends TestCase {
 						'N:TestNoUID;;;;'.PHP_EOL.
 						'END:VCARD';
 
-	public function setUp(): void {
+	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(): void {
+	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);
 	}
 

+ 1 - 1
apps/dav/tests/unit/CardDAV/ConverterTest.php

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

+ 1 - 1
apps/dav/tests/unit/CardDAV/ImageExportPluginTest.php

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

+ 1 - 1
apps/dav/tests/unit/CardDAV/Sharing/PluginTest.php

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

+ 3 - 3
apps/dav/tests/unit/Command/ListCalendarsTest.php

@@ -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)

+ 10 - 9
apps/dav/tests/unit/Command/MoveCalendarTest.php

@@ -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')

+ 1 - 1
apps/dav/tests/unit/Command/RemoveInvalidSharesTest.php

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

+ 24 - 24
apps/dav/tests/unit/Comments/CommentsNodeTest.php

@@ -47,7 +47,7 @@ class CommentsNodeTest extends \Test\TestCase {
 	protected $logger;
 	protected $userSession;
 
-	public function setUp(): void {
+	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())

+ 23 - 23
apps/dav/tests/unit/Comments/CommentsPluginTest.php

@@ -54,7 +54,7 @@ class CommentsPluginTest extends \Test\TestCase {
 	/** @var CommentsPluginImplementation */
 	private $plugin;
 
-	public function setUp(): void {
+	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())

+ 4 - 4
apps/dav/tests/unit/Comments/EntityCollectionTest.php

@@ -45,7 +45,7 @@ class EntityCollectionTest extends \Test\TestCase {
 	/** @var IUserSession|\PHPUnit_Framework_MockObject_MockObject */
 	protected $userSession;
 
-	public function setUp(): void {
+	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')

+ 7 - 7
apps/dav/tests/unit/Comments/EntityTypeCollectionTest.php

@@ -46,7 +46,7 @@ class EntityTypeCollectionTest extends \Test\TestCase {
 
 	protected $childMap = [];
 
-	public function setUp(): void {
+	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();
 	}
 }

+ 25 - 25
apps/dav/tests/unit/Comments/RootCollectionTest.php

@@ -53,7 +53,7 @@ class RootCollectionTest extends \Test\TestCase {
 	/** @var \OCP\IUser|\PHPUnit_Framework_MockObject_MockObject */
 	protected $user;
 
-	public function setUp(): void {
+	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');
 	}
 

+ 16 - 16
apps/dav/tests/unit/Connector/Sabre/AuthTest.php

@@ -60,7 +60,7 @@ class AuthTest extends TestCase {
 	/** @var Throttler */
 	private $throttler;
 
-	public function setUp(): void {
+	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()

+ 1 - 1
apps/dav/tests/unit/Connector/Sabre/BearerAuthTest.php

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

+ 4 - 3
apps/dav/tests/unit/Connector/Sabre/BlockLegacyClientPluginTest.php

@@ -42,7 +42,7 @@ class BlockLegacyClientPluginTest extends TestCase {
 	/** @var BlockLegacyClientPlugin */
 	private $blockLegacyClientVersionPlugin;
 
-	public function setUp(): void {
+	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

+ 1 - 1
apps/dav/tests/unit/Connector/Sabre/CommentsPropertiesPluginTest.php

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

+ 1 - 1
apps/dav/tests/unit/Connector/Sabre/CopyEtagHeaderPluginTest.php

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

+ 2 - 2
apps/dav/tests/unit/Connector/Sabre/CustomPropertiesBackendTest.php

@@ -67,7 +67,7 @@ class CustomPropertiesBackendTest extends \Test\TestCase {
 	 */
 	private $user;
 
-	public function setUp(): void {
+	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(): void {
+	protected function tearDown(): void {
 		$connection = \OC::$server->getDatabaseConnection();
 		$deleteStatement = $connection->prepare(
 			'DELETE FROM `*PREFIX*properties`' .

+ 33 - 33
apps/dav/tests/unit/Connector/Sabre/DirectoryTest.php

@@ -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];

+ 1 - 1
apps/dav/tests/unit/Connector/Sabre/DummyGetResponsePluginTest.php

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

+ 1 - 1
apps/dav/tests/unit/Connector/Sabre/FakeLockerPluginTest.php

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

+ 24 - 26
apps/dav/tests/unit/Connector/Sabre/FileTest.php

@@ -62,7 +62,7 @@ class FileTest extends TestCase {
 	/** @var IConfig | \PHPUnit_Framework_MockObject_MockObject */
 	protected $config;
 
-	public function setUp(): void {
+	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(): void {
+	protected function tearDown(): void {
 		$userManager = \OC::$server->getUserManager();
 		$userManager->get($this->user)->delete();
 		unset($_SERVER['HTTP_OC_CHUNKED']);
@@ -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();

+ 8 - 7
apps/dav/tests/unit/Connector/Sabre/FilesPluginTest.php

@@ -97,7 +97,7 @@ class FilesPluginTest extends TestCase {
 	 */
 	private $previewManager;
 
-	public function setUp(): void {
+	protected function setUp(): void {
 		parent::setUp();
 		$this->server = $this->getMockBuilder(Server::class)
 			->disableOriginalConstructor()
@@ -462,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();
@@ -507,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();

+ 4 - 4
apps/dav/tests/unit/Connector/Sabre/FilesReportPluginTest.php

@@ -85,7 +85,7 @@ class FilesReportPluginTest extends \Test\TestCase {
 	/** @var IAppManager|\PHPUnit_Framework_MockObject_MockObject * */
 	private $appManager;
 
-	public function setUp(): void {
+	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));

+ 5 - 5
apps/dav/tests/unit/Connector/Sabre/MaintenancePluginTest.php

@@ -39,18 +39,18 @@ class MaintenancePluginTest extends TestCase {
 	/** @var MaintenancePlugin */
 	private $maintenancePlugin;
 
-	public function setUp(): void {
+	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')

+ 5 - 4
apps/dav/tests/unit/Connector/Sabre/ObjectTreeTest.php

@@ -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';
 
 

+ 13 - 13
apps/dav/tests/unit/Connector/Sabre/PrincipalTest.php

@@ -65,7 +65,7 @@ class PrincipalTest extends TestCase {
 	/** @var ProxyMapper | \PHPUnit_Framework_MockObject_MockObject */
 	private $proxyMapper;
 
-	public function setUp(): void {
+	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']);
 	}
 

+ 4 - 2
apps/dav/tests/unit/Connector/Sabre/QuotaPluginTest.php

@@ -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)

+ 1 - 1
apps/dav/tests/unit/Connector/Sabre/SharesPluginTest.php

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

+ 1 - 1
apps/dav/tests/unit/Connector/Sabre/TagsPluginTest.php

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

+ 1 - 1
apps/dav/tests/unit/Controller/BirthdayCalendarControllerTest.php

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

+ 1 - 1
apps/dav/tests/unit/Controller/DirectControllerTest.php

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

+ 1 - 1
apps/dav/tests/unit/Controller/InvitationResponseControllerTest.php

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

+ 1 - 1
apps/dav/tests/unit/DAV/CustomPropertiesBackendTest.php

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

+ 5 - 5
apps/dav/tests/unit/DAV/GroupPrincipalTest.php

@@ -49,7 +49,7 @@ class GroupPrincipalTest extends \Test\TestCase {
 	/** @var GroupPrincipalBackend */
 	private $connector;
 
-	public function setUp(): void {
+	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']);
 	}
 

+ 1 - 1
apps/dav/tests/unit/DAV/HookManagerTest.php

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

+ 1 - 1
apps/dav/tests/unit/DAV/Sharing/PluginTest.php

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

+ 6 - 4
apps/dav/tests/unit/DAV/SystemPrincipalBackendTest.php

@@ -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);
 	}

+ 1 - 1
apps/dav/tests/unit/Direct/DirectFileTest.php

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

+ 1 - 1
apps/dav/tests/unit/Direct/DirectHomeTest.php

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

+ 6 - 6
apps/dav/tests/unit/Files/FileSearchBackendTest.php

@@ -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())

+ 1 - 1
apps/dav/tests/unit/Files/Sharing/FilesDropPluginTest.php

@@ -48,7 +48,7 @@ class FilesDropPluginTest extends TestCase {
 	/** @var ResponseInterface|\PHPUnit_Framework_MockObject_MockObject */
 	private $response;
 
-	public function setUp(): void {
+	protected function setUp(): void {
 		parent::setUp();
 
 		$this->view = $this->createMock(View::class);

+ 1 - 1
apps/dav/tests/unit/Migration/CalDAVRemoveEmptyValueTest.php

@@ -89,7 +89,7 @@ CREATED:20151214T091032Z
 END:VEVENT
 END:VCALENDAR';
 
-	public function setUp(): void {
+	protected function setUp(): void {
 		parent::setUp();
 
 		$this->logger = $this->createMock(ILogger::class);

+ 13 - 13
apps/dav/tests/unit/Provisioning/Apple/AppleProvisioningNodeTest.php

@@ -34,7 +34,7 @@ class AppleProvisioningNodeTest extends TestCase {
 	/** @var AppleProvisioningNode */
 	private $node;
 
-	public function setUp(): void {
+	protected function setUp(): void {
 		parent::setUp();
 
 		$this->timeFactory = $this->createMock(ITimeFactory::class);
@@ -45,11 +45,11 @@ class AppleProvisioningNodeTest extends TestCase {
 		$this->assertEquals('apple-provisioning.mobileconfig', $this->node->getName());
 	}
 
-	/**
-	 * @expectedException \Sabre\DAV\Exception\Forbidden
-	 * @expectedExceptionMessage Renaming apple-provisioning.mobileconfig is forbidden
-	 */
+	
 	public function testSetName() {
+		$this->expectException(\Sabre\DAV\Exception\Forbidden::class);
+		$this->expectExceptionMessage('Renaming apple-provisioning.mobileconfig is forbidden');
+
 		$this->node->setName('foo');
 	}
 
@@ -57,11 +57,11 @@ class AppleProvisioningNodeTest extends TestCase {
 		$this->assertEquals(null, $this->node->getLastModified());
 	}
 
-	/**
-	 * @expectedException \Sabre\DAV\Exception\Forbidden
-	 * @expectedExceptionMessage apple-provisioning.mobileconfig may not be deleted
-	 */
+	
 	public function testDelete() {
+		$this->expectException(\Sabre\DAV\Exception\Forbidden::class);
+		$this->expectExceptionMessage('apple-provisioning.mobileconfig may not be deleted');
+
 		$this->node->delete();
 	}
 
@@ -76,11 +76,11 @@ class AppleProvisioningNodeTest extends TestCase {
 		], $this->node->getProperties([]));
 	}
 
-	/**
-	 * @expectedException \Sabre\DAV\Exception\Forbidden
-	 * @expectedExceptionMessage apple-provisioning.mobileconfig's properties may not be altered.
-	 */
+	
 	public function testGetPropPatch() {
+		$this->expectException(\Sabre\DAV\Exception\Forbidden::class);
+		$this->expectExceptionMessage('apple-provisioning.mobileconfig\'s properties may not be altered.');
+
 		$propPatch = $this->createMock(PropPatch::class);
 
 		$this->node->propPatch($propPatch);

+ 1 - 1
apps/dav/tests/unit/Provisioning/Apple/AppleProvisioningPluginTest.php

@@ -59,7 +59,7 @@ class AppleProvisioningPluginTest extends TestCase {
 	/** @var AppleProvisioningPlugin */
 	protected $plugin;
 
-	public function setUp(): void {
+	protected function setUp(): void {
 		parent::setUp();
 
 		$this->server = $this->createMock(\Sabre\DAV\Server::class);

+ 1 - 1
apps/dav/tests/unit/Settings/CalDAVSettingsTest.php

@@ -35,7 +35,7 @@ class CalDAVSettingsTest extends TestCase {
 	/** @var CalDAVSettings */
 	private $settings;
 
-	public function setUp(): void {
+	protected function setUp(): void {
 		parent::setUp();
 
 		$this->config = $this->createMock(IConfig::class);

+ 3 - 3
apps/dav/tests/unit/SystemTag/SystemTagMappingNodeTest.php

@@ -144,10 +144,10 @@ class SystemTagMappingNodeTest extends \Test\TestCase {
 		$this->assertInstanceOf($expectedException, $thrown);
 	}
 
-	/**
-	 * @expectedException \Sabre\DAV\Exception\NotFound
-	 */
+	
 	public function testDeleteTagNotFound() {
+		$this->expectException(\Sabre\DAV\Exception\NotFound::class);
+
 		// assuming the tag existed at the time the node was created,
 		// but got deleted concurrently in the database
 		$tag = new SystemTag(1, 'Test', true, true);

+ 12 - 12
apps/dav/tests/unit/SystemTag/SystemTagNodeTest.php

@@ -81,10 +81,10 @@ class SystemTagNodeTest extends \Test\TestCase {
 		$this->assertEquals($tag, $node->getSystemTag());
 	}
 
-	/**
-	 * @expectedException \Sabre\DAV\Exception\MethodNotAllowed
-	 */
+	
 	public function testSetName() {
+		$this->expectException(\Sabre\DAV\Exception\MethodNotAllowed::class);
+
 		$this->getTagNode()->setName('2');
 	}
 
@@ -198,10 +198,10 @@ class SystemTagNodeTest extends \Test\TestCase {
 		$this->assertInstanceOf($expectedException, $thrown);
 	}
 
-	/**
-	 * @expectedException \Sabre\DAV\Exception\Conflict
-	 */
+	
 	public function testUpdateTagAlreadyExists() {
+		$this->expectException(\Sabre\DAV\Exception\Conflict::class);
+
 		$tag = new SystemTag(1, 'tag1', true, true);
 		$this->tagManager->expects($this->any())
 			->method('canUserSeeTag')
@@ -218,10 +218,10 @@ class SystemTagNodeTest extends \Test\TestCase {
 		$this->getTagNode(false, $tag)->update('Renamed', true, true);
 	}
 
-	/**
-	 * @expectedException \Sabre\DAV\Exception\NotFound
-	 */
+	
 	public function testUpdateTagNotFound() {
+		$this->expectException(\Sabre\DAV\Exception\NotFound::class);
+
 		$tag = new SystemTag(1, 'tag1', true, true);
 		$this->tagManager->expects($this->any())
 			->method('canUserSeeTag')
@@ -286,10 +286,10 @@ class SystemTagNodeTest extends \Test\TestCase {
 		$this->getTagNode(false, $tag)->delete();
 	}
 
-	/**
-	 * @expectedException \Sabre\DAV\Exception\NotFound
-	 */
+	
 	public function testDeleteTagNotFound() {
+		$this->expectException(\Sabre\DAV\Exception\NotFound::class);
+
 		$tag = new SystemTag(1, 'tag1', true, true);
 		$this->tagManager->expects($this->any())
 			->method('canUserSeeTag')

+ 15 - 13
apps/dav/tests/unit/SystemTag/SystemTagPluginTest.php

@@ -85,7 +85,7 @@ class SystemTagPluginTest extends \Test\TestCase {
 	 */
 	private $plugin;
 
-	public function setUp(): void {
+	protected function setUp(): void {
 		parent::setUp();
 		$this->tree = $this->getMockBuilder(Tree::class)
 			->disableOriginalConstructor()
@@ -234,10 +234,10 @@ class SystemTagPluginTest extends \Test\TestCase {
 		$this->assertEquals($expectedProperties, $result[200]);
 	}
 
-	/**
-	 * @expectedException \Sabre\DAV\Exception\Forbidden
-	 */
+	
 	public function testGetPropertiesForbidden() {
+		$this->expectException(\Sabre\DAV\Exception\Forbidden::class);
+
 		$systemTag = new SystemTag(1, 'Test', true, false);
 		$requestedProperties = [
 			self::ID_PROPERTYNAME,
@@ -331,10 +331,10 @@ class SystemTagPluginTest extends \Test\TestCase {
 		$this->assertEquals(200, $result[self::USERVISIBLE_PROPERTYNAME]);
 	}
 
-	/**
-	 * @expectedException \Sabre\DAV\Exception\Forbidden
-	 */
+	
 	public function testUpdatePropertiesForbidden() {
+		$this->expectException(\Sabre\DAV\Exception\Forbidden::class);
+
 		$systemTag = new SystemTag(1, 'Test', true, false);
 		$this->user->expects($this->any())
 			->method('getUID')
@@ -385,10 +385,11 @@ class SystemTagPluginTest extends \Test\TestCase {
 	}
 	/**
 	 * @dataProvider createTagInsufficientPermissionsProvider
-	 * @expectedException \Sabre\DAV\Exception\BadRequest
-	 * @expectedExceptionMessage Not sufficient permissions
 	 */
 	public function testCreateNotAssignableTagAsRegularUser($userVisible, $userAssignable, $groups) {
+		$this->expectException(\Sabre\DAV\Exception\BadRequest::class);
+		$this->expectExceptionMessage('Not sufficient permissions');
+
 		$this->user->expects($this->once())
 			->method('getUID')
 			->willReturn('admin');
@@ -658,10 +659,10 @@ class SystemTagPluginTest extends \Test\TestCase {
 		$this->plugin->httpPost($request, $response);
 	}
 
-	/**
-	 * @expectedException \Sabre\DAV\Exception\NotFound
-	 */
+	
 	public function testCreateTagToUnknownNode() {
+		$this->expectException(\Sabre\DAV\Exception\NotFound::class);
+
 		$node = $this->getMockBuilder(SystemTagsObjectMappingCollection::class)
 			->disableOriginalConstructor()
 			->getMock();
@@ -692,9 +693,10 @@ class SystemTagPluginTest extends \Test\TestCase {
 
 	/**
 	 * @dataProvider nodeClassProvider
-	 * @expectedException \Sabre\DAV\Exception\Conflict
 	 */
 	public function testCreateTagConflict($nodeClass) {
+		$this->expectException(\Sabre\DAV\Exception\Conflict::class);
+
 		$this->user->expects($this->once())
 			->method('getUID')
 			->willReturn('admin');

+ 18 - 18
apps/dav/tests/unit/SystemTag/SystemTagsByIdCollectionTest.php

@@ -80,17 +80,17 @@ class SystemTagsByIdCollectionTest extends \Test\TestCase {
 		return [[true], [false]];
 	}
 
-	/**
-	 * @expectedException \Sabre\DAV\Exception\Forbidden
-	 */
+	
 	public function testForbiddenCreateFile() {
+		$this->expectException(\Sabre\DAV\Exception\Forbidden::class);
+
 		$this->getNode()->createFile('555');
 	}
 
-	/**
-	 * @expectedException \Sabre\DAV\Exception\Forbidden
-	 */
+	
 	public function testForbiddenCreateDirectory() {
+		$this->expectException(\Sabre\DAV\Exception\Forbidden::class);
+
 		$this->getNode()->createDirectory('789');
 	}
 
@@ -113,10 +113,10 @@ class SystemTagsByIdCollectionTest extends \Test\TestCase {
 		$this->assertEquals($tag, $childNode->getSystemTag());
 	}
 
-	/**
-	 * @expectedException \Sabre\DAV\Exception\BadRequest
-	 */
+	
 	public function testGetChildInvalidName() {
+		$this->expectException(\Sabre\DAV\Exception\BadRequest::class);
+
 		$this->tagManager->expects($this->once())
 			->method('getTagsByIds')
 			->with(['invalid'])
@@ -125,10 +125,10 @@ class SystemTagsByIdCollectionTest extends \Test\TestCase {
 		$this->getNode()->getChild('invalid');
 	}
 
-	/**
-	 * @expectedException \Sabre\DAV\Exception\NotFound
-	 */
+	
 	public function testGetChildNotFound() {
+		$this->expectException(\Sabre\DAV\Exception\NotFound::class);
+
 		$this->tagManager->expects($this->once())
 			->method('getTagsByIds')
 			->with(['444'])
@@ -137,10 +137,10 @@ class SystemTagsByIdCollectionTest extends \Test\TestCase {
 		$this->getNode()->getChild('444');
 	}
 
-	/**
-	 * @expectedException \Sabre\DAV\Exception\NotFound
-	 */
+	
 	public function testGetChildUserNotVisible() {
+		$this->expectException(\Sabre\DAV\Exception\NotFound::class);
+
 		$tag = new SystemTag(123, 'Test', false, false);
 
 		$this->tagManager->expects($this->once())
@@ -231,10 +231,10 @@ class SystemTagsByIdCollectionTest extends \Test\TestCase {
 		$this->assertFalse($this->getNode()->childExists('123'));
 	}
 
-	/**
-	 * @expectedException \Sabre\DAV\Exception\BadRequest
-	 */
+	
 	public function testChildExistsBadRequest() {
+		$this->expectException(\Sabre\DAV\Exception\BadRequest::class);
+
 		$this->tagManager->expects($this->once())
 			->method('getTagsByIds')
 			->with(['invalid'])

+ 27 - 27
apps/dav/tests/unit/SystemTag/SystemTagsObjectMappingCollectionTest.php

@@ -133,10 +133,10 @@ class SystemTagsObjectMappingCollectionTest extends \Test\TestCase {
 		$this->assertInstanceOf($expectedException, $thrown);
 	}
 
-	/**
-	 * @expectedException \Sabre\DAV\Exception\PreconditionFailed
-	 */
+	
 	public function testAssignTagNotFound() {
+		$this->expectException(\Sabre\DAV\Exception\PreconditionFailed::class);
+
 		$this->tagManager->expects($this->once())
 			->method('getTagsByIds')
 			->with(['555'])
@@ -145,10 +145,10 @@ class SystemTagsObjectMappingCollectionTest extends \Test\TestCase {
 		$this->getNode()->createFile('555');
 	}
 
-	/**
-	 * @expectedException \Sabre\DAV\Exception\Forbidden
-	 */
+	
 	public function testForbiddenCreateDirectory() {
+		$this->expectException(\Sabre\DAV\Exception\Forbidden::class);
+
 		$this->getNode()->createDirectory('789');
 	}
 
@@ -175,10 +175,10 @@ class SystemTagsObjectMappingCollectionTest extends \Test\TestCase {
 		$this->assertEquals('555', $childNode->getName());
 	}
 
-	/**
-	 * @expectedException \Sabre\DAV\Exception\NotFound
-	 */
+	
 	public function testGetChildNonVisible() {
+		$this->expectException(\Sabre\DAV\Exception\NotFound::class);
+
 		$tag = new SystemTag(555, 'TheTag', false, false);
 		$this->tagManager->expects($this->once())
 			->method('canUserSeeTag')
@@ -198,10 +198,10 @@ class SystemTagsObjectMappingCollectionTest extends \Test\TestCase {
 		$this->getNode()->getChild('555');
 	}
 
-	/**
-	 * @expectedException \Sabre\DAV\Exception\NotFound
-	 */
+	
 	public function testGetChildRelationNotFound() {
+		$this->expectException(\Sabre\DAV\Exception\NotFound::class);
+
 		$this->tagMapper->expects($this->once())
 			->method('haveTag')
 			->with([111], 'files', '777')
@@ -210,10 +210,10 @@ class SystemTagsObjectMappingCollectionTest extends \Test\TestCase {
 		$this->getNode()->getChild('777');
 	}
 
-	/**
-	 * @expectedException \Sabre\DAV\Exception\BadRequest
-	 */
+	
 	public function testGetChildInvalidId() {
+		$this->expectException(\Sabre\DAV\Exception\BadRequest::class);
+
 		$this->tagMapper->expects($this->once())
 			->method('haveTag')
 			->with([111], 'files', 'badid')
@@ -222,10 +222,10 @@ class SystemTagsObjectMappingCollectionTest extends \Test\TestCase {
 		$this->getNode()->getChild('badid');
 	}
 
-	/**
-	 * @expectedException \Sabre\DAV\Exception\NotFound
-	 */
+	
 	public function testGetChildTagDoesNotExist() {
+		$this->expectException(\Sabre\DAV\Exception\NotFound::class);
+
 		$this->tagMapper->expects($this->once())
 			->method('haveTag')
 			->with([111], 'files', '777')
@@ -326,10 +326,10 @@ class SystemTagsObjectMappingCollectionTest extends \Test\TestCase {
 		$this->assertFalse($this->getNode()->childExists('555'));
 	}
 
-	/**
-	 * @expectedException \Sabre\DAV\Exception\BadRequest
-	 */
+	
 	public function testChildExistsInvalidId() {
+		$this->expectException(\Sabre\DAV\Exception\BadRequest::class);
+
 		$this->tagMapper->expects($this->once())
 			->method('haveTag')
 			->with([111], 'files', '555')
@@ -338,17 +338,17 @@ class SystemTagsObjectMappingCollectionTest extends \Test\TestCase {
 		$this->getNode()->childExists('555');
 	}
 
-	/**
-	 * @expectedException \Sabre\DAV\Exception\Forbidden
-	 */
+	
 	public function testDelete() {
+		$this->expectException(\Sabre\DAV\Exception\Forbidden::class);
+
 		$this->getNode()->delete();
 	}
 
-	/**
-	 * @expectedException \Sabre\DAV\Exception\Forbidden
-	 */
+	
 	public function testSetName() {
+		$this->expectException(\Sabre\DAV\Exception\Forbidden::class);
+
 		$this->getNode()->setName('somethingelse');
 	}
 

+ 18 - 18
apps/dav/tests/unit/SystemTag/SystemTagsObjectTypeCollectionTest.php

@@ -98,17 +98,17 @@ class SystemTagsObjectTypeCollectionTest extends \Test\TestCase {
 		);
 	}
 
-	/**
-	 * @expectedException \Sabre\DAV\Exception\Forbidden
-	 */
+	
 	public function testForbiddenCreateFile() {
+		$this->expectException(\Sabre\DAV\Exception\Forbidden::class);
+
 		$this->node->createFile('555');
 	}
 
-	/**
-	 * @expectedException \Sabre\DAV\Exception\Forbidden
-	 */
+	
 	public function testForbiddenCreateDirectory() {
+		$this->expectException(\Sabre\DAV\Exception\Forbidden::class);
+
 		$this->node->createDirectory('789');
 	}
 
@@ -123,10 +123,10 @@ class SystemTagsObjectTypeCollectionTest extends \Test\TestCase {
 		$this->assertEquals('555', $childNode->getName());
 	}
 
-	/**
-	 * @expectedException \Sabre\DAV\Exception\NotFound
-	 */
+	
 	public function testGetChildWithoutAccess() {
+		$this->expectException(\Sabre\DAV\Exception\NotFound::class);
+
 		$this->userFolder->expects($this->once())
 			->method('getById')
 			->with('555')
@@ -134,10 +134,10 @@ class SystemTagsObjectTypeCollectionTest extends \Test\TestCase {
 		$this->node->getChild('555');
 	}
 
-	/**
-	 * @expectedException \Sabre\DAV\Exception\MethodNotAllowed
-	 */
+	
 	public function testGetChildren() {
+		$this->expectException(\Sabre\DAV\Exception\MethodNotAllowed::class);
+
 		$this->node->getChildren();
 	}
 
@@ -157,17 +157,17 @@ class SystemTagsObjectTypeCollectionTest extends \Test\TestCase {
 		$this->assertFalse($this->node->childExists('555'));
 	}
 
-	/**
-	 * @expectedException \Sabre\DAV\Exception\Forbidden
-	 */
+	
 	public function testDelete() {
+		$this->expectException(\Sabre\DAV\Exception\Forbidden::class);
+
 		$this->node->delete();
 	}
 
-	/**
-	 * @expectedException \Sabre\DAV\Exception\Forbidden
-	 */
+	
 	public function testSetName() {
+		$this->expectException(\Sabre\DAV\Exception\Forbidden::class);
+
 		$this->node->setName('somethingelse');
 	}
 

+ 5 - 5
apps/dav/tests/unit/Upload/ChunkingPluginTest.php

@@ -51,7 +51,7 @@ class ChunkingPluginTest extends TestCase {
 	/** @var ResponseInterface | \PHPUnit_Framework_MockObject_MockObject */
 	private $response;
 
-	public function setUp(): void {
+	protected function setUp(): void {
 		parent::setUp();
 
 		$this->server = $this->getMockBuilder('\Sabre\DAV\Server')
@@ -141,11 +141,11 @@ class ChunkingPluginTest extends TestCase {
 		$this->assertFalse($this->plugin->beforeMove('source', 'target'));
 	}
 
-	/**
-	 * @expectedException \Sabre\DAV\Exception\BadRequest
-	 * @expectedExceptionMessage Chunks on server do not sum up to 4 but to 3 bytes
-	 */
+	
 	public function testBeforeMoveSizeIsWrong() {
+		$this->expectException(\Sabre\DAV\Exception\BadRequest::class);
+		$this->expectExceptionMessage('Chunks on server do not sum up to 4 but to 3 bytes');
+
 		$sourceNode = $this->createMock(FutureFile::class);
 		$sourceNode->expects($this->once())
 			->method('getSize')

+ 6 - 6
apps/dav/tests/unit/Upload/FutureFileTest.php

@@ -73,18 +73,18 @@ class FutureFileTest extends \Test\TestCase {
 		$f->delete();
 	}
 
-	/**
-	 * @expectedException Sabre\DAV\Exception\Forbidden
-	 */
+	
 	public function testPut() {
+		$this->expectException(\Sabre\DAV\Exception\Forbidden::class);
+
 		$f = $this->mockFutureFile();
 		$f->put('');
 	}
 
-	/**
-	 * @expectedException Sabre\DAV\Exception\Forbidden
-	 */
+	
 	public function testSetName() {
+		$this->expectException(\Sabre\DAV\Exception\Forbidden::class);
+
 		$f = $this->mockFutureFile();
 		$f->setName('');
 	}

+ 1 - 1
apps/encryption/tests/Command/TestEnableMasterKey.php

@@ -53,7 +53,7 @@ class TestEnableMasterKey extends TestCase {
 	/** @var  \Symfony\Component\Console\Input\InputInterface | \PHPUnit_Framework_MockObject_MockObject */
 	protected $input;
 
-	public function setUp(): void {
+	protected function setUp(): void {
 		parent::setUp();
 
 		$this->util = $this->getMockBuilder(Util::class)

+ 7 - 4
apps/encryption/tests/Crypto/CryptTest.php

@@ -53,7 +53,7 @@ class CryptTest extends TestCase {
 	/** @var Crypt */
 	private $crypt;
 
-	public function setUp(): void {
+	protected function setUp(): void {
 		parent::setUp();
 
 		$this->logger = $this->getMockBuilder(ILogger::class)
@@ -132,9 +132,10 @@ class CryptTest extends TestCase {
 	/**
 	 * test generateHeader with invalid key format
 	 *
-	 * @expectedException \InvalidArgumentException
 	 */
 	public function testGenerateHeaderInvalid() {
+		$this->expectException(\InvalidArgumentException::class);
+
 		$this->crypt->generateHeader('unknown');
 	}
 
@@ -252,9 +253,10 @@ class CryptTest extends TestCase {
 
 	/**
 	 * @dataProvider dataTestHasSignatureFail
-	 * @expectedException \OCP\Encryption\Exceptions\GenericEncryptionException
 	 */
 	public function testHasSignatureFail($cipher) {
+		$this->expectException(\OCP\Encryption\Exceptions\GenericEncryptionException::class);
+
 		$data = 'encryptedContent00iv001234567890123456xx';
 		$this->invokePrivate($this->crypt, 'hasSignature', array($data, $cipher));
 	}
@@ -371,9 +373,10 @@ class CryptTest extends TestCase {
 	/**
 	 * test exception if cipher is unknown
 	 *
-	 * @expectedException \InvalidArgumentException
 	 */
 	public function testGetKeySizeFailure() {
+		$this->expectException(\InvalidArgumentException::class);
+
 		$this->invokePrivate($this->crypt, 'getKeySize', ['foo']);
 	}
 

+ 1 - 1
apps/encryption/tests/Crypto/DecryptAllTest.php

@@ -53,7 +53,7 @@ class DecryptAllTest extends TestCase {
 	/** @var QuestionHelper | \PHPUnit_Framework_MockObject_MockObject  */
 	protected $questionHelper;
 
-	public function setUp(): void {
+	protected function setUp(): void {
 		parent::setUp();
 
 		$this->util = $this->getMockBuilder(Util::class)

+ 1 - 1
apps/encryption/tests/Crypto/EncryptAllTest.php

@@ -90,7 +90,7 @@ class EncryptAllTest extends TestCase {
 	/** @var  EncryptAll */
 	protected $encryptAll;
 
-	function setUp(): void {
+	protected function setUp(): void {
 		parent::setUp();
 		$this->setupUser = $this->getMockBuilder(Setup::class)
 			->disableOriginalConstructor()->getMock();

+ 7 - 6
apps/encryption/tests/Crypto/EncryptionTest.php

@@ -73,7 +73,7 @@ class EncryptionTest extends TestCase {
 	/** @var \OCP\Files\Storage|\PHPUnit_Framework_MockObject_MockObject */
 	private $storageMock;
 
-	public function setUp(): void {
+	protected function setUp(): void {
 		parent::setUp();
 
 		$this->storageMock = $this->getMockBuilder(Storage::class)
@@ -131,9 +131,10 @@ class EncryptionTest extends TestCase {
 	/**
 	 * test if public key from owner is missing
 	 *
-	 * @expectedException \OCA\Encryption\Exceptions\PublicKeyMissingException
 	 */
 	public function testEndUser2() {
+		$this->expectException(\OCA\Encryption\Exceptions\PublicKeyMissingException::class);
+
 		$this->instance->begin('/foo/bar', 'user2', 'r', array(), array('users' => array('user1', 'user2', 'user3')));
 		$this->endTest();
 	}
@@ -431,11 +432,11 @@ class EncryptionTest extends TestCase {
 		);
 	}
 
-	/**
-	 * @expectedException \OC\Encryption\Exceptions\DecryptionFailedException
-	 * @expectedExceptionMessage Can not decrypt this file, probably this is a shared file. Please ask the file owner to reshare the file with you.
-	 */
+	
 	public function testDecrypt() {
+		$this->expectException(\OC\Encryption\Exceptions\DecryptionFailedException::class);
+		$this->expectExceptionMessage('Can not decrypt this file, probably this is a shared file. Please ask the file owner to reshare the file with you.');
+
 		$this->instance->decrypt('abc');
 	}
 

+ 3 - 9
apps/encryption/tests/HookManagerTest.php

@@ -38,9 +38,7 @@ class HookManagerTest extends TestCase {
 	 */
 	private static $instance;
 
-	/**
-	 *
-	 */
+	
 	public function testRegisterHookWithArray() {
 		self::$instance->registerHook([
 			$this->getMockBuilder(IHook::class)->disableOriginalConstructor()->getMock(),
@@ -54,9 +52,7 @@ class HookManagerTest extends TestCase {
 	}
 
 
-	/**
-	 *
-	 */
+	
 	public static function setUpBeforeClass(): void {
 		parent::setUpBeforeClass();
 		// have to make instance static to preserve data between tests
@@ -64,9 +60,7 @@ class HookManagerTest extends TestCase {
 
 	}
 
-	/**
-	 *
-	 */
+	
 	public function testRegisterHooksWithInstance() {
 		$mock = $this->getMockBuilder(IHook::class)->disableOriginalConstructor()->getMock();
 		/** @var \OCA\Encryption\Hooks\Contracts\IHook $mock */

+ 10 - 10
apps/encryption/tests/KeyManagerTest.php

@@ -79,7 +79,7 @@ class KeyManagerTest extends TestCase {
 	/** @var \OCP\IConfig|\PHPUnit_Framework_MockObject_MockObject */
 	private $configMock;
 
-	public function setUp(): void {
+	protected function setUp(): void {
 		parent::setUp();
 		$this->userId = 'user1';
 		$this->systemKeyId = 'systemKeyId';
@@ -220,10 +220,10 @@ class KeyManagerTest extends TestCase {
 		];
 	}
 
-	/**
-	 * @expectedException \OCA\Encryption\Exceptions\PrivateKeyMissingException
-	 */
+	
 	public function testUserHasKeysMissingPrivateKey() {
+		$this->expectException(\OCA\Encryption\Exceptions\PrivateKeyMissingException::class);
+
 		$this->keyStorageMock->expects($this->exactly(2))
 			->method('getUserKey')
 			->willReturnCallback(function ($uid, $keyID, $encryptionModuleId) {
@@ -236,10 +236,10 @@ class KeyManagerTest extends TestCase {
 		$this->instance->userHasKeys($this->userId);
 	}
 
-	/**
-	 * @expectedException \OCA\Encryption\Exceptions\PublicKeyMissingException
-	 */
+	
 	public function testUserHasKeysMissingPublicKey() {
+		$this->expectException(\OCA\Encryption\Exceptions\PublicKeyMissingException::class);
+
 		$this->keyStorageMock->expects($this->exactly(2))
 			->method('getUserKey')
 			->willReturnCallback(function ($uid, $keyID, $encryptionModuleId){
@@ -536,10 +536,10 @@ class KeyManagerTest extends TestCase {
 		);
 	}
 
-	/**
-	 * @expectedException \Exception
-	 */
+	
 	public function testGetMasterKeyPasswordException() {
+		$this->expectException(\Exception::class);
+
 		$this->configMock->expects($this->once())->method('getSystemValue')->with('secret')
 			->willReturn('');
 

+ 15 - 17
apps/encryption/tests/SessionTest.php

@@ -41,11 +41,11 @@ class SessionTest extends TestCase {
 	/** @var \OCP\ISession|\PHPUnit_Framework_MockObject_MockObject */
 	private $sessionMock;
 
-	/**
-	 * @expectedException \OCA\Encryption\Exceptions\PrivateKeyMissingException
-	 * @expectedExceptionMessage Private Key missing for user: please try to log-out and log-in again
-	 */
+	
 	public function testThatGetPrivateKeyThrowsExceptionWhenNotSet() {
+		$this->expectException(\OCA\Encryption\Exceptions\PrivateKeyMissingException::class);
+		$this->expectExceptionMessage('Private Key missing for user: please try to log-out and log-in again');
+
 		$this->instance->getPrivateKey();
 	}
 
@@ -84,42 +84,44 @@ class SessionTest extends TestCase {
 	}
 
 	/**
-	 * @expectedException \Exception
 	 * @expectExceptionMessage 'Please activate decrypt all mode first'
 	 */
 	public function testGetDecryptAllUidException() {
+		$this->expectException(\Exception::class);
+
 		$this->instance->getDecryptAllUid();
 	}
 
 	/**
-	 * @expectedException \Exception
 	 * @expectExceptionMessage 'No uid found while in decrypt all mode'
 	 */
 	public function testGetDecryptAllUidException2() {
+		$this->expectException(\Exception::class);
+
 		$this->instance->prepareDecryptAll(null, 'key');
 		$this->instance->getDecryptAllUid();
 	}
 
 	/**
-	 * @expectedException \OCA\Encryption\Exceptions\PrivateKeyMissingException
 	 * @expectExceptionMessage 'Please activate decrypt all mode first'
 	 */
 	public function testGetDecryptAllKeyException() {
+		$this->expectException(\OCA\Encryption\Exceptions\PrivateKeyMissingException::class);
+
 		$this->instance->getDecryptAllKey();
 	}
 
 	/**
-	 * @expectedException \OCA\Encryption\Exceptions\PrivateKeyMissingException
 	 * @expectExceptionMessage 'No key found while in decrypt all mode'
 	 */
 	public function testGetDecryptAllKeyException2() {
+		$this->expectException(\OCA\Encryption\Exceptions\PrivateKeyMissingException::class);
+
 		$this->instance->prepareDecryptAll('user', null);
 		$this->instance->getDecryptAllKey();
 	}
 
-	/**
-	 *
-	 */
+	
 	public function testSetAndGetStatusWillSetAndReturn() {
 		// Check if get status will return 0 if it has not been set before
 		$this->assertEquals(0, $this->instance->getStatus());
@@ -186,9 +188,7 @@ class SessionTest extends TestCase {
 		return null;
 	}
 
-	/**
-	 *
-	 */
+	
 	public function testClearWillRemoveValues() {
 		$this->instance->setPrivateKey('privateKey');
 		$this->instance->setStatus('initStatus');
@@ -198,9 +198,7 @@ class SessionTest extends TestCase {
 		$this->assertEmpty(self::$tempStorage);
 	}
 
-	/**
-	 *
-	 */
+	
 	protected function setUp(): void {
 		parent::setUp();
 		$this->sessionMock = $this->createMock(ISession::class);

+ 1 - 1
apps/encryption/tests/Settings/AdminTest.php

@@ -50,7 +50,7 @@ class AdminTest extends TestCase {
 	/** @var ISession */
 	private $session;
 
-	public function setUp(): void {
+	protected function setUp(): void {
 		parent::setUp();
 
 		$this->l = $this->getMockBuilder(IL10N::class)->getMock();

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