Commit c664ce7f authored by Steve Müller's avatar Steve Müller

Merge pull request #2364 from Deltachaos/small-functional-test-case-formating

Add more information for failed queries in tests
parents 67ddb9b6 3d2b59c7
...@@ -50,7 +50,15 @@ class DbalFunctionalTestCase extends DbalTestCase ...@@ -50,7 +50,15 @@ class DbalFunctionalTestCase extends DbalTestCase
$queries = ""; $queries = "";
$i = count($this->_sqlLoggerStack->queries); $i = count($this->_sqlLoggerStack->queries);
foreach (array_reverse($this->_sqlLoggerStack->queries) as $query) { foreach (array_reverse($this->_sqlLoggerStack->queries) as $query) {
$params = array_map(function($p) { if (is_object($p)) return get_class($p); else return "'".$p."'"; }, $query['params'] ?: array()); $params = array_map(function($p) {
if (is_object($p)) {
return get_class($p);
} elseif (is_scalar($p)) {
return "'".$p."'";
} else {
return var_export($p, true);
}
}, $query['params'] ?: array());
$queries .= ($i+1).". SQL: '".$query['sql']."' Params: ".implode(", ", $params).PHP_EOL; $queries .= ($i+1).". SQL: '".$query['sql']."' Params: ".implode(", ", $params).PHP_EOL;
$i--; $i--;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment