Skip to content

Tests: add @group Windows to more tests + mention in CONTRIBUTING #678

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

Merged
merged 3 commits into from
Nov 13, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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