diff options
author | Joas Schilling <coding@schilljs.com> | 2018-01-25 11:23:12 +0100 |
---|---|---|
committer | Joas Schilling <coding@schilljs.com> | 2018-01-25 11:33:25 +0100 |
commit | bf2be08c9f3b6957a3327929a169eb6204e84cd0 (patch) | |
tree | 4738ade539309fea85c5db8e796783c2cdbc0438 /apps | |
parent | 24af5c20bd65f8e657bcc495984234088c22e824 (diff) | |
download | nextcloud-server-bf2be08c9f3b6957a3327929a169eb6204e84cd0.tar.gz nextcloud-server-bf2be08c9f3b6957a3327929a169eb6204e84cd0.zip |
Fix risky tests without assertions
Signed-off-by: Joas Schilling <coding@schilljs.com>
Diffstat (limited to 'apps')
21 files changed, 48 insertions, 37 deletions
diff --git a/apps/dav/tests/unit/AppInfo/ApplicationTest.php b/apps/dav/tests/unit/AppInfo/ApplicationTest.php index bb6cfe67b4d..d4f53d360a9 100644 --- a/apps/dav/tests/unit/AppInfo/ApplicationTest.php +++ b/apps/dav/tests/unit/AppInfo/ApplicationTest.php @@ -61,6 +61,6 @@ class ApplicationTest extends TestCase { /** @var IManager|\PHPUnit_Framework_MockObject_MockObject $cm */ $cm = $this->createMock(IManager::class); $app->setupContactsProvider($cm, 'xxx'); - $this->assertTrue(true); + $this->addToAssertionCount(1); } } diff --git a/apps/dav/tests/unit/CalDAV/AbstractCalDavBackend.php b/apps/dav/tests/unit/CalDAV/AbstractCalDavBackend.php index 2a01bd425c0..310433f0913 100644 --- a/apps/dav/tests/unit/CalDAV/AbstractCalDavBackend.php +++ b/apps/dav/tests/unit/CalDAV/AbstractCalDavBackend.php @@ -176,7 +176,7 @@ EOD; protected function assertAcl($principal, $privilege, $acl) { foreach($acl as $a) { if ($a['principal'] === $principal && $a['privilege'] === $privilege) { - $this->assertTrue(true); + $this->addToAssertionCount(1); return; } } @@ -190,7 +190,7 @@ EOD; return; } } - $this->assertTrue(true); + $this->addToAssertionCount(1); } protected function assertAccess($shouldHaveAcl, $principal, $privilege, $acl) { diff --git a/apps/dav/tests/unit/CalDAV/CalendarTest.php b/apps/dav/tests/unit/CalDAV/CalendarTest.php index dbdbf0dbafd..f467d46bf60 100644 --- a/apps/dav/tests/unit/CalDAV/CalendarTest.php +++ b/apps/dav/tests/unit/CalDAV/CalendarTest.php @@ -183,7 +183,7 @@ class CalendarTest extends TestCase { ->with(666, $propPatch); } $c->propPatch($propPatch); - $this->assertTrue(true); + $this->addToAssertionCount(1); } /** diff --git a/apps/dav/tests/unit/Connector/Sabre/CustomPropertiesBackendTest.php b/apps/dav/tests/unit/Connector/Sabre/CustomPropertiesBackendTest.php index cbde8c2ef68..91973eeff5d 100644 --- a/apps/dav/tests/unit/Connector/Sabre/CustomPropertiesBackendTest.php +++ b/apps/dav/tests/unit/Connector/Sabre/CustomPropertiesBackendTest.php @@ -174,7 +174,7 @@ class CustomPropertiesBackendTest extends \Test\TestCase { ); // no exception, soft fail - $this->assertTrue(true); + $this->addToAssertionCount(1); } /** diff --git a/apps/dav/tests/unit/Connector/Sabre/DirectoryTest.php b/apps/dav/tests/unit/Connector/Sabre/DirectoryTest.php index e72987ef02d..968cb548068 100644 --- a/apps/dav/tests/unit/Connector/Sabre/DirectoryTest.php +++ b/apps/dav/tests/unit/Connector/Sabre/DirectoryTest.php @@ -345,7 +345,7 @@ class DirectoryTest extends \Test\TestCase { */ public function testMoveSuccess($source, $destination, $updatables, $deletables) { $this->moveTest($source, $destination, $updatables, $deletables); - $this->assertTrue(true); + $this->addToAssertionCount(1); } /** diff --git a/apps/dav/tests/unit/Connector/Sabre/FilesPluginTest.php b/apps/dav/tests/unit/Connector/Sabre/FilesPluginTest.php index e1c4bc05dc1..ea520bca7e5 100644 --- a/apps/dav/tests/unit/Connector/Sabre/FilesPluginTest.php +++ b/apps/dav/tests/unit/Connector/Sabre/FilesPluginTest.php @@ -383,6 +383,8 @@ class FilesPluginTest extends TestCase { $propFind, $node ); + + $this->addToAssertionCount(1); } public function testUpdateProps() { diff --git a/apps/encryption/tests/Hooks/UserHooksTest.php b/apps/encryption/tests/Hooks/UserHooksTest.php index f951ddb37f7..91005e2746a 100644 --- a/apps/encryption/tests/Hooks/UserHooksTest.php +++ b/apps/encryption/tests/Hooks/UserHooksTest.php @@ -110,7 +110,7 @@ class UserHooksTest extends TestCase { $this->sessionMock->expects($this->once()) ->method('clear'); $this->instance->logout(); - $this->assertTrue(true); + $this->addToAssertionCount(1); } public function testPostCreateUser() { @@ -118,7 +118,7 @@ class UserHooksTest extends TestCase { ->method('setupUser'); $this->instance->postCreateUser($this->params); - $this->assertTrue(true); + $this->addToAssertionCount(1); } public function testPostDeleteUser() { @@ -127,7 +127,7 @@ class UserHooksTest extends TestCase { ->with('testUser'); $this->instance->postDeleteUser($this->params); - $this->assertTrue(true); + $this->addToAssertionCount(1); } public function testPrePasswordReset() { diff --git a/apps/encryption/tests/RecoveryTest.php b/apps/encryption/tests/RecoveryTest.php index b83b71737f3..0eb9a777ec3 100644 --- a/apps/encryption/tests/RecoveryTest.php +++ b/apps/encryption/tests/RecoveryTest.php @@ -213,7 +213,7 @@ class RecoveryTest extends TestCase { $this->cryptMock->expects($this->once()) ->method('decryptPrivateKey'); $this->instance->recoverUsersFiles('password', 'admin'); - $this->assertTrue(true); + $this->addToAssertionCount(1); } public function testRecoverFile() { diff --git a/apps/files_external/tests/Service/UserGlobalStoragesServiceTest.php b/apps/files_external/tests/Service/UserGlobalStoragesServiceTest.php index 013af9b0426..452d8589a3d 100644 --- a/apps/files_external/tests/Service/UserGlobalStoragesServiceTest.php +++ b/apps/files_external/tests/Service/UserGlobalStoragesServiceTest.php @@ -304,66 +304,66 @@ class UserGlobalStoragesServiceTest extends GlobalStoragesServiceTest { public function testGetStoragesBackendNotVisible() { // we don't test this here - $this->assertTrue(true); + $this->addToAssertionCount(1); } public function testGetStoragesAuthMechanismNotVisible() { // we don't test this here - $this->assertTrue(true); + $this->addToAssertionCount(1); } public function testHooksAddStorage($a = null, $b = null, $c = null) { // we don't test this here - $this->assertTrue(true); + $this->addToAssertionCount(1); } public function testHooksUpdateStorage($a = null, $b = null, $c = null, $d = null, $e = null) { // we don't test this here - $this->assertTrue(true); + $this->addToAssertionCount(1); } public function testHooksRenameMountPoint() { // we don't test this here - $this->assertTrue(true); + $this->addToAssertionCount(1); } public function testHooksDeleteStorage($a = null, $b = null, $c = null) { // we don't test this here - $this->assertTrue(true); + $this->addToAssertionCount(1); } public function testLegacyConfigConversionApplicableAll() { // we don't test this here - $this->assertTrue(true); + $this->addToAssertionCount(1); } public function testLegacyConfigConversionApplicableUserAndGroup() { // we don't test this here - $this->assertTrue(true); + $this->addToAssertionCount(1); } public function testReadLegacyConfigAndGenerateConfigId() { // we don't test this here - $this->assertTrue(true); + $this->addToAssertionCount(1); } public function testReadLegacyConfigNoAuthMechanism() { // we don't test this here - $this->assertTrue(true); + $this->addToAssertionCount(1); } public function testReadLegacyConfigClass() { // we don't test this here - $this->assertTrue(true); + $this->addToAssertionCount(1); } public function testReadEmptyMountPoint() { // we don't test this here - $this->assertTrue(true); + $this->addToAssertionCount(1); } public function testUpdateStorageMountPoint() { // we don't test this here - $this->assertTrue(true); + $this->addToAssertionCount(1); } } diff --git a/apps/files_sharing/tests/ApiTest.php b/apps/files_sharing/tests/ApiTest.php index 8e2b5942d14..6d8e2dd8d84 100644 --- a/apps/files_sharing/tests/ApiTest.php +++ b/apps/files_sharing/tests/ApiTest.php @@ -236,7 +236,7 @@ class ApiTest extends TestCase { $ocs->cleanup(); } - function testEnfoceLinkPassword() { + function testEnforceLinkPassword() { $password = md5(time()); $config = \OC::$server->getConfig(); @@ -288,6 +288,7 @@ class ApiTest extends TestCase { $ocs->cleanup(); $config->setAppValue('core', 'shareapi_enforce_links_password', 'no'); + $this->addToAssertionCount(1); } /** @@ -336,6 +337,8 @@ class ApiTest extends TestCase { // cleanup \OC::$server->getConfig()->setAppValue('core', 'shareapi_exclude_groups', 'no'); \OC::$server->getConfig()->setAppValue('core', 'shareapi_exclude_groups_list', ''); + + $this->addToAssertionCount(1); } @@ -1102,6 +1105,7 @@ class ApiTest extends TestCase { $ocs->cleanup(); $this->shareManager->deleteShare($share1); + $this->addToAssertionCount(1); } /** diff --git a/apps/files_sharing/tests/External/ScannerTest.php b/apps/files_sharing/tests/External/ScannerTest.php index 1ad19d5c80f..fe77182e83f 100644 --- a/apps/files_sharing/tests/External/ScannerTest.php +++ b/apps/files_sharing/tests/External/ScannerTest.php @@ -58,7 +58,7 @@ class ScannerTest extends TestCase { // Declaration of OCA\Files_Sharing\External\Scanner::*() should be // compatible with OC\Files\Cache\Scanner::*() $this->scanner->scanAll(); - $this->assertTrue(true); + $this->addToAssertionCount(1); } public function testScan() { @@ -70,7 +70,7 @@ class ScannerTest extends TestCase { // Declaration of OCA\Files_Sharing\External\Scanner::*() should be // compatible with OC\Files\Cache\Scanner::*() $this->scanner->scan('test', Scanner::SCAN_RECURSIVE); - $this->assertTrue(true); + $this->addToAssertionCount(1); } public function testScanFile() { @@ -78,6 +78,6 @@ class ScannerTest extends TestCase { // Declaration of OCA\Files_Sharing\External\Scanner::*() should be // compatible with OC\Files\Cache\Scanner::*() $this->scanner->scanFile('test', Scanner::SCAN_RECURSIVE); - $this->assertTrue(true); + $this->addToAssertionCount(1); } } diff --git a/apps/files_sharing/tests/LockingTest.php b/apps/files_sharing/tests/LockingTest.php index 4af5e3e2cee..414e8790819 100644 --- a/apps/files_sharing/tests/LockingTest.php +++ b/apps/files_sharing/tests/LockingTest.php @@ -111,6 +111,6 @@ class LockingTest extends TestCase { $recipientView->changeLock('bar.txt', ILockingProvider::LOCK_EXCLUSIVE); $recipientView->unlockFile('bar.txt', ILockingProvider::LOCK_EXCLUSIVE); - $this->assertTrue(true); + $this->addToAssertionCount(1); } } diff --git a/apps/files_sharing/tests/Middleware/OCSShareAPIMiddlewareTest.php b/apps/files_sharing/tests/Middleware/OCSShareAPIMiddlewareTest.php index c260a65725d..8cbf03b8b61 100644 --- a/apps/files_sharing/tests/Middleware/OCSShareAPIMiddlewareTest.php +++ b/apps/files_sharing/tests/Middleware/OCSShareAPIMiddlewareTest.php @@ -136,5 +136,6 @@ class OCSShareAPIMiddlewareTest extends \Test\TestCase { ->disableOriginalConstructor() ->getMock(); $this->middleware->afterController($controller, 'foo', $response); + $this->addToAssertionCount(1); } } diff --git a/apps/files_trashbin/tests/BackgroundJob/ExpireTrashTest.php b/apps/files_trashbin/tests/BackgroundJob/ExpireTrashTest.php index 882099efc99..5339d600722 100644 --- a/apps/files_trashbin/tests/BackgroundJob/ExpireTrashTest.php +++ b/apps/files_trashbin/tests/BackgroundJob/ExpireTrashTest.php @@ -39,6 +39,6 @@ class ExpireTrashTest extends \Test\TestCase { /** @var \OC\BackgroundJob\JobList $jobList */ $backgroundJob->execute($jobList); - $this->assertTrue(true); + $this->addToAssertionCount(1); } } diff --git a/apps/files_trashbin/tests/Command/ExpireTest.php b/apps/files_trashbin/tests/Command/ExpireTest.php index bdc8d867944..2076326cf13 100644 --- a/apps/files_trashbin/tests/Command/ExpireTest.php +++ b/apps/files_trashbin/tests/Command/ExpireTest.php @@ -39,6 +39,6 @@ class ExpireTest extends TestCase { $command = new Expire('test'); $command->handle(); - $this->assertTrue(true); + $this->addToAssertionCount(1); } } diff --git a/apps/files_trashbin/tests/StorageTest.php b/apps/files_trashbin/tests/StorageTest.php index 0e23ea6a3ba..67e622aa1c9 100644 --- a/apps/files_trashbin/tests/StorageTest.php +++ b/apps/files_trashbin/tests/StorageTest.php @@ -593,6 +593,7 @@ class StorageTest extends \Test\TestCase { $this->markTestSkipped('Skipping since the current home storage backend requires the user to logged in'); } else { $this->userView->unlink('test.txt'); + $this->addToAssertionCount(1); } } } diff --git a/apps/files_versions/tests/Command/ExpireTest.php b/apps/files_versions/tests/Command/ExpireTest.php index 3815bc5b75e..c56624d0264 100644 --- a/apps/files_versions/tests/Command/ExpireTest.php +++ b/apps/files_versions/tests/Command/ExpireTest.php @@ -39,6 +39,6 @@ class ExpireTest extends TestCase { $command = new Expire($this->getUniqueID('test'), ''); $command->handle(); - $this->assertTrue(true); + $this->addToAssertionCount(1); } } diff --git a/apps/provisioning_api/tests/Controller/AppConfigControllerTest.php b/apps/provisioning_api/tests/Controller/AppConfigControllerTest.php index 7f24ef5bcb3..223f2c371d6 100644 --- a/apps/provisioning_api/tests/Controller/AppConfigControllerTest.php +++ b/apps/provisioning_api/tests/Controller/AppConfigControllerTest.php @@ -318,7 +318,7 @@ class AppConfigControllerTest extends TestCase { public function testVerifyAppId() { $api = $this->getInstance(); $this->invokePrivate($api, 'verifyAppId', ['activity']); - $this->assertTrue(true); + $this->addToAssertionCount(1); } public function dataVerifyAppIdThrows() { @@ -356,7 +356,7 @@ class AppConfigControllerTest extends TestCase { public function testVerifyConfigKey($app, $key) { $api = $this->getInstance(); $this->invokePrivate($api, 'verifyConfigKey', [$app, $key]); - $this->assertTrue(true); + $this->addToAssertionCount(1); } public function dataVerifyConfigKeyThrows() { diff --git a/apps/user_ldap/tests/LDAPProviderTest.php b/apps/user_ldap/tests/LDAPProviderTest.php index f3a27dec2c4..8df527e0dd8 100644 --- a/apps/user_ldap/tests/LDAPProviderTest.php +++ b/apps/user_ldap/tests/LDAPProviderTest.php @@ -429,7 +429,7 @@ class LDAPProviderTest extends \Test\TestCase { $ldapProvider = $this->getLDAPProvider($server); $ldapProvider->clearCache('existing_user'); - $this->assertTrue(TRUE); + $this->addToAssertionCount(1); } /** @@ -474,7 +474,7 @@ class LDAPProviderTest extends \Test\TestCase { $ldapProvider = $this->getLDAPProvider($server); $ldapProvider->clearGroupCache('existing_group'); - $this->assertTrue(TRUE); + $this->addToAssertionCount(1); } public function testDnExists() { @@ -502,7 +502,7 @@ class LDAPProviderTest extends \Test\TestCase { $ldapProvider = $this->getLDAPProvider($server); $ldapProvider->flagRecord('existing_user'); - $this->assertTrue(TRUE); + $this->addToAssertionCount(1); } public function testUnflagRecord() { @@ -515,7 +515,7 @@ class LDAPProviderTest extends \Test\TestCase { $ldapProvider = $this->getLDAPProvider($server); $ldapProvider->unflagRecord('existing_user'); - $this->assertTrue(TRUE); + $this->addToAssertionCount(1); } /** diff --git a/apps/workflowengine/tests/Check/AbstractStringCheckTest.php b/apps/workflowengine/tests/Check/AbstractStringCheckTest.php index b7051870115..70f8f79146a 100644 --- a/apps/workflowengine/tests/Check/AbstractStringCheckTest.php +++ b/apps/workflowengine/tests/Check/AbstractStringCheckTest.php @@ -96,6 +96,8 @@ class AbstractStringCheckTest extends \Test\TestCase { /** @var \OCA\WorkflowEngine\Check\AbstractStringCheck $check */ $check->validateCheck($operator, $value); + + $this->addToAssertionCount(1); } public function dataValidateCheckInvalid() { diff --git a/apps/workflowengine/tests/Check/RequestTimeTest.php b/apps/workflowengine/tests/Check/RequestTimeTest.php index 7249f5109f2..519b5112f3f 100644 --- a/apps/workflowengine/tests/Check/RequestTimeTest.php +++ b/apps/workflowengine/tests/Check/RequestTimeTest.php @@ -129,6 +129,7 @@ class RequestTimeTest extends \Test\TestCase { public function testValidateCheck($operator, $value) { $check = new \OCA\WorkflowEngine\Check\RequestTime($this->getL10NMock(), $this->timeFactory); $check->validateCheck($operator, $value); + $this->addToAssertionCount(1); } public function dataValidateCheckInvalid() { |