Skip to content

Commit bf2be08

Browse files
committed
Fix risky tests without assertions
Signed-off-by: Joas Schilling <[email protected]>
1 parent 24af5c2 commit bf2be08

File tree

45 files changed

+107
-67
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

45 files changed

+107
-67
lines changed

apps/dav/tests/unit/AppInfo/ApplicationTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,6 @@ public function testContactsManagerSetup() {
6161
/** @var IManager|\PHPUnit_Framework_MockObject_MockObject $cm */
6262
$cm = $this->createMock(IManager::class);
6363
$app->setupContactsProvider($cm, 'xxx');
64-
$this->assertTrue(true);
64+
$this->addToAssertionCount(1);
6565
}
6666
}

apps/dav/tests/unit/CalDAV/AbstractCalDavBackend.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -176,7 +176,7 @@ protected function createEvent($calendarId, $start = '20130912T130000Z', $end =
176176
protected function assertAcl($principal, $privilege, $acl) {
177177
foreach($acl as $a) {
178178
if ($a['principal'] === $principal && $a['privilege'] === $privilege) {
179-
$this->assertTrue(true);
179+
$this->addToAssertionCount(1);
180180
return;
181181
}
182182
}
@@ -190,7 +190,7 @@ protected function assertNotAcl($principal, $privilege, $acl) {
190190
return;
191191
}
192192
}
193-
$this->assertTrue(true);
193+
$this->addToAssertionCount(1);
194194
}
195195

196196
protected function assertAccess($shouldHaveAcl, $principal, $privilege, $acl) {

apps/dav/tests/unit/CalDAV/CalendarTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -183,7 +183,7 @@ public function testPropPatch($ownerPrincipal, $principalUri, $mutations, $share
183183
->with(666, $propPatch);
184184
}
185185
$c->propPatch($propPatch);
186-
$this->assertTrue(true);
186+
$this->addToAssertionCount(1);
187187
}
188188

189189
/**

apps/dav/tests/unit/Connector/Sabre/CustomPropertiesBackendTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -174,7 +174,7 @@ public function testPropFindMissingFileSoftFail() {
174174
);
175175

176176
// no exception, soft fail
177-
$this->assertTrue(true);
177+
$this->addToAssertionCount(1);
178178
}
179179

180180
/**

apps/dav/tests/unit/Connector/Sabre/DirectoryTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -345,7 +345,7 @@ public function testMoveFailed($source, $destination, $updatables, $deletables)
345345
*/
346346
public function testMoveSuccess($source, $destination, $updatables, $deletables) {
347347
$this->moveTest($source, $destination, $updatables, $deletables);
348-
$this->assertTrue(true);
348+
$this->addToAssertionCount(1);
349349
}
350350

