You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Add the --random-seed <N> CLI option and deprecate --random-order-seed CLI option #7049
In PHPUnit 14, the seed of a test run will be used for more than the order in which its tests are run: the examples of properties will be generated from it (#7008), so that a single seed is enough to reproduce a test run. The name --random-order-seed would then no longer describe what the option does.
Even today, the name does not tell the whole story: when tests are run in random order, PHPUnit seeds PHP's Mt19937 random number generator with it before the tests are run, which also affects the numbers that tests get from mt_rand(), rand(), shuffle(), array_rand(), and str_shuffle(). PHPUnit's output already labels the seed as Random Seed.
PHPUnit 13.5 will therefore:
Add the --random-seed <N> CLI option, which does what --random-order-seed <N> does. Like --random-order-seed, it triggers a PHPUnit warning when tests are not run in random order. Unlike --random-order-seed, which converts any value to a positive integer, it ignores a value that is not a positive integer and triggers a PHPUnit warning, which is how --random-seed will behave in PHPUnit 14
Use the value of --random-seed when both options are used
Trigger a PHPUnit deprecation when --random-order-seed is used:
The "--random-order-seed" CLI option is deprecated and will be removed in PHPUnit 14. Use "--random-seed" instead.
List --random-seed <N> instead of --random-order-seed <N> in the --help output
Add PHPUnit\TextUI\Configuration\Configuration::randomSeed() and deprecate PHPUnit\TextUI\Configuration\Configuration::randomOrderSeed(), which extensions use to read the seed
Rename the phpunit:randomOrderSeed element of the Open Test Reporting XML logfile to phpunit:randomSeed, and bump the version of the https://schema.phpunit.de/otr/phpunit namespace from 0.2.0 to 0.3.0 accordingly
There is no setting for the seed in the XML configuration file, so nothing changes there.
Unlike the CLI option, the phpunit:randomOrderSeed element of the Open Test Reporting XML logfile is not deprecated first: PHPUnit 13.5 writes phpunit:randomSeed in the https://schema.phpunit.de/otr/phpunit/0.3.0 namespace instead. Because the namespace changes, this affects tools that read any element of the phpunit namespace from an Open Test Reporting XML logfile, not only tools that read the seed.
To prepare for PHPUnit 14, replace --random-order-seed <N> with --random-seed <N> in scripts and CI configuration.
Activity
Closes sebastianbergmann#7049
Merge branch '13.5'
Revert "Document #7049"
Document sebastianbergmann#7049