From e56823abc074f26a128a4850484dc0c253c1629e Mon Sep 17 00:00:00 2001 From: Raul Ferriz Date: Sat, 21 May 2016 17:39:23 +0200 Subject: [PATCH] Fix Dbh module seeInDatabase or dontSeeInDatabase with empty criteria. (#3117) Fixes #3116 --- CHANGELOG.md | 1 + src/Codeception/Module/Dbh.php | 6 +++++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index c3115b5df5..fe44f14280 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,7 @@ #### 2.1.9 +* [Dbh] Fix seeInDatabase and dontSeeInDatabase with empty criteria. Closes #3116 * [Symfony] Improve fail messages on seeInCurrentRoute and seeCurrentRouteIs * [Symfony] Improve route comparison on seeInCurrentRoute and seeCurrentRouteIs * [WebDriver] multi session testing with friends improved by @eXorus. Webdriver sessions are finished correctly; `leave()` method added to Friend class. See #3068 diff --git a/src/Codeception/Module/Dbh.php b/src/Codeception/Module/Dbh.php index 36570ec03d..54e696d6a6 100644 --- a/src/Codeception/Module/Dbh.php +++ b/src/Codeception/Module/Dbh.php @@ -113,7 +113,11 @@ protected function proceedSeeInDatabase($table, $column, $criteria) } $sparams = implode('AND ', $params); - $query = sprintf('select %s from %s where %s', $column, $table, $sparams); + if (empty($sparams)) { + $query = sprintf('select %s from %s', $column, $table); + } else { + $query = sprintf('select %s from %s where %s', $column, $table, $sparams); + } $this->debugSection('Query', $query, $sparams);