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 | |
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>
45 files changed, 107 insertions, 67 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() { diff --git a/tests/lib/AppFramework/Middleware/Security/PasswordConfirmationMiddlewareTest.php b/tests/lib/AppFramework/Middleware/Security/PasswordConfirmationMiddlewareTest.php index 2c610736f4a..95729e286f9 100644 --- a/tests/lib/AppFramework/Middleware/Security/PasswordConfirmationMiddlewareTest.php +++ b/tests/lib/AppFramework/Middleware/Security/PasswordConfirmationMiddlewareTest.php @@ -89,7 +89,7 @@ class PasswordConfirmationMiddlewareTest extends TestCase { /** * @PasswordConfirmationRequired - * @dataProvider testProvider + * @dataProvider dataProvider */ public function testAnnotation($backend, $lastConfirm, $currentTime, $exception) { $this->reflector->reflect(__CLASS__, __FUNCTION__); @@ -116,7 +116,7 @@ class PasswordConfirmationMiddlewareTest extends TestCase { $this->assertSame($exception, $thrown); } - public function testProvider() { + public function dataProvider() { return [ ['foo', 2000, 4000, true], ['foo', 2000, 3000, false], diff --git a/tests/lib/AppFramework/Middleware/Security/SameSiteCookieMiddlewareTest.php b/tests/lib/AppFramework/Middleware/Security/SameSiteCookieMiddlewareTest.php index bd1568bcd6b..7784f55e84a 100644 --- a/tests/lib/AppFramework/Middleware/Security/SameSiteCookieMiddlewareTest.php +++ b/tests/lib/AppFramework/Middleware/Security/SameSiteCookieMiddlewareTest.php @@ -55,6 +55,7 @@ class SameSiteCookieMiddlewareTest extends TestCase { ->willReturn('/ocs/v2.php'); $this->middleware->beforeController($this->createMock(Controller::class), 'foo'); + $this->addToAssertionCount(1); } public function testBeforeControllerIndexHasAnnotation() { @@ -66,6 +67,7 @@ class SameSiteCookieMiddlewareTest extends TestCase { ->willReturn(true); $this->middleware->beforeController($this->createMock(Controller::class), 'foo'); + $this->addToAssertionCount(1); } public function testBeforeControllerIndexNoAnnotationPassingCheck() { @@ -80,6 +82,7 @@ class SameSiteCookieMiddlewareTest extends TestCase { ->willReturn(true); $this->middleware->beforeController($this->createMock(Controller::class), 'foo'); + $this->addToAssertionCount(1); } public function testBeforeControllerIndexNoAnnotationFailingCheck() { diff --git a/tests/lib/AppFramework/Middleware/Security/SecurityMiddlewareTest.php b/tests/lib/AppFramework/Middleware/Security/SecurityMiddlewareTest.php index 274a2810cba..b68f0cb1981 100644 --- a/tests/lib/AppFramework/Middleware/Security/SecurityMiddlewareTest.php +++ b/tests/lib/AppFramework/Middleware/Security/SecurityMiddlewareTest.php @@ -168,7 +168,7 @@ class SecurityMiddlewareTest extends \Test\TestCase { // add assertion if everything should work fine otherwise phpunit will // complain if ($status === 0) { - $this->assertTrue(true); + $this->addToAssertionCount(1); } } @@ -265,7 +265,7 @@ class SecurityMiddlewareTest extends \Test\TestCase { if($shouldFail) { $this->expectException(SecurityException::class); } else { - $this->assertTrue(true); + $this->addToAssertionCount(1); } $this->reader->reflect(__CLASS__, $method); diff --git a/tests/lib/Authentication/LoginCredentials/StoreTest.php b/tests/lib/Authentication/LoginCredentials/StoreTest.php index 9a719339b43..4588eae35f0 100644 --- a/tests/lib/Authentication/LoginCredentials/StoreTest.php +++ b/tests/lib/Authentication/LoginCredentials/StoreTest.php @@ -79,6 +79,7 @@ class StoreTest extends TestCase { $session = $this->createMock(ISession::class); $this->store->setSession($session); + $this->addToAssertionCount(1); } public function testGetLoginCredentialsNoTokenProvider() { diff --git a/tests/lib/Contacts/ContactsMenu/EntryTest.php b/tests/lib/Contacts/ContactsMenu/EntryTest.php index d5141136a11..e28248fb0fb 100644 --- a/tests/lib/Contacts/ContactsMenu/EntryTest.php +++ b/tests/lib/Contacts/ContactsMenu/EntryTest.php @@ -41,6 +41,7 @@ class EntryTest extends TestCase { public function testSetId() { $this->entry->setId(123); + $this->addToAssertionCount(1); } public function testSetGetFullName() { diff --git a/tests/lib/DB/ConnectionTest.php b/tests/lib/DB/ConnectionTest.php index 2a0cd70f83a..3a4a80bdbd9 100644 --- a/tests/lib/DB/ConnectionTest.php +++ b/tests/lib/DB/ConnectionTest.php @@ -58,7 +58,7 @@ class ConnectionTest extends \Test\TestCase { public function assertTableExist($table) { if ($this->connection->getDatabasePlatform() instanceof SqlitePlatform) { // sqlite removes the tables after closing the DB - $this->assertTrue(true); + $this->addToAssertionCount(1); } else { $this->assertTrue($this->connection->tableExists($table), 'Table ' . $table . ' exists.'); } @@ -70,7 +70,7 @@ class ConnectionTest extends \Test\TestCase { public function assertTableNotExist($table) { if ($this->connection->getDatabasePlatform() instanceof SqlitePlatform) { // sqlite removes the tables after closing the DB - $this->assertTrue(true); + $this->addToAssertionCount(1); } else { $this->assertFalse($this->connection->tableExists($table), 'Table ' . $table . " doesn't exist."); } @@ -195,5 +195,7 @@ class ConnectionTest extends \Test\TestCase { ], [ 'textfield' => 'foo' ]); + + $this->addToAssertionCount(1); } } diff --git a/tests/lib/DB/DBSchemaTest.php b/tests/lib/DB/DBSchemaTest.php index 8eb7fcf81b4..cc6059c163f 100644 --- a/tests/lib/DB/DBSchemaTest.php +++ b/tests/lib/DB/DBSchemaTest.php @@ -107,7 +107,7 @@ class DBSchemaTest extends TestCase { $platform = \OC::$server->getDatabaseConnection()->getDatabasePlatform(); if ($platform instanceof SqlitePlatform) { // sqlite removes the tables after closing the DB - $this->assertTrue(true); + $this->addToAssertionCount(1); } else { $this->assertFalse(OC_DB::tableExists($table), 'Table ' . $table . ' exists.'); } diff --git a/tests/lib/DB/MDB2SchemaManagerTest.php b/tests/lib/DB/MDB2SchemaManagerTest.php index 93078b4f722..75572bb36a5 100644 --- a/tests/lib/DB/MDB2SchemaManagerTest.php +++ b/tests/lib/DB/MDB2SchemaManagerTest.php @@ -46,7 +46,7 @@ class MDB2SchemaManagerTest extends \Test\TestCase { $connection->executeUpdate('insert into `*PREFIX*table` values (?)', array('123')); $manager->updateDbFromStructure(__DIR__ . '/ts-autoincrement-after.xml'); - $this->assertTrue(true); + $this->addToAssertionCount(1); } } diff --git a/tests/lib/DB/MigratorTest.php b/tests/lib/DB/MigratorTest.php index ea718240c5e..9dfed5ecd1a 100644 --- a/tests/lib/DB/MigratorTest.php +++ b/tests/lib/DB/MigratorTest.php @@ -132,7 +132,7 @@ class MigratorTest extends \Test\TestCase { $migrator->checkMigrate($endSchema); $migrator->migrate($endSchema); - $this->assertTrue(true); + $this->addToAssertionCount(1); } public function testUpgradeDifferentPrefix() { @@ -151,7 +151,7 @@ class MigratorTest extends \Test\TestCase { $migrator->checkMigrate($endSchema); $migrator->migrate($endSchema); - $this->assertTrue(true); + $this->addToAssertionCount(1); $this->config->setSystemValue('dbtableprefix', $oldTablePrefix); } @@ -169,7 +169,7 @@ class MigratorTest extends \Test\TestCase { $this->connection->insert($this->tableName, array('id' => 2, 'name' => 'qwerty')); $this->fail('Expected duplicate key insert to fail'); } catch (DBALException $e) { - $this->assertTrue(true); + $this->addToAssertionCount(1); } } @@ -191,7 +191,7 @@ class MigratorTest extends \Test\TestCase { $migrator->checkMigrate($endSchema); $migrator->migrate($endSchema); - $this->assertTrue(true); + $this->addToAssertionCount(1); } public function testReservedKeywords() { @@ -213,7 +213,7 @@ class MigratorTest extends \Test\TestCase { $migrator->checkMigrate($endSchema); $migrator->migrate($endSchema); - $this->assertTrue(true); + $this->addToAssertionCount(1); } public function testAddingForeignKey() { diff --git a/tests/lib/DB/MySqlMigrationTest.php b/tests/lib/DB/MySqlMigrationTest.php index cdc7ef47784..3bbe89fe025 100644 --- a/tests/lib/DB/MySqlMigrationTest.php +++ b/tests/lib/DB/MySqlMigrationTest.php @@ -43,7 +43,7 @@ class MySqlMigrationTest extends \Test\TestCase { $manager = new \OC\DB\MDB2SchemaManager($this->connection); $manager->updateDbFromStructure(__DIR__ . '/testschema.xml'); - $this->assertTrue(true); + $this->addToAssertionCount(1); } } diff --git a/tests/lib/DB/QueryBuilder/QueryBuilderTest.php b/tests/lib/DB/QueryBuilder/QueryBuilderTest.php index e264fde6ec7..fa1c4add0ab 100644 --- a/tests/lib/DB/QueryBuilder/QueryBuilderTest.php +++ b/tests/lib/DB/QueryBuilder/QueryBuilderTest.php @@ -1137,7 +1137,7 @@ class QueryBuilderTest extends \Test\TestCase { $qB->getLastInsertId(); $this->fail('getLastInsertId() should throw an exception, when being called before insert()'); } catch (\BadMethodCallException $e) { - $this->assertTrue(true); + $this->addToAssertionCount(1); } $qB->insert('properties') @@ -1163,7 +1163,7 @@ class QueryBuilderTest extends \Test\TestCase { $qB->getLastInsertId(); $this->fail('getLastInsertId() should throw an exception, when being called after delete()'); } catch (\BadMethodCallException $e) { - $this->assertTrue(true); + $this->addToAssertionCount(1); } } diff --git a/tests/lib/DB/SqliteMigrationTest.php b/tests/lib/DB/SqliteMigrationTest.php index 76002e1afce..4712fc6d70b 100644 --- a/tests/lib/DB/SqliteMigrationTest.php +++ b/tests/lib/DB/SqliteMigrationTest.php @@ -43,7 +43,7 @@ class SqliteMigrationTest extends \Test\TestCase { $manager = new \OC\DB\MDB2SchemaManager($this->connection); $manager->updateDbFromStructure(__DIR__ . '/testschema.xml'); - $this->assertTrue(true); + $this->addToAssertionCount(1); } } diff --git a/tests/lib/Federation/CloudIdTest.php b/tests/lib/Federation/CloudIdTest.php index 7a6e841fb34..feb4108efe5 100644 --- a/tests/lib/Federation/CloudIdTest.php +++ b/tests/lib/Federation/CloudIdTest.php @@ -25,7 +25,7 @@ use OC\Federation\CloudId; use Test\TestCase; class CloudIdTest extends TestCase { - public function testGetDisplayCloudIdProvider() { + public function dataGetDisplayCloudId() { return [ ['test@example.com', 'test@example.com'], ['test@http://example.com', 'test@example.com'], @@ -34,7 +34,7 @@ class CloudIdTest extends TestCase { } /** - * @dataProvider testGetDisplayCloudIdProvider + * @dataProvider dataGetDisplayCloudId * * @param string $id * @param string $display diff --git a/tests/lib/Files/Cache/Wrapper/CacheJailTest.php b/tests/lib/Files/Cache/Wrapper/CacheJailTest.php index f26e3a59f1c..365049c1cc6 100644 --- a/tests/lib/Files/Cache/Wrapper/CacheJailTest.php +++ b/tests/lib/Files/Cache/Wrapper/CacheJailTest.php @@ -79,7 +79,7 @@ class CacheJailTest extends CacheTest { function testGetIncomplete() { //not supported - $this->assertTrue(true); + $this->addToAssertionCount(1); } function testMoveFromJail() { diff --git a/tests/lib/Files/PathVerificationTest.php b/tests/lib/Files/PathVerificationTest.php index c1cebe975fd..7e0b7dd2650 100644 --- a/tests/lib/Files/PathVerificationTest.php +++ b/tests/lib/Files/PathVerificationTest.php @@ -87,6 +87,8 @@ class PathVerificationTest extends \Test\TestCase { if (!$connection->supports4ByteText()) { $this->expectException(InvalidPathException::class); $this->expectExceptionMessage('File name contains at least one invalid character'); + } else { + $this->addToAssertionCount(1); } $this->view->verifyPath('', $fileName); @@ -161,7 +163,7 @@ class PathVerificationTest extends \Test\TestCase { self::invokePrivate($storage, 'verifyPosixPath', [$fileName]); // nothing thrown - $this->assertTrue(true); + $this->addToAssertionCount(1); } public function providesValidPosixPaths() { diff --git a/tests/lib/Files/Storage/LocalTest.php b/tests/lib/Files/Storage/LocalTest.php index 89dd2f0786f..f17933413a5 100644 --- a/tests/lib/Files/Storage/LocalTest.php +++ b/tests/lib/Files/Storage/LocalTest.php @@ -106,6 +106,7 @@ class LocalTest extends Storage { $storage = new \OC\Files\Storage\Local(['datadir' => $subDir1]); $storage->file_put_contents('sym/foo', 'bar'); + $this->addToAssertionCount(1); } } diff --git a/tests/lib/Group/Backend.php b/tests/lib/Group/Backend.php index eb17e9bded7..f702d94b2b4 100644 --- a/tests/lib/Group/Backend.php +++ b/tests/lib/Group/Backend.php @@ -157,5 +157,7 @@ abstract class Backend extends \Test\TestCase { $this->backend->createGroup($group); $this->backend->createGroup($group); + + $this->addToAssertionCount(1); } } diff --git a/tests/lib/Hooks/BasicEmitterTest.php b/tests/lib/Hooks/BasicEmitterTest.php index 2e6bd8100e3..7b71bb8259e 100644 --- a/tests/lib/Hooks/BasicEmitterTest.php +++ b/tests/lib/Hooks/BasicEmitterTest.php @@ -157,7 +157,7 @@ class BasicEmitterTest extends \Test\TestCase { $this->emitter->removeListener('Test', 'test', $listener); $this->emitter->emitEvent('Test', 'test'); - $this->assertTrue(true); + $this->addToAssertionCount(1); } public function testRemoveWildcardListener() { @@ -172,7 +172,7 @@ class BasicEmitterTest extends \Test\TestCase { $this->emitter->removeListener('Test', 'test'); $this->emitter->emitEvent('Test', 'test'); - $this->assertTrue(true); + $this->addToAssertionCount(1); } public function testRemoveWildcardMethod() { @@ -185,7 +185,7 @@ class BasicEmitterTest extends \Test\TestCase { $this->emitter->emitEvent('Test', 'test'); $this->emitter->emitEvent('Test', 'foo'); - $this->assertTrue(true); + $this->addToAssertionCount(1); } public function testRemoveWildcardScope() { @@ -198,7 +198,7 @@ class BasicEmitterTest extends \Test\TestCase { $this->emitter->emitEvent('Test', 'test'); $this->emitter->emitEvent('Bar', 'test'); - $this->assertTrue(true); + $this->addToAssertionCount(1); } public function testRemoveWildcardScopeAndMethod() { @@ -213,7 +213,7 @@ class BasicEmitterTest extends \Test\TestCase { $this->emitter->emitEvent('Test', 'foo'); $this->emitter->emitEvent('Bar', 'foo'); - $this->assertTrue(true); + $this->addToAssertionCount(1); } /** @@ -231,7 +231,7 @@ class BasicEmitterTest extends \Test\TestCase { $this->emitter->removeListener('Test', 'test', $listener1); $this->emitter->emitEvent('Test', 'test'); - $this->assertTrue(true); + $this->addToAssertionCount(1); } /** @@ -246,7 +246,7 @@ class BasicEmitterTest extends \Test\TestCase { $this->emitter->removeListener('Test', 'foo', $listener); $this->emitter->emitEvent('Test', 'test'); - $this->assertTrue(true); + $this->addToAssertionCount(1); } /** @@ -261,7 +261,7 @@ class BasicEmitterTest extends \Test\TestCase { $this->emitter->removeListener('Bar', 'test', $listener); $this->emitter->emitEvent('Test', 'test'); - $this->assertTrue(true); + $this->addToAssertionCount(1); } /** @@ -275,6 +275,6 @@ class BasicEmitterTest extends \Test\TestCase { $this->emitter->removeListener('Bar', 'test', $listener); $this->emitter->emitEvent('Test', 'test'); - $this->assertTrue(true); + $this->addToAssertionCount(1); } } diff --git a/tests/lib/InfoXmlTest.php b/tests/lib/InfoXmlTest.php index 18391a20c03..3d740cd39dd 100644 --- a/tests/lib/InfoXmlTest.php +++ b/tests/lib/InfoXmlTest.php @@ -67,8 +67,10 @@ class InfoXmlTest extends TestCase { $applicationClassName = \OCP\AppFramework\App::buildAppNamespace($app) . '\\AppInfo\\Application'; if (class_exists($applicationClassName)) { $application = new $applicationClassName(); + $this->addToAssertionCount(1); } else { $application = new \OCP\AppFramework\App($app); + $this->addToAssertionCount(1); } if (isset($appInfo['background-jobs'])) { diff --git a/tests/lib/IntegrityCheck/Helpers/FileAccessHelperTest.php b/tests/lib/IntegrityCheck/Helpers/FileAccessHelperTest.php index de4aeec78cc..4e581c0f2e2 100644 --- a/tests/lib/IntegrityCheck/Helpers/FileAccessHelperTest.php +++ b/tests/lib/IntegrityCheck/Helpers/FileAccessHelperTest.php @@ -64,5 +64,6 @@ class FileAccessHelperTest extends TestCase { public function testAssertDirectoryExists() { $this->fileAccessHelper->assertDirectoryExists(\OC::$server->getTempManager()->getTemporaryFolder('/testfolder/')); + $this->addToAssertionCount(1); } } diff --git a/tests/lib/RichObjectStrings/ValidatorTest.php b/tests/lib/RichObjectStrings/ValidatorTest.php index f18d1bdd908..0c344248f77 100644 --- a/tests/lib/RichObjectStrings/ValidatorTest.php +++ b/tests/lib/RichObjectStrings/ValidatorTest.php @@ -49,6 +49,7 @@ class ValidatorTest extends TestCase { 'path' => 'path/to/test.txt', ], ]); + $this->addToAssertionCount(2); } } diff --git a/tests/lib/Security/CSP/ContentSecurityPolicyManagerTest.php b/tests/lib/Security/CSP/ContentSecurityPolicyManagerTest.php index f0fb1610d98..25c92571441 100644 --- a/tests/lib/Security/CSP/ContentSecurityPolicyManagerTest.php +++ b/tests/lib/Security/CSP/ContentSecurityPolicyManagerTest.php @@ -35,6 +35,7 @@ class ContentSecurityPolicyManagerTest extends \Test\TestCase { public function testAddDefaultPolicy() { $this->contentSecurityPolicyManager->addDefaultPolicy(new \OCP\AppFramework\Http\ContentSecurityPolicy()); + $this->addToAssertionCount(1); } public function testGetDefaultPolicyWithPolicies() { diff --git a/tests/lib/Share20/ManagerTest.php b/tests/lib/Share20/ManagerTest.php index d52cb48e479..cc98223d4b5 100644 --- a/tests/lib/Share20/ManagerTest.php +++ b/tests/lib/Share20/ManagerTest.php @@ -779,6 +779,7 @@ class ManagerTest extends \Test\TestCase { try { self::invokePrivate($this->manager, 'validateExpirationDate', [$share]); + $this->addToAssertionCount(1); } catch (\OCP\Share\Exceptions\GenericShareException $e) { $this->assertEquals('Cannot set expiration date more than 3 days in the future', $e->getMessage()); $this->assertEquals('Cannot set expiration date more than 3 days in the future', $e->getHint()); @@ -1008,6 +1009,7 @@ class ManagerTest extends \Test\TestCase { ->willReturn([]); self::invokePrivate($this->manager, 'userCreateChecks', [$share]); + $this->addToAssertionCount(1); } /** @@ -1143,6 +1145,7 @@ class ManagerTest extends \Test\TestCase { ->willReturn([$share2]); self::invokePrivate($this->manager, 'userCreateChecks', [$share]); + $this->addToAssertionCount(1); } /** @@ -1237,6 +1240,7 @@ class ManagerTest extends \Test\TestCase { ])); self::invokePrivate($this->manager, 'groupCreateChecks', [$share]); + $this->addToAssertionCount(1); } /** @@ -1292,6 +1296,7 @@ class ManagerTest extends \Test\TestCase { ])); self::invokePrivate($this->manager, 'groupCreateChecks', [$share]); + $this->addToAssertionCount(1); } /** @@ -1360,6 +1365,7 @@ class ManagerTest extends \Test\TestCase { ])); self::invokePrivate($this->manager, 'linkCreateChecks', [$share]); + $this->addToAssertionCount(1); } public function testLinkCreateChecksReadOnly() { @@ -1375,6 +1381,7 @@ class ManagerTest extends \Test\TestCase { ])); self::invokePrivate($this->manager, 'linkCreateChecks', [$share]); + $this->addToAssertionCount(1); } /** @@ -1407,12 +1414,14 @@ class ManagerTest extends \Test\TestCase { $this->mountManager->method('findIn')->with('path')->willReturn([$mount]); self::invokePrivate($this->manager, 'pathCreateChecks', [$path]); + $this->addToAssertionCount(1); } public function testPathCreateChecksContainsNoFolder() { $path = $this->createMock(File::class); self::invokePrivate($this->manager, 'pathCreateChecks', [$path]); + $this->addToAssertionCount(1); } public function dataIsSharingDisabledForUser() { @@ -2744,6 +2753,7 @@ class ManagerTest extends \Test\TestCase { $this->defaultProvider->method('move')->with($share, 'recipient')->will($this->returnArgument(0)); $this->manager->moveShare($share, 'recipient'); + $this->addToAssertionCount(1); } /** @@ -2801,6 +2811,7 @@ class ManagerTest extends \Test\TestCase { $this->defaultProvider->method('move')->with($share, 'recipient')->will($this->returnArgument(0)); $this->manager->moveShare($share, 'recipient'); + $this->addToAssertionCount(1); } /** diff --git a/tests/lib/Support/CrashReport/RegistryTest.php b/tests/lib/Support/CrashReport/RegistryTest.php index b73bf2737ee..ba225ec1330 100644 --- a/tests/lib/Support/CrashReport/RegistryTest.php +++ b/tests/lib/Support/CrashReport/RegistryTest.php @@ -47,6 +47,7 @@ class RegistryTest extends TestCase { $exception = new Exception('test'); $this->registry->delegateReport($exception); + $this->addToAssertionCount(1); } public function testDelegateToAll() { |