Skip to content

Commit 4930c7a

Browse files
committed
Remove the AbstractTestCase::assertAllQueriesConsumed method
Uses the DummyDbi method instead. Signed-off-by: Maurício Meneghini Fauth <mauricio@fauth.dev>
1 parent 8543e0a commit 4930c7a

6 files changed

Lines changed: 17 additions & 23 deletions

File tree

test/classes/AbstractTestCase.php

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -102,12 +102,6 @@ protected function setUp(): void
102102
Cache::purge();
103103
}
104104

105-
protected function assertAllQueriesConsumed(): void
106-
{
107-
$unUsedQueries = $this->dummyDbi->getUnUsedQueries();
108-
$this->assertSame([], $unUsedQueries, 'Some queries where not used !');
109-
}
110-
111105
protected function assertAllSelectsConsumed(): void
112106
{
113107
$unUsedSelects = $this->dummyDbi->getUnUsedDatabaseSelects();

test/classes/Controllers/Import/ImportControllerTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,6 @@ public function testIndexParametrized(): void
7272
$this->getResponseHtmlResult()
7373
);
7474

75-
$this->assertAllQueriesConsumed();
75+
$this->dummyDbi->assertAllQueriesConsumed();
7676
}
7777
}

test/classes/Controllers/NavigationControllerTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,7 @@ public function testIndex(): void
161161
. '</div>',
162162
$responseMessage
163163
);
164-
$this->assertAllQueriesConsumed();
164+
$this->dummyDbi->assertAllQueriesConsumed();
165165
}
166166

167167
public function testIndexWithPosAndValue(): void
@@ -427,6 +427,6 @@ public function testIndexWithPosAndValue(): void
427427
. '</div>' . "\n",
428428
$responseMessage
429429
);
430-
$this->assertAllQueriesConsumed();
430+
$this->dummyDbi->assertAllQueriesConsumed();
431431
}
432432
}

test/classes/Plugins/Import/ImportCsvTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -262,7 +262,7 @@ public function testDoImportNormal(): void
262262
);
263263

264264
$this->assertEquals(true, $GLOBALS['finished']);
265-
$this->assertAllQueriesConsumed();
265+
$this->dummyDbi->assertAllQueriesConsumed();
266266
}
267267

