Skip to content

Commit 126dcea

Browse files
Closes #5980
1 parent f19334f commit 126dcea

File tree

4 files changed

+116
-1
lines changed

4 files changed

+116
-1
lines changed
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
{"version":1,"defects":[],"times":{"TestWithDifferentDurations::testOne":1,"TestWithDifferentDurations::testTwo":0.5,"TestWithDifferentDurations::testThree":1.5}}
1+
{"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}}
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
<phpunit
2+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
3+
xsi:noNamespaceSchemaLocation="../../../../phpunit.xsd"
4+
executionOrder="duration"
5+
>
6+
<testsuites>
7+
<testsuite name="order-by-duration">
8+
<file>./TestWithDifferentDurations.php</file>
9+
</testsuite>
10+
</testsuites>
11+
</phpunit>
Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
--TEST--
2+
phpunit --order-by=duration ./tests/end-to-end/execution-order/_files/TestWithDifferentDurations.php
3+
--FILE--
4+
<?php declare(strict_types=1);
5+
$tmpResultCache = sys_get_temp_dir() . DIRECTORY_SEPARATOR . sha1(__FILE__);
6+
7+
\copy(__DIR__ . '/_files/TestWithDifferentDurations.phpunit.result.cache.txt', $tmpResultCache);
8+
9+
$_SERVER['argv'][] = '--do-not-cache-result';
10+
$_SERVER['argv'][] = '--no-configuration';
11+
$_SERVER['argv'][] = '--debug';
12+
$_SERVER['argv'][] = '--order-by=duration';
13+
$_SERVER['argv'][] = '--cache-result';
14+
$_SERVER['argv'][] = '--cache-result-file=' . $tmpResultCache;
15+
$_SERVER['argv'][] = __DIR__ . '/_files/TestWithDifferentDurations.php';
16+
17+
require_once __DIR__ . '/../../bootstrap.php';
18+
19+
(new PHPUnit\TextUI\Application)->run($_SERVER['argv']);
20+
--EXPECTF--
21+
PHPUnit Started (PHPUnit %s using PHP %s)
22+
Test Runner Configured
23+
Test Suite Loaded (3 tests)
24+
Event Facade Sealed
25+
Test Runner Started
26+
Test Suite Sorted
27+
Test Runner Execution Started (3 tests)
28+
Test Suite Started (PHPUnit\TestFixture\TestWithDifferentDurations, 3 tests)
29+
Test Preparation Started (PHPUnit\TestFixture\TestWithDifferentDurations::testTwo)
30+
Test Prepared (PHPUnit\TestFixture\TestWithDifferentDurations::testTwo)
31+
Assertion Succeeded (Constraint: is true, Value: true)
32+
Test Passed (PHPUnit\TestFixture\TestWithDifferentDurations::testTwo)
33+
Test Finished (PHPUnit\TestFixture\TestWithDifferentDurations::testTwo)
34+
Test Preparation Started (PHPUnit\TestFixture\TestWithDifferentDurations::testOne)
35+
Test Prepared (PHPUnit\TestFixture\TestWithDifferentDurations::testOne)
36+
Assertion Succeeded (Constraint: is true, Value: true)
37+
Test Passed (PHPUnit\TestFixture\TestWithDifferentDurations::testOne)
38+
Test Finished (PHPUnit\TestFixture\TestWithDifferentDurations::testOne)
39+
Test Preparation Started (PHPUnit\TestFixture\TestWithDifferentDurations::testThree)
40+
Test Prepared (PHPUnit\TestFixture\TestWithDifferentDurations::testThree)
41+
Assertion Succeeded (Constraint: is true, Value: true)
42+
Test Passed (PHPUnit\TestFixture\TestWithDifferentDurations::testThree)
43+
Test Finished (PHPUnit\TestFixture\TestWithDifferentDurations::testThree)
44+
Test Suite Finished (PHPUnit\TestFixture\TestWithDifferentDurations, 3 tests)
45+
Test Runner Execution Finished
46+
Test Runner Finished
47+
PHPUnit Finished (Shell Exit Code: 0)
48+
--CLEAN--
49+
<?php declare(strict_types=1);
50+
unlink(sys_get_temp_dir() . DIRECTORY_SEPARATOR . sha1(__FILE__));
Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
--TEST--
2+
phpunit --configuration=order-by-duration.phpunit.xml
3+
--FILE--
4+
<?php declare(strict_types=1);
5+
$tmpResultCache = sys_get_temp_dir() . DIRECTORY_SEPARATOR . sha1(__FILE__);
6+
7+
\copy(__DIR__ . '/_files/TestWithDifferentDurations.phpunit.result.cache.txt', $tmpResultCache);
8+
9+
$phpunitXmlConfig = __DIR__ . '/_files/order-by-duration.phpunit.xml';
10+
11+
$_SERVER['argv'][] = '--do-not-cache-result';
12+
$_SERVER['argv'][] = '--configuration=' . $phpunitXmlConfig;
13+
$_SERVER['argv'][] = '--debug';
14+
$_SERVER['argv'][] = '--cache-result';
15+
$_SERVER['argv'][] = '--cache-result-file=' . $tmpResultCache;
16+
17+
require_once __DIR__ . '/../../bootstrap.php';
18+
19+
(new PHPUnit\TextUI\Application)->run($_SERVER['argv']);
20+
--EXPECTF--
21+
PHPUnit Started (PHPUnit %s using PHP %s)
22+
Test Runner Configured
23+
Test Suite Loaded (3 tests)
24+
Event Facade Sealed
25+
Test Runner Started
26+
Test Suite Sorted
27+
Test Runner Execution Started (3 tests)
28+
Test Suite Started (%sorder-by-duration.phpunit.xml, 3 tests)
29+
Test Suite Started (order-by-duration, 3 tests)
30+
Test Suite Started (PHPUnit\TestFixture\TestWithDifferentDurations, 3 tests)
31+
Test Preparation Started (PHPUnit\TestFixture\TestWithDifferentDurations::testTwo)
32+
Test Prepared (PHPUnit\TestFixture\TestWithDifferentDurations::testTwo)
33+
Assertion Succeeded (Constraint: is true, Value: true)
34+
Test Passed (PHPUnit\TestFixture\TestWithDifferentDurations::testTwo)
35+
Test Finished (PHPUnit\TestFixture\TestWithDifferentDurations::testTwo)
36+
Test Preparation Started (PHPUnit\TestFixture\TestWithDifferentDurations::testOne)
37+
Test Prepared (PHPUnit\TestFixture\TestWithDifferentDurations::testOne)
38+
Assertion Succeeded (Constraint: is true, Value: true)
39+
Test Passed (PHPUnit\TestFixture\TestWithDifferentDurations::testOne)
40+
Test Finished (PHPUnit\TestFixture\TestWithDifferentDurations::testOne)
41+
Test Preparation Started (PHPUnit\TestFixture\TestWithDifferentDurations::testThree)
42+
Test Prepared (PHPUnit\TestFixture\TestWithDifferentDurations::testThree)
43+
Assertion Succeeded (Constraint: is true, Value: true)
44+
Test Passed (PHPUnit\TestFixture\TestWithDifferentDurations::testThree)
45+
Test Finished (PHPUnit\TestFixture\TestWithDifferentDurations::testThree)
46+
Test Suite Finished (PHPUnit\TestFixture\TestWithDifferentDurations, 3 tests)
47+
Test Suite Finished (order-by-duration, 3 tests)
48+
Test Suite Finished (%sorder-by-duration.phpunit.xml, 3 tests)
49+
Test Runner Execution Finished
50+
Test Runner Finished
51+
PHPUnit Finished (Shell Exit Code: 0)
52+
--CLEAN--
53+
<?php declare(strict_types=1);
54+
unlink(sys_get_temp_dir() . DIRECTORY_SEPARATOR . sha1(__FILE__));

0 commit comments

Comments
 (0)