Skip to content

Commit dda16e2

Browse files
Merge branch '11.5' into 12.2
2 parents f525683 + 5984c2c commit dda16e2

File tree

5 files changed

+46
-0
lines changed

5 files changed

+46
-0
lines changed

ChangeLog-12.2.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,12 @@
22

33
All notable changes of the PHPUnit 12.2 release series are documented in this file using the [Keep a CHANGELOG](https://keepachangelog.com/) principles.
44

5+
## [12.2.7] - 2025-MM-DD
6+
7+
### Fixed
8+
9+
* [#6254](https://github.com/sebastianbergmann/phpunit/issues/6254): `defects,random`configuration is supported by implementation, but it is not allowed by the XML configuration file schema
10+
511
## [12.2.6] - 2025-07-04
612

713
### Fixed
@@ -99,6 +105,7 @@ This feature is experimental and the generated XML may change to enhance complia
99105
* A warning is now emitted when more than one of `#[Small]`, `#[Medium]`, or `#[Large]` is used on a test class
100106
* A warning is now emitted when a data provider provides data sets that have more values than the test method consumes using arguments
101107

108+
[12.2.7]: https://github.com/sebastianbergmann/phpunit/compare/12.2.6...12.2
102109
[12.2.6]: https://github.com/sebastianbergmann/phpunit/compare/12.2.5...12.2.6
103110
[12.2.5]: https://github.com/sebastianbergmann/phpunit/compare/12.2.4...12.2.5
104111
[12.2.4]: https://github.com/sebastianbergmann/phpunit/compare/12.2.3...12.2.4

phpunit.xsd

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,7 @@
118118
<xs:restriction base="xs:string">
119119
<xs:enumeration value="default"/>
120120
<xs:enumeration value="defects"/>
121+
<xs:enumeration value="defects,random"/>
121122
<xs:enumeration value="depends"/>
122123
<xs:enumeration value="depends,defects"/>
123124
<xs:enumeration value="depends,duration"/>

schema/10.5.xsd

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,7 @@
116116
<xs:restriction base="xs:string">
117117
<xs:enumeration value="default"/>
118118
<xs:enumeration value="defects"/>
119+
<xs:enumeration value="defects,random"/>
119120
<xs:enumeration value="depends"/>
120121
<xs:enumeration value="depends,defects"/>
121122
<xs:enumeration value="depends,duration"/>

schema/11.5.xsd

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,7 @@
118118
<xs:restriction base="xs:string">
119119
<xs:enumeration value="default"/>
120120
<xs:enumeration value="defects"/>
121+
<xs:enumeration value="defects,random"/>
121122
<xs:enumeration value="depends"/>
122123
<xs:enumeration value="depends,defects"/>
123124
<xs:enumeration value="depends,duration"/>

tests/unit/Runner/TestSuiteSorterTest.php

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -503,6 +503,42 @@ public function testCanSetRandomizationWithASeed(): void
503503
$this->assertSame($expectedOrder, $sorter->getExecutionOrder());
504504
}
505505

506+
public function testCanSetRandomizationWithDefectsFirst(): void
507+
{
508+
$cache = new DefaultResultCache;
509+
510+
$runState = [
511+
'testOne' => ['state' => TestStatus::success(), 'time' => 1],
512+
'testTwo' => ['state' => TestStatus::success(), 'time' => 1],
513+
'testThree' => ['state' => TestStatus::error(), 'time' => 1],
514+
'testFour' => ['state' => TestStatus::success(), 'time' => 1],
515+
'testFive' => ['state' => TestStatus::error(), 'time' => 1],
516+
];
517+
518+
foreach ($runState as $testName => $data) {
519+
$cache->setStatus(MultiDependencyTest::class . '::' . $testName, $data['state']);
520+
$cache->setTime(MultiDependencyTest::class . '::' . $testName, $data['time']);
521+
}
522+
523+
$sorter = new TestSuiteSorter($cache);
524+
525+
$suite = TestSuite::empty('test suite name');
526+
$suite->addTestSuite(new ReflectionClass(MultiDependencyTest::class));
527+
528+
mt_srand(54321);
529+
$sorter->reorderTestsInSuite($suite, TestSuiteSorter::ORDER_RANDOMIZED, false, TestSuiteSorter::ORDER_DEFECTS_FIRST);
530+
531+
$expectedOrder = [
532+
MultiDependencyTest::class . '::testFive',
533+
MultiDependencyTest::class . '::testThree',
534+
MultiDependencyTest::class . '::testTwo',
535+
MultiDependencyTest::class . '::testFour',
536+
MultiDependencyTest::class . '::testOne',
537+
];
538+
539+
$this->assertSame($expectedOrder, $sorter->getExecutionOrder());
540+
}
541+
506542
public function testCanSetRandomizationWithASeedAndResolveDependencies(): void
507543
{
508544
$suite = TestSuite::empty('test suite name');

0 commit comments

Comments
 (0)