From 18f5b7b8fb7cddb699fa885b03e3aae7c5d057f1 Mon Sep 17 00:00:00 2001 From: Markus Staab Date: Fri, 27 May 2022 14:54:40 +0200 Subject: [PATCH] added failling test for bug 385 --- tests/rules/QueryPlanAnalyzerRuleTest.php | 15 +++++++++++++++ tests/rules/data/query-plan-analyzer.php | 6 ++++++ 2 files changed, 21 insertions(+) diff --git a/tests/rules/QueryPlanAnalyzerRuleTest.php b/tests/rules/QueryPlanAnalyzerRuleTest.php index a7b3eee13..ff32aa527 100644 --- a/tests/rules/QueryPlanAnalyzerRuleTest.php +++ b/tests/rules/QueryPlanAnalyzerRuleTest.php @@ -72,6 +72,21 @@ public function testNotUsingIndex(): void 22, $tip, ], + [ + "Query is not using an index on table 'ada'.".$proposal, + 23, + $tip, + ], + [ + "Query is not using an index on table 'ada'.".$proposal, + 28, + $tip, + ], + [ + "Query is not using an index on table 'ada'.".$proposal, + 56, + $tip, + ], ]); } } diff --git a/tests/rules/data/query-plan-analyzer.php b/tests/rules/data/query-plan-analyzer.php index ce9de7dbb..2b43d9a5c 100644 --- a/tests/rules/data/query-plan-analyzer.php +++ b/tests/rules/data/query-plan-analyzer.php @@ -39,4 +39,10 @@ public function writes(PDO $pdo, int $adaid): void $pdo->query('REPLACE INTO `ada` SET email="test" WHERE adaid = '.$adaid); $pdo->query('DELETE FROM `ada` WHERE adaid = '.$adaid); } + + public function bug385(PDO $pdo, string $email): void + { + $stmt = $pdo->query('SELECT * FROM `ada` WHERE email = ?'); + $stmt->execute([$email]); + } }