Skip to content

Commit

Permalink
Merge branch '10.5' into 11.4
Browse files Browse the repository at this point in the history
  • Loading branch information
sebastianbergmann committed Oct 8, 2024
2 parents f2416db + 126dcea commit c5a67e7
Show file tree
Hide file tree
Showing 4 changed files with 120 additions and 1 deletion.
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}}
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 tests/end-to-end/execution-order/order-by-duration-via-cli.phpt
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)
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)

0 comments on commit c5a67e7

Please sign in to comment.