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

4.0 | .gitattributes: ignore test files, don't ignore test framework #73

Open
wants to merge 1 commit into
base: 4.0
Choose a base branch
from

Conversation

jrfnl
Copy link
Member

@jrfnl jrfnl commented Nov 11, 2023

Description

As of PHPCS 4.0, the tests will no longer ship in a packaged version of the repo 🎉

However, while this removes a lot of friction, it can also cause some, as quite a few external standards use the PHPCS native test framework to run their tests. To continue to do so, those external standards would now have to use --prefer-source, which would make their builds a lot slower and will cause extra support questions from new contributors to those standards.

This commit proposes a solution to this issue by making a few small changes to the .gitattributes file. With these updates directives in place, the PHPCS native test framework will still be included in the packaged up versions, but the test files will not be.

In practice, this means that the following files should still be included in a packaged up version:

  • /tests/AllTests.php
  • /tests/bootstrap.php
  • /tests/FileList.php
  • /tests/TestSuite.php
  • /tests/Core/AbstractMethodUnitTest.php
  • /tests/Core/AllTests.php
  • /tests/Standards/AbstractSniffTest.php
  • /tests/Standards/AllSniffs.php

... but that all other test files will be excluded.

This removes the need for external standards to use --prefer-source.

Suggested changelog entry

Update the existing changelog entry:

-- Composer installs no longer include any test files
+- Composer installs no longer include test files, with the exception of the test framework files

Related issues/external references

Fixes squizlabs/PHP_CodeSniffer#3158

@jrfnl jrfnl added this to the 4.0.0 milestone Nov 11, 2023
@jrfnl jrfnl force-pushed the phpcs-4.x/gitattributes-dont-ignore-test-framework-files branch from ae48201 to 7541d94 Compare November 11, 2023 04:11
@jrfnl jrfnl changed the title .gitattributes: ignore test files, don't ignore test framework 4.0 | .gitattributes: ignore test files, don't ignore test framework Dec 2, 2023
@jrfnl jrfnl force-pushed the phpcs-4.x/gitattributes-dont-ignore-test-framework-files branch from 7541d94 to 1da2742 Compare December 6, 2023 00:38
As of PHPCS 4.0, the tests will no longer ship in a packaged version of the repo 🎉

However, while this removes a lot of friction, it can also cause some, as quite a few external standards use the PHPCS native test framework to run their tests. To continue to do so, those external standards would now have to use `--prefer-source`, which would make their builds a lot slower and will cause extra support questions from new contributors to those standards.

This commit proposes a solution to this issue by making a few small changes to the `.gitattributes` file.
With these updates directives in place, the PHPCS native test _framework_ will still be included in the packaged up versions, but the test _files_ will not be.

In practice, this means that the following files should still be included in a packaged up version:
* `/tests/AllTests.php`
* `/tests/bootstrap.php`
* `/tests/FileList.php`
* `/tests/TestSuite.php`
* `/tests/Core/AbstractMethodUnitTest.php`
* `/tests/Core/AllTests.php`
* `/tests/Standards/AbstractSniffTest.php`
* `/tests/Standards/AllSniffs.php`

... but that all other test files will be excluded.

This removes the need for external standards to use `--prefer-source`.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant