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
715b5898
Unverified
Commit
715b5898
authored
Mar 28, 2020
by
Sergei Morozov
Committed by
GitHub
Mar 28, 2020
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #3923 from morozov/remove-performance-tests
Removed performance tests
parents
9dcb41e4
cb81e400
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
1 addition
and
187 deletions
+1
-187
phpunit.xml.dist
phpunit.xml.dist
+1
-15
TypeConversionPerformanceTest.php
.../Tests/DBAL/Performance/TypeConversionPerformanceTest.php
+0
-44
DbalPerformanceTestCase.php
tests/Doctrine/Tests/DbalPerformanceTestCase.php
+0
-63
DbalPerformanceTestListener.php
tests/Doctrine/Tests/DbalPerformanceTestListener.php
+0
-65
No files found.
phpunit.xml.dist
View file @
715b5898
...
...
@@ -44,11 +44,7 @@
<testsuites>
<testsuite
name=
"Doctrine DBAL Test Suite"
>
<directory>
./tests/Doctrine/Tests/DBAL
</directory>
<exclude>
./tests/Doctrine/Tests/DBAL/Performance
</exclude>
</testsuite>
<testsuite
name=
"Doctrine DBAL Performance Test Suite"
>
<directory>
./tests/Doctrine/Tests/DBAL/Performance
</directory>
<directory>
tests/Doctrine/Tests/DBAL
</directory>
</testsuite>
</testsuites>
...
...
@@ -57,14 +53,4 @@
<directory
suffix=
".php"
>
lib/Doctrine
</directory>
</whitelist>
</filter>
<listeners>
<listener
class=
"Doctrine\Tests\DbalPerformanceTestListener"
/>
</listeners>
<groups>
<exclude>
<group>
performance
</group>
</exclude>
</groups>
</phpunit>
tests/Doctrine/Tests/DBAL/Performance/TypeConversionPerformanceTest.php
deleted
100644 → 0
View file @
9dcb41e4
<?php
namespace
Doctrine\Tests\DBAL\Performance
;
use
DateTime
;
use
Doctrine\DBAL\DBALException
;
use
Doctrine\DBAL\Types\Type
;
use
Doctrine\Tests\DbalPerformanceTestCase
;
/**
* @group performance
*/
class
TypeConversionPerformanceTest
extends
DbalPerformanceTestCase
{
/**
* @throws DBALException
*
* @dataProvider itemCountProvider
*/
public
function
testDateTimeTypeConversionPerformance
(
int
$count
)
:
void
{
$value
=
new
DateTime
();
$type
=
Type
::
getType
(
'datetime'
);
$platform
=
$this
->
connection
->
getDatabasePlatform
();
$this
->
startTiming
();
for
(
$i
=
0
;
$i
<
$count
;
$i
++
)
{
$type
->
convertToDatabaseValue
(
$value
,
$platform
);
}
$this
->
stopTiming
();
}
/**
* @return mixed[][]
*/
public
static
function
itemCountProvider
()
:
iterable
{
return
[
'100 items'
=>
[
100
],
'1000 items'
=>
[
1000
],
'10000 items'
=>
[
10000
],
'100000 items'
=>
[
100000
],
];
}
}
tests/Doctrine/Tests/DbalPerformanceTestCase.php
deleted
100644 → 0
View file @
9dcb41e4
<?php
namespace
Doctrine\Tests
;
use
function
microtime
;
/**
* Base class for all DBAL performance tests.
*
* Tests implemented in this class must call startTiming at the beginning
* and stopTiming at the end of all tests. Tests that do not start or stop
* timing will fail.
*/
abstract
class
DbalPerformanceTestCase
extends
DbalFunctionalTestCase
{
/**
* time the test started
*
* @var float
*/
private
$startTime
;
/**
* elapsed run time of the last test
*
* @var float
*/
private
$runTime
;
/**
* {@inheritdoc}
*/
protected
function
assertPostConditions
()
:
void
{
// If a perf test doesn't start or stop, it fails.
self
::
assertNotNull
(
$this
->
startTime
,
'Test timing was started'
);
self
::
assertNotNull
(
$this
->
runTime
,
'Test timing was stopped'
);
}
/**
* begin timing
*/
protected
function
startTiming
()
:
void
{
$this
->
startTime
=
microtime
(
true
);
}
/**
* end timing
*/
protected
function
stopTiming
()
:
void
{
$this
->
runTime
=
microtime
(
true
)
-
$this
->
startTime
;
}
/**
* @return float elapsed test execution time
*/
public
function
getTime
()
:
float
{
return
$this
->
runTime
;
}
}
tests/Doctrine/Tests/DbalPerformanceTestListener.php
deleted
100644 → 0
View file @
9dcb41e4
<?php
namespace
Doctrine\Tests
;
use
PHPUnit\Framework\Test
;
use
PHPUnit\Framework\TestListener
;
use
PHPUnit\Framework\TestListenerDefaultImplementation
;
use
function
get_class
;
use
function
printf
;
use
function
str_replace
;
/**
* Listener for collecting and reporting results of performance tests
*/
class
DbalPerformanceTestListener
implements
TestListener
{
use
TestListenerDefaultImplementation
;
/** @var string[][] */
private
$timings
=
[];
/**
* {@inheritdoc}
*/
public
function
endTest
(
Test
$test
,
float
$time
)
:
void
{
// This listener only applies to performance tests.
if
(
!
(
$test
instanceof
DbalPerformanceTestCase
))
{
return
;
}
// we identify perf tests by class, method, and dataset
$class
=
str_replace
(
'\\Doctrine\\Tests\\DBAL\\Performance\\'
,
''
,
get_class
(
$test
));
if
(
!
isset
(
$this
->
timings
[
$class
]))
{
$this
->
timings
[
$class
]
=
[];
}
// Store timing data for each test in the order they were run.
$this
->
timings
[
$class
][
$test
->
getName
(
true
)]
=
$test
->
getTime
();
}
/**
* Report performance test timings.
*
* Note: __destruct is used here because PHPUnit doesn't have a
* 'All tests over' hook.
*/
public
function
__destruct
()
{
if
(
empty
(
$this
->
timings
))
{
return
;
}
// Report timings.
print
"
\n
Performance test results:
\n\n
"
;
foreach
(
$this
->
timings
as
$class
=>
$tests
)
{
printf
(
"%s:
\n
"
,
$class
);
foreach
(
$tests
as
$test
=>
$time
)
{
printf
(
"
\t
%s: %.3f seconds
\n
"
,
$test
,
$time
);
}
}
}
}
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