268268
/**
@@ -306,6 +306,6 @@ public function testDoImportSkipHeaders(): void
306306
);
307307

308308
$this->assertEquals(true, $GLOBALS['finished']);
309-
$this->assertAllQueriesConsumed();
309+
$this->dummyDbi->assertAllQueriesConsumed();
310310
}
311311
}

test/classes/StorageEngineTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -335,7 +335,7 @@ public function testHasMroongaEngine(): void
335335
$this->dummyDbi->addResult('SELECT mroonga_command(\'object_list\');', false);
336336
$this->assertFalse(StorageEngine::hasMroongaEngine());
337337

338-
$this->assertAllQueriesConsumed();
338+
$this->dummyDbi->assertAllQueriesConsumed();
339339
}
340340

341341
public function testGetMroongaLengths(): void
@@ -706,6 +706,6 @@ public function testGetMroongaLengths(): void
706706
$this->assertAllSelectsConsumed();
707707
$this->assertSame([4521984, 578126], $lengths);
708708

709-
$this->assertAllQueriesConsumed();
709+
$this->dummyDbi->assertAllQueriesConsumed();
710710
}
711711
}

test/classes/TwoFactorTest.php

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -175,7 +175,7 @@ public function testNone(): void
175175
$this->assertTrue($object->check());
176176
$this->assertEquals('', $object->render());
177177

178-
$this->assertAllQueriesConsumed();
178+
$this->dummyDbi->assertAllQueriesConsumed();
179179

180180
$this->loadResultForConfig(['type' => 'db']);
181181
$this->loadQueriesForConfigure('');
@@ -216,7 +216,7 @@ public function testConfigureSimple(): void
216216
$GLOBALS['cfg']['DBG']['simple2fa'] = true;
217217
$object = $this->getTwoFactorAndLoadConfig('user', null);
218218

219-
$this->assertAllQueriesConsumed();
219+
$this->dummyDbi->assertAllQueriesConsumed();
220220

221221
$this->loadResultForConfig([]);
222222
$this->loadQueriesForConfigure('simple');
@@ -225,7 +225,7 @@ public function testConfigureSimple(): void
225225
$backend = $object->getBackend();
226226
$this->assertEquals('simple', $backend::$id);
227227

228-
$this->assertAllQueriesConsumed();
228+
$this->dummyDbi->assertAllQueriesConsumed();
229229

230230
$this->loadResultForConfig([]);
231231
$this->loadQueriesForConfigure('');
@@ -234,14 +234,14 @@ public function testConfigureSimple(): void
234234
$backend = $object->getBackend();
235235
$this->assertEquals('', $backend::$id);
236236

237-
$this->assertAllQueriesConsumed();
237+
$this->dummyDbi->assertAllQueriesConsumed();
238238

239239
$this->initStorageConfigAndData();// Needs a re-init
240240

241241
$GLOBALS['cfg']['DBG']['simple2fa'] = false;
242242
$object = $this->getTwoFactorAndLoadConfig('user', null);
243243
$this->assertFalse($object->configure('simple'));
244-
$this->assertAllQueriesConsumed();
244+
$this->dummyDbi->assertAllQueriesConsumed();
245245
}
246246

247247
/**
@@ -275,15 +275,15 @@ public function testApplication(): void
275275
$google2fa->getTimestamp()
276276
);
277277

278-
$this->assertAllQueriesConsumed();
278+
$this->dummyDbi->assertAllQueriesConsumed();
279279
$this->loadResultForConfig([]);
280280
$this->loadQueriesForConfigure('application', [
281281
'secret' => $object->config['settings']['secret'],
282282
]);
283283

284284
$this->assertTrue($object->configure('application'));
285285

286-
$this->assertAllQueriesConsumed();
286+
$this->dummyDbi->assertAllQueriesConsumed();
287287
unset($_POST['2fa_code']);
288288

289289
/* Check code */
@@ -405,7 +405,7 @@ public function testKeyAuthentication(): void
405405
. 'ZLVGZuelRPU2FOVU9XUXhSZDlUV3o1YUZPZzgiLCAib3JpZ2luIjogImh0dHA6XC9cL2RlbW8uZXhhbXB'
406406
. 'sZS5jb20iLCAidHlwIjogIm5hdmlnYXRvci5pZC5maW5pc2hFbnJvbGxtZW50IiB9", "errorCode": 0 }';
407407

408-
$this->assertAllQueriesConsumed();
408+
$this->dummyDbi->assertAllQueriesConsumed();
409409
$this->loadResultForConfig([]);
410410
$this->loadQueriesForConfigure('key', [
411411
'registrations' => [
@@ -454,7 +454,7 @@ public function testKeyAuthentication(): void
454454
. 'yejRmVWpnYzBRN2ciLCAib3JpZ2luIjogImh0dHA6XC9cL2RlbW8uZXhhbXBsZS5jb20iLCAidHlwI'
455455
. 'jogIm5hdmlnYXRvci5pZC5nZXRBc3NlcnRpb24iIH0=", "keyHandle": "CTUayZo8hCBeC-sGQJC'
456456
. 'hC0wW-bBg99bmOlGCgw8XGq4dLsxO3yWh9mRYArZxocP5hBB1pEGB3bbJYiM-5acc5w", "errorCode": 0 }';
457-
$this->assertAllQueriesConsumed();
457+
$this->dummyDbi->assertAllQueriesConsumed();
458458
$this->loadResultForConfig([]);
459459
$this->loadQueriesForConfigure('key', [
460460
'registrations' => [
@@ -481,7 +481,7 @@ public function testKeyAuthentication(): void
481481
],
482482
]);
483483
$this->assertTrue($object->check(true));
484-
$this->assertAllQueriesConsumed();
484+
$this->dummyDbi->assertAllQueriesConsumed();
485485
}
486486

487487
/**

0 commit comments

Comments
 (0)