Commit 8cbb70c6 authored by Benjamin Eberlei's avatar Benjamin Eberlei

DBAL-71 - Fix wrong exception call.

parent bfff0619
...@@ -43,6 +43,8 @@ class DebugStack implements SQLLogger ...@@ -43,6 +43,8 @@ class DebugStack implements SQLLogger
public $start = null; public $start = null;
public $currentQuery = 0;
/** /**
* {@inheritdoc} * {@inheritdoc}
*/ */
...@@ -50,7 +52,7 @@ class DebugStack implements SQLLogger ...@@ -50,7 +52,7 @@ class DebugStack implements SQLLogger
{ {
if ($this->enabled) { if ($this->enabled) {
$this->start = microtime(true); $this->start = microtime(true);
$this->queries[] = array('sql' => $sql, 'params' => $params, 'types' => $types, 'executionMS' => 0); $this->queries[++$this->currentQuery] = array('sql' => $sql, 'params' => $params, 'types' => $types, 'executionMS' => 0);
} }
} }
...@@ -59,7 +61,7 @@ class DebugStack implements SQLLogger ...@@ -59,7 +61,7 @@ class DebugStack implements SQLLogger
*/ */
public function stopQuery() public function stopQuery()
{ {
$this->queries[(count($this->queries)-1)]['executionMS'] = microtime(true) - $this->start; $this->queries[$this->currentQuery]['executionMS'] = microtime(true) - $this->start;
} }
} }
...@@ -1418,7 +1418,7 @@ abstract class AbstractPlatform ...@@ -1418,7 +1418,7 @@ abstract class AbstractPlatform
return $upper; return $upper;
break; break;
default: default:
throw \InvalidArgumentException('Invalid foreign key action: ' . $upper); throw new \InvalidArgumentException('Invalid foreign key action: ' . $upper);
} }
} }
......
...@@ -16,6 +16,12 @@ abstract class AbstractPlatformTestCase extends \Doctrine\Tests\DbalTestCase ...@@ -16,6 +16,12 @@ abstract class AbstractPlatformTestCase extends \Doctrine\Tests\DbalTestCase
$this->_platform = $this->createPlatform(); $this->_platform = $this->createPlatform();
} }
public function testGetInvalidtForeignKeyReferentialActionSQL()
{
$this->setExpectedException('InvalidArgumentException');
$this->_platform->getForeignKeyReferentialActionSQL('unknown');
}
public function testGetUnknownDoctrineMappingType() public function testGetUnknownDoctrineMappingType()
{ {
$this->setExpectedException('Doctrine\DBAL\DBALException'); $this->setExpectedException('Doctrine\DBAL\DBALException');
......
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