Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Standards/AbstractSniffUnitTest: order test files using natural sort #3775

Closed
wants to merge 1 commit into from

Commits on Mar 5, 2023

  1. Standards/AbstractSniffUnitTest: order test files using natural sort

    When a sniff has multiple test case files, the `AbstractSniffUnitTest::getTestFiles()` sorts the file names before passing them off to be run.
    
    While in most cases, the order of the test case files should not really matter, but in rare cases, like when testing that a property is being reset correctly between files, it does.
    
    As things were, the `sort()` function without flags was being used, making the file order unnatural to work with ( file `11` would be run before file `2` - see: https://3v4l.org/VPO3Z ).
    
    As the `SORT_NATURAL` flag is available since PHP 5.4, adding that flag will resolve this and will ensure the test case files are run in their natural order.
    
    Optionally, the flag could be combined with the `SORT_FLAG_CASE` flag to make the sort case-insensitive.
    jrfnl committed Mar 5, 2023
    Configuration menu
    Copy the full SHA
    aad2648 View commit details
    Browse the repository at this point in the history