351351
/**

apps/dav/tests/unit/Connector/Sabre/FilesPluginTest.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -383,6 +383,8 @@ public function testGetPropertiesWhenNoPermission() {
383383
$propFind,
384384
$node
385385
);
386+
387+
$this->addToAssertionCount(1);
386388
}
387389

388390
public function testUpdateProps() {

apps/encryption/tests/Hooks/UserHooksTest.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -110,15 +110,15 @@ public function testLogout() {
110110
$this->sessionMock->expects($this->once())
111111
->method('clear');
112112
$this->instance->logout();
113-
$this->assertTrue(true);
113+
$this->addToAssertionCount(1);
114114
}
115115

116116
public function testPostCreateUser() {
117117
$this->userSetupMock->expects($this->once())
118118
->method('setupUser');
119119

120120
$this->instance->postCreateUser($this->params);
121-
$this->assertTrue(true);
121+
$this->addToAssertionCount(1);
122122
}
123123

124124
public function testPostDeleteUser() {
@@ -127,7 +127,7 @@ public function testPostDeleteUser() {
127127
->with('testUser');
128128

129129
$this->instance->postDeleteUser($this->params);
130-
$this->assertTrue(true);
130+
$this->addToAssertionCount(1);
131131
}
132132

133133
public function testPrePasswordReset() {

apps/encryption/tests/RecoveryTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -213,7 +213,7 @@ public function testRecoverUserFiles() {
213213
$this->cryptMock->expects($this->once())
214214
->method('decryptPrivateKey');
215215
$this->instance->recoverUsersFiles('password', 'admin');
216-
$this->assertTrue(true);
216+
$this->addToAssertionCount(1);
217217
}
218218

219219
public function testRecoverFile() {

apps/files_external/tests/Service/UserGlobalStoragesServiceTest.php

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -304,66 +304,66 @@ public function testGetUniqueStorages(
304304

305305
public function testGetStoragesBackendNotVisible() {
306306
// we don't test this here
307-
$this->assertTrue(true);
307+
$this->addToAssertionCount(1);
308308
}
309309

310310
public function testGetStoragesAuthMechanismNotVisible() {
311311
// we don't test this here
312-
$this->assertTrue(true);
312+
$this->addToAssertionCount(1);
313313
}
314314

315315
public function testHooksAddStorage($a = null, $b = null, $c = null) {
316316
// we don't test this here
317-
$this->assertTrue(true);
317+
$this->addToAssertionCount(1);
318318
}
319319

320320
public function testHooksUpdateStorage($a = null, $b = null, $c = null, $d = null, $e = null) {
321321
// we don't test this here
322-
$this->assertTrue(true);
322+
$this->addToAssertionCount(1);
323323
}
324324

325325
public function testHooksRenameMountPoint() {
326326
// we don't test this here
327-
$this->assertTrue(true);
327+
$this->addToAssertionCount(1);
328328
}
329329

330330
public function testHooksDeleteStorage($a = null, $b = null, $c = null) {
331331
// we don't test this here
332-
$this->assertTrue(true);
332+
$this->addToAssertionCount(1);
333333
}
334334

335335
public function testLegacyConfigConversionApplicableAll() {
336336
// we don't test this here
337-
$this->assertTrue(true);
337+
$this->addToAssertionCount(1);
338338
}
339339

340340
public function testLegacyConfigConversionApplicableUserAndGroup() {
341341
// we don't test this here
342-
$this->assertTrue(true);
342+
$this->addToAssertionCount(1);
343343
}
344344

345345
public function testReadLegacyConfigAndGenerateConfigId() {
346346
// we don't test this here
347-
$this->assertTrue(true);
347+
$this->addToAssertionCount(1);
348348
}
349349

350350
public function testReadLegacyConfigNoAuthMechanism() {
351351
// we don't test this here
352-
$this->assertTrue(true);
352+
$this->addToAssertionCount(1);
353353
}
354354

355355
public function testReadLegacyConfigClass() {
356356
// we don't test this here
357-
$this->assertTrue(true);
357+
$this->addToAssertionCount(1);
358358
}
359359

360360
public function testReadEmptyMountPoint() {
361361
// we don't test this here
362-
$this->assertTrue(true);
362+
$this->addToAssertionCount(1);
363363
}
364364

365365
public function testUpdateStorageMountPoint() {
366366
// we don't test this here
367-
$this->assertTrue(true);
367+
$this->addToAssertionCount(1);
368368
}
369369
}

apps/files_sharing/tests/ApiTest.php

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -236,7 +236,7 @@ public function testCreateShareLinkPublicUpload() {
236236
$ocs->cleanup();
237237
}
238238

239-
function testEnfoceLinkPassword() {
239+
function testEnforceLinkPassword() {
240240

241241
$password = md5(time());
242242
$config = \OC::$server->getConfig();
@@ -288,6 +288,7 @@ function testEnfoceLinkPassword() {
288288
$ocs->cleanup();
289289

290290
$config->setAppValue('core', 'shareapi_enforce_links_password', 'no');
291+
$this->addToAssertionCount(1);
291292
}
292293

293294
/**
@@ -336,6 +337,8 @@ function testSharePermissions() {
336337
// cleanup
337338
\OC::$server->getConfig()->setAppValue('core', 'shareapi_exclude_groups', 'no');
338339
\OC::$server->getConfig()->setAppValue('core', 'shareapi_exclude_groups_list', '');
340+
341+
$this->addToAssertionCount(1);
339342
}
340343

341344

@@ -1102,6 +1105,7 @@ function testDeleteReshare() {
11021105
$ocs->cleanup();
11031106

11041107
$this->shareManager->deleteShare($share1);
1108+
$this->addToAssertionCount(1);
11051109
}
11061110

11071111
/**

0 commit comments

Comments
 (0)