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
82411db8
Commit
82411db8
authored
Sep 10, 2015
by
Bill Schaller
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Change DbalPerformanceTestListener to report timings in __destruct instead of endTestSuite.
parent
669c03d6
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
13 additions
and
5 deletions
+13
-5
DbalPerformanceTestListener.php
tests/Doctrine/Tests/DbalPerformanceTestListener.php
+13
-5
No files found.
tests/Doctrine/Tests/DbalPerformanceTestListener.php
View file @
82411db8
...
...
@@ -16,24 +16,32 @@ class DbalPerformanceTestListener extends \PHPUnit_Framework_BaseTestListener
*/
public
function
endTest
(
\PHPUnit_Framework_Test
$test
,
$time
)
{
// This listener only applies to performance tests.
if
(
$test
instanceof
\Doctrine\Tests\DbalPerformanceTestCase
)
{
// Identify perf tests by class, method, and dataset
$class
=
str_replace
(
'Doctrine\Tests\DBAL\Performance\\'
,
''
,
get_class
(
$test
));
// Store timing data for each test in the order they were run.
$this
->
timings
[
$class
.
"::"
.
$test
->
getName
(
true
)]
=
$test
->
getTime
();
}
}
/**
* {@inheritdoc}
* Report performance test timings.
*
* Note: __destruct is used here because PHPUnit doesn't have a
* 'All tests over' hook.
*/
public
function
endTestSuite
(
\PHPUnit_Framework_TestSuite
$suite
)
public
function
__destruct
(
)
{
if
(
!
empty
(
$this
->
timings
))
{
print
(
"
\n
"
);
// Report timings.
print
(
"
\n\n
Performance test results:
\n\n
"
);
foreach
(
$this
->
timings
as
$test
=>
$time
)
{
printf
(
"%s: %
6
.3f
\n
"
,
$test
,
$time
);
printf
(
"%s: %.3f
\n
"
,
$test
,
$time
);
}
$this
->
timings
=
[];
}
}
}
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