Skip to content

Commit

Permalink
Merge pull request #678 from PHPCSStandards/feature/tests-add-windows…
Browse files Browse the repository at this point in the history
…-group-to-more-tests

Tests: add `@group Windows` to more tests + mention in CONTRIBUTING
  • Loading branch information
jrfnl authored Nov 13, 2024
2 parents d27d3b0 + eca6b24 commit 26ddb35
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 0 deletions.
7 changes: 7 additions & 0 deletions .github/CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -339,6 +339,13 @@ Example:
for
```

#### Tests covering code which has OS-specific behaviour

Most code in PHP_CodeSniffer is operating system agnostic.
However, there are a few places which include OS-specific conditions, most notably for Windows.

Tests which cover code which have Windows specific conditions should be marked with a `@group Windows` annotation to allow for running those tests separately/selectively in CI.


### Submitting Your Pull Request

Expand Down
5 changes: 5 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,11 @@ jobs:
php: ['5.4', '5.5', '5.6', '7.0', '7.1', '7.2', '7.3', '7.4', '8.0', '8.1', '8.2', '8.3', '8.4', '8.5']
custom_ini: [false]

exclude:
# Installing on Windows with PHP 5.4 runs into all sorts of problems (which are not ours).
- php: '5.4'
os: 'windows-latest'

include:
# Skip test runs on builds which are also run in the coverage job.
# Note: the tests on PHP 7.2 will still be run as the coverage build uses custom_ini settings for that version.
Expand Down
2 changes: 2 additions & 0 deletions src/Standards/Generic/Tests/Debug/CSSLintUnitTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@
* Unit test class for the CSSLint sniff.
*
* @covers \PHP_CodeSniffer\Standards\Generic\Sniffs\Debug\CSSLintSniff
* @covers \PHP_CodeSniffer\Config::getExecutablePath
* @group Windows
*/
final class CSSLintUnitTest extends AbstractSniffUnitTest
{
Expand Down
1 change: 1 addition & 0 deletions tests/Core/Fixer/GenerateDiffTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
* test running the fixer itself, nor generating a diff based on a fixer run.
*
* @covers PHP_CodeSniffer\Fixer::generateDiff
* @group Windows
*/
final class GenerateDiffTest extends TestCase
{
Expand Down

0 comments on commit 26ddb35

Please sign in to comment.