Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
D
doctrine-dbal
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Tomáš Trávníček
doctrine-dbal
Commits
a900ed83
Commit
a900ed83
authored
Apr 08, 2015
by
Steve Müller
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #822 from DHager/trailing_stopwatch_fix
Fix for bad profiling data, showing an indefinitely long query
parents
26195bed
c66fccab
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
46 additions
and
3 deletions
+46
-3
Statement.php
lib/Doctrine/DBAL/Statement.php
+3
-0
StatementTest.php
tests/Doctrine/Tests/DBAL/StatementTest.php
+43
-3
No files found.
lib/Doctrine/DBAL/Statement.php
View file @
a900ed83
...
...
@@ -164,6 +164,9 @@ class Statement implements \IteratorAggregate, DriverStatement
try
{
$stmt
=
$this
->
stmt
->
execute
(
$params
);
}
catch
(
\Exception
$ex
)
{
if
(
$logger
)
{
$logger
->
stopQuery
();
}
throw
DBALException
::
driverExceptionDuringQuery
(
$this
->
conn
->
getDriver
(),
$ex
,
...
...
tests/Doctrine/Tests/DBAL/StatementTest.php
View file @
a900ed83
...
...
@@ -17,15 +17,20 @@ class StatementTest extends \Doctrine\Tests\DbalTestCase
* @var \Doctrine\DBAL\Configuration
*/
private
$configuration
;
/**
* @var \PDOStatement
*/
private
$pdoStatement
;
public
function
setUp
()
{
$
pdoStatement
=
$this
->
getMock
(
'\PDOStat
ment'
,
array
(
'execute'
,
'bindParam'
,
'bindValue'
));
$
this
->
pdoStatement
=
$this
->
getMock
(
'\PDOState
ment'
,
array
(
'execute'
,
'bindParam'
,
'bindValue'
));
$platform
=
new
\Doctrine\Tests\DBAL\Mocks\MockPlatform
();
$driverConnection
=
$this
->
getMock
(
'\Doctrine\DBAL\Driver\Connection'
);
$driverConnection
->
expects
(
$this
->
any
())
->
method
(
'prepare'
)
->
will
(
$this
->
returnValue
(
$pdoStatement
));
->
will
(
$this
->
returnValue
(
$
this
->
pdoStatement
));
$driver
=
$this
->
getMock
(
'\Doctrine\DBAL\Driver'
);
$constructorArgs
=
array
(
...
...
@@ -43,6 +48,11 @@ class StatementTest extends \Doctrine\Tests\DbalTestCase
$this
->
conn
->
expects
(
$this
->
any
())
->
method
(
'getConfiguration'
)
->
will
(
$this
->
returnValue
(
$this
->
configuration
));
$this
->
conn
->
expects
(
$this
->
any
())
->
method
(
'getDriver'
)
->
will
(
$this
->
returnValue
(
$driver
));
}
public
function
testExecuteCallsLoggerStartQueryWithParametersWhenValuesBound
()
...
...
@@ -88,4 +98,34 @@ class StatementTest extends \Doctrine\Tests\DbalTestCase
$statement
=
new
Statement
(
$sql
,
$this
->
conn
);
$statement
->
execute
(
$values
);
}
/**
* @expectedException \Doctrine\DBAL\DBALException
*/
public
function
testExecuteCallsLoggerStopQueryOnException
()
{
$logger
=
$this
->
getMock
(
'\Doctrine\DBAL\Logging\SQLLogger'
);
$this
->
configuration
->
expects
(
$this
->
once
())
->
method
(
'getSQLLogger'
)
->
will
(
$this
->
returnValue
(
$logger
));
// Needed to satisfy construction of DBALException
$this
->
conn
->
expects
(
$this
->
any
())
->
method
(
'resolveParams'
)
->
will
(
$this
->
returnValue
(
array
()));
$logger
->
expects
(
$this
->
once
())
->
method
(
'startQuery'
);
$logger
->
expects
(
$this
->
once
())
->
method
(
'stopQuery'
);
$this
->
pdoStatement
->
expects
(
$this
->
once
())
->
method
(
'execute'
)
->
will
(
$this
->
throwException
(
new
\Exception
(
"Mock test exception"
)));
$statement
=
new
Statement
(
""
,
$this
->
conn
);
$statement
->
execute
();
}
}
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment