Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Enhancement: Allow using duration option for execution order
- Loading branch information
1 parent
fceedb0
commit 3e79f77
Showing
3 changed files
with
50 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
11 changes: 11 additions & 0 deletions
11
tests/end-to-end/execution-order/_files/order-by-duration.phpunit.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
<phpunit | ||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
xsi:noNamespaceSchemaLocation="../../../../phpunit.xsd" | ||
executionOrder="duration" | ||
> | ||
<testsuites> | ||
<testsuite name="order-by-duration"> | ||
<directory>.</directory> | ||
</testsuite> | ||
</testsuites> | ||
</phpunit> |
35 changes: 35 additions & 0 deletions
35
tests/end-to-end/execution-order/order-by-duration-via-phpunit-xml.phpt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
--TEST-- | ||
phpunit --order-by=duration ./tests/end-to-end/execution-order/_files/TestWithDifferentDurations.php | ||
--FILE-- | ||
<?php | ||
|
||
$tmpResultCache = tempnam(sys_get_temp_dir(), __FILE__); | ||
file_put_contents($tmpResultCache, file_get_contents(__DIR__ . '/_files/TestWithDifferentDurations.phpunit.result.cache.txt')); | ||
|
||
$phpunitXmlConfig = __DIR__ . '/_files/order-by-duration.phpunit.xml'; | ||
|
||
$_SERVER['argv'][1] = '--configuration=' . $phpunitXmlConfig; | ||
$_SERVER['argv'][2] = '--debug'; | ||
$_SERVER['argv'][4] = '--cache-result'; | ||
$_SERVER['argv'][5] = '--cache-result-file=' . $tmpResultCache; | ||
$_SERVER['argv'][6] = 'TestWithDifferentDurations'; | ||
$_SERVER['argv'][7] = __DIR__ . '/_files/TestWithDifferentDurations.php'; | ||
|
||
require __DIR__ . '/../../bootstrap.php'; | ||
PHPUnit\TextUI\Command::main(); | ||
|
||
unlink($tmpResultCache); | ||
--EXPECTF-- | ||
PHPUnit %s by Sebastian Bergmann and contributors. | ||
|
||
Test 'TestWithDifferentDurations::testTwo' started | ||
Test 'TestWithDifferentDurations::testTwo' ended | ||
Test 'TestWithDifferentDurations::testOne' started | ||
Test 'TestWithDifferentDurations::testOne' ended | ||
Test 'TestWithDifferentDurations::testThree' started | ||
Test 'TestWithDifferentDurations::testThree' ended | ||
|
||
|
||
Time: %s, Memory: %s | ||
|
||
OK (3 tests, 3 assertions) |