Skip to content

Tests: add missing .fixed files #299

Closed

Description

@jrfnl

There are currently five test case files for which the associated sniff would make fixes, but which do not have a corresponding .fixed file version of the test case file to verify that the fixes made are correct.

Two of these are for JS/CSS tests. I'm not concerned about those as support for this will be dropped in 4.0 anyway.

However, for the other three, a .fixed file should be added and it should be carefully verified that the fixes made by the sniff are actually correct as this hasn't been safeguarded over time.

To verify the fixes, one will need to scrutinize what the sniff actually does + one would likely need to dig into the file history to see when those tests were added and in relation to what issue(s).

Note: a possible conclusion from this exercise could be that there is a bug in one or more of the sniffs and fixes are being made where they shouldn't be made. If that's the case, the sniff would need to be fixed instead.

1) PHP_CodeSniffer\Standards\PEAR\Tests\WhiteSpace\ScopeIndentUnitTest::testSniff
Missing fixed version of ScopeIndentUnitTest.inc to verify the accuracy of fixes, while the sniff is making fixes against the test case file

2) PHP_CodeSniffer\Standards\PSR2\Tests\Namespaces\UseDeclarationUnitTest::testSniff
Missing fixed version of UseDeclarationUnitTest.17.inc to verify the accuracy of fixes, while the sniff is making fixes against the test case file

3) PHP_CodeSniffer\Standards\Squiz\Tests\Commenting\ClosingDeclarationCommentUnitTest::testSniff
Missing fixed version of ClosingDeclarationCommentUnitTest.inc to verify the accuracy of fixes, while the sniff is making fixes against the test case file

For completeness, these are the other two missing ones. These do not need to be addressed.

4) PHP_CodeSniffer\Standards\Squiz\Tests\ControlStructures\SwitchDeclarationUnitTest::testSniff
Missing fixed version of SwitchDeclarationUnitTest.js to verify the accuracy of fixes, while the sniff is making fixes against the test case file

5) PHP_CodeSniffer\Standards\Squiz\Tests\CSS\LowercaseStyleDefinitionUnitTest::testSniff
Missing fixed version of LowercaseStyleDefinitionUnitTest.css to verify the accuracy of fixes, while the sniff is making fixes against the test case file

Activity

  1. DannyvdSluijs commented on Apr 30, 2024

    @DannyvdSluijs
    Contributor

    Currently from the master branch (7aceb91)

    There are only three warnings left, which include one for a .css file and one for a .js file. Which means there is only one warning left in order to resolve this issues. For this I've created #476

    Remaining warnings:

    There were 3 warnings:
    
    1) PHP_CodeSniffer\Standards\PEAR\Tests\WhiteSpace\ScopeIndentUnitTest::testSniff
    Missing fixed version of ScopeIndentUnitTest.inc to verify the accuracy of fixes, while the sniff is making fixes against the test case file
    
    /home/runner/work/PHP_CodeSniffer/PHP_CodeSniffer/tests/TestSuite7.php:28
    phpvfscomposer:///home/runner/work/PHP_CodeSniffer/PHP_CodeSniffer/vendor/phpunit/phpunit/phpunit:97
    
    2) PHP_CodeSniffer\Standards\Squiz\Tests\CSS\LowercaseStyleDefinitionUnitTest::testSniff
    Missing fixed version of LowercaseStyleDefinitionUnitTest.css to verify the accuracy of fixes, while the sniff is making fixes against the test case file
    
    /home/runner/work/PHP_CodeSniffer/PHP_CodeSniffer/tests/TestSuite7.php:28
    phpvfscomposer:///home/runner/work/PHP_CodeSniffer/PHP_CodeSniffer/vendor/phpunit/phpunit/phpunit:97
    
    3) PHP_CodeSniffer\Standards\Squiz\Tests\ControlStructures\SwitchDeclarationUnitTest::testSniff
    Missing fixed version of SwitchDeclarationUnitTest.js to verify the accuracy of fixes, while the sniff is making fixes against the test case file
    
    /home/runner/work/PHP_CodeSniffer/PHP_CodeSniffer/tests/TestSuite7.php:28
    phpvfscomposer:///home/runner/work/PHP_CodeSniffer/PHP_CodeSniffer/vendor/phpunit/phpunit/phpunit:97
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions