-
-
Notifications
You must be signed in to change notification settings - Fork 2.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
120 additions
and
1 deletion.
There are no files selected for viewing
2 changes: 1 addition & 1 deletion
2
tests/end-to-end/execution-order/_files/TestWithDifferentDurations.phpunit.result.cache.txt
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 |
---|---|---|
@@ -1 +1 @@ | ||
{"version":1,"defects":[],"times":{"TestWithDifferentDurations::testOne":1,"TestWithDifferentDurations::testTwo":0.5,"TestWithDifferentDurations::testThree":1.5}} | ||
{"version":1,"defects":[],"times":{"PHPUnit\\TestFixture\\TestWithDifferentDurations::testOne":2.006,"PHPUnit\\TestFixture\\TestWithDifferentDurations::testTwo":0,"PHPUnit\\TestFixture\\TestWithDifferentDurations::testThree":3.001,"PHPUnit\\TestFixture\\ExampleTest::testOne":2.006,"PHPUnit\\TestFixture\\ExampleTest::testTwo":3.001,"PHPUnit\\TestFixture\\ExampleTest::testThree":0}} |
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"> | ||
<file>./TestWithDifferentDurations.php</file> | ||
</testsuite> | ||
</testsuites> | ||
</phpunit> |
53 changes: 53 additions & 0 deletions
53
tests/end-to-end/execution-order/order-by-duration-via-cli.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,53 @@ | ||
--TEST-- | ||
phpunit --order-by=duration ./tests/end-to-end/execution-order/_files/TestWithDifferentDurations.php | ||
--FILE-- | ||
<?php declare(strict_types=1); | ||
$cacheDirectory = sys_get_temp_dir() . DIRECTORY_SEPARATOR . sha1(__FILE__); | ||
|
||
if (is_dir($cacheDirectory)) { | ||
rmdir($cacheDirectory); | ||
} | ||
|
||
mkdir($cacheDirectory); | ||
|
||
copy(__DIR__ . '/_files/TestWithDifferentDurations.phpunit.result.cache.txt', $cacheDirectory . DIRECTORY_SEPARATOR . 'test-results'); | ||
|
||
$_SERVER['argv'][] = '--do-not-cache-result'; | ||
$_SERVER['argv'][] = '--no-configuration'; | ||
$_SERVER['argv'][] = '--debug'; | ||
$_SERVER['argv'][] = '--order-by=duration'; | ||
$_SERVER['argv'][] = '--cache-result'; | ||
$_SERVER['argv'][] = '--cache-directory=' . $cacheDirectory; | ||
$_SERVER['argv'][] = __DIR__ . '/_files/TestWithDifferentDurations.php'; | ||
|
||
require_once __DIR__ . '/../../bootstrap.php'; | ||
|
||
(new PHPUnit\TextUI\Application)->run($_SERVER['argv']); | ||
|
||
unlink($cacheDirectory . DIRECTORY_SEPARATOR . 'test-results'); | ||
rmdir($cacheDirectory); | ||
--EXPECTF-- | ||
PHPUnit Started (PHPUnit %s using PHP %s) | ||
Test Runner Configured | ||
Event Facade Sealed | ||
Test Suite Loaded (3 tests) | ||
Test Runner Started | ||
Test Suite Sorted | ||
Test Runner Execution Started (3 tests) | ||
Test Suite Started (PHPUnit\TestFixture\TestWithDifferentDurations, 3 tests) | ||
Test Preparation Started (PHPUnit\TestFixture\TestWithDifferentDurations::testTwo) | ||
Test Prepared (PHPUnit\TestFixture\TestWithDifferentDurations::testTwo) | ||
Test Passed (PHPUnit\TestFixture\TestWithDifferentDurations::testTwo) | ||
Test Finished (PHPUnit\TestFixture\TestWithDifferentDurations::testTwo) | ||
Test Preparation Started (PHPUnit\TestFixture\TestWithDifferentDurations::testOne) | ||
Test Prepared (PHPUnit\TestFixture\TestWithDifferentDurations::testOne) | ||
Test Passed (PHPUnit\TestFixture\TestWithDifferentDurations::testOne) | ||
Test Finished (PHPUnit\TestFixture\TestWithDifferentDurations::testOne) | ||
Test Preparation Started (PHPUnit\TestFixture\TestWithDifferentDurations::testThree) | ||
Test Prepared (PHPUnit\TestFixture\TestWithDifferentDurations::testThree) | ||
Test Passed (PHPUnit\TestFixture\TestWithDifferentDurations::testThree) | ||
Test Finished (PHPUnit\TestFixture\TestWithDifferentDurations::testThree) | ||
Test Suite Finished (PHPUnit\TestFixture\TestWithDifferentDurations, 3 tests) | ||
Test Runner Execution Finished | ||
Test Runner Finished | ||
PHPUnit Finished (Shell Exit Code: 0) |
55 changes: 55 additions & 0 deletions
55
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,55 @@ | ||
--TEST-- | ||
phpunit --configuration=order-by-duration.phpunit.xml | ||
--FILE-- | ||
<?php declare(strict_types=1); | ||
$cacheDirectory = sys_get_temp_dir() . DIRECTORY_SEPARATOR . sha1(__FILE__); | ||
|
||
if (is_dir($cacheDirectory)) { | ||
rmdir($cacheDirectory); | ||
} | ||
|
||
mkdir($cacheDirectory); | ||
|
||
copy(__DIR__ . '/_files/TestWithDifferentDurations.phpunit.result.cache.txt', $cacheDirectory . DIRECTORY_SEPARATOR . 'test-results'); | ||
|
||
$_SERVER['argv'][] = '--do-not-cache-result'; | ||
$_SERVER['argv'][] = '--configuration=' . __DIR__ . '/_files/order-by-duration.phpunit.xml'; | ||
$_SERVER['argv'][] = '--debug'; | ||
$_SERVER['argv'][] = '--cache-result'; | ||
$_SERVER['argv'][] = '--cache-directory=' . $cacheDirectory; | ||
|
||
require_once __DIR__ . '/../../bootstrap.php'; | ||
|
||
(new PHPUnit\TextUI\Application)->run($_SERVER['argv']); | ||
|
||
unlink($cacheDirectory . DIRECTORY_SEPARATOR . 'test-results'); | ||
rmdir($cacheDirectory); | ||
--EXPECTF-- | ||
PHPUnit Started (PHPUnit %s using PHP %s) | ||
Test Runner Configured | ||
Event Facade Sealed | ||
Test Suite Loaded (3 tests) | ||
Test Runner Started | ||
Test Suite Sorted | ||
Test Runner Execution Started (3 tests) | ||
Test Suite Started (%sorder-by-duration.phpunit.xml, 3 tests) | ||
Test Suite Started (order-by-duration, 3 tests) | ||
Test Suite Started (PHPUnit\TestFixture\TestWithDifferentDurations, 3 tests) | ||
Test Preparation Started (PHPUnit\TestFixture\TestWithDifferentDurations::testTwo) | ||
Test Prepared (PHPUnit\TestFixture\TestWithDifferentDurations::testTwo) | ||
Test Passed (PHPUnit\TestFixture\TestWithDifferentDurations::testTwo) | ||
Test Finished (PHPUnit\TestFixture\TestWithDifferentDurations::testTwo) | ||
Test Preparation Started (PHPUnit\TestFixture\TestWithDifferentDurations::testOne) | ||
Test Prepared (PHPUnit\TestFixture\TestWithDifferentDurations::testOne) | ||
Test Passed (PHPUnit\TestFixture\TestWithDifferentDurations::testOne) | ||
Test Finished (PHPUnit\TestFixture\TestWithDifferentDurations::testOne) | ||
Test Preparation Started (PHPUnit\TestFixture\TestWithDifferentDurations::testThree) | ||
Test Prepared (PHPUnit\TestFixture\TestWithDifferentDurations::testThree) | ||
Test Passed (PHPUnit\TestFixture\TestWithDifferentDurations::testThree) | ||
Test Finished (PHPUnit\TestFixture\TestWithDifferentDurations::testThree) | ||
Test Suite Finished (PHPUnit\TestFixture\TestWithDifferentDurations, 3 tests) | ||
Test Suite Finished (order-by-duration, 3 tests) | ||
Test Suite Finished (%sorder-by-duration.phpunit.xml, 3 tests) | ||
Test Runner Execution Finished | ||
Test Runner Finished | ||
PHPUnit Finished (Shell Exit Code: 0) |