Skip to content

Commit

Permalink
Fix type error
Browse files Browse the repository at this point in the history
  • Loading branch information
norkunas committed Jun 25, 2019
1 parent 57d73fc commit 7b8ee3e
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 0 deletions.
Expand Up @@ -138,6 +138,9 @@ private function sanitizeQuery($connectionName, $query)
if (!\is_array($query['params'])) {
$query['params'] = [$query['params']];
}
if (!\is_array($query['types'])) {
$query['types'] = [];
}
foreach ($query['params'] as $j => $param) {
if (isset($query['types'][$j])) {
// Transform the param according to the type
Expand Down
Expand Up @@ -102,6 +102,18 @@ public function testCollectQueryWithNoParams()
$this->assertTrue($collectedQueries['default'][1]['explainable']);
}

public function testCollectQueryWithNoTypes()
{
$queries = [
['sql' => 'SET sql_mode=(SELECT REPLACE(@@sql_mode, \'ONLY_FULL_GROUP_BY\', \'\'))', 'params' => [], 'types' => null, 'executionMS' => 1],
];
$c = $this->createCollector($queries);
$c->collect(new Request(), new Response());

$collectedQueries = $c->getQueries();
$this->assertSame([], $collectedQueries['default'][0]['types']);
}

public function testReset()
{
$queries = [
Expand Down

0 comments on commit 7b8ee3e

Please sign in to comment.