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

PHPCSDebug/Tests: change set up #46

Merged
merged 1 commit into from
Sep 3, 2020
Merged

Conversation

jrfnl
Copy link
Member

@jrfnl jrfnl commented Sep 3, 2020

Change the test setup from being based on the test suite in PHPCS to using the PHPCSUtils UtilityMethodTestCase as a basis.

That should stabilize the test, as well as allow the test to run without problems on higher PHPUnit/PHP versions.

Added:

  • Composer:
    • Dev dependency on PHPCSUtils. Only needed for running the tests.
      Does - for now - require a minimum stability of dev though.
    • A wider range of PHPUnit versions as the PHPCSUtils test case is compatible with these.
  • Test bootstrap:
    • Define some PHPCS constants which are expected for the test run.
    • Loading of the PHPCSUtils autoload file.
      To run the tests locally using git clones instead of a Composer setup, make sure to set a PHPCSUTILS_DIR environment variable pointing to the clone of PHPCSUtils.
    • Loading of the PHPCS native Tokens class to prevent issues with tokens not being defined.

Changed:

  • Composer:
    • Raise the minimum PHPCS requirement to 3.1.0 as otherwise it would conflict with PHPCSUtils.
      ⚠️ This needs a changelog entry ⚠️
    • Remove the arguments for the PHPUnit script. These are no longer needed.
  • Tests: Merged the two test files for the one sniff into one file using the UtilityMethodTestCase as a base instead of the PHPCS native AbstractSniffUnitTest.

Removed:

  • Travis: all PHPUnit versions are now unconditionally supported. PHPUnit support no longer depends on which PHPCS version is installed.
  • Travis: PHPCS 4.x does not need to be installed using --prefer-source anymore as we're no longer using the PHPCS native test case basis.
  • Test bootstrap: the setting of the PHPCS_IGNORE_TEST environment variable as it is no longer needed (PHPCS test setup specific).

Change the test setup from being based on the test suite in PHPCS to using the PHPCSUtils `UtilityMethodTestCase` as a basis.

That should stabilize the test, as well as allow the test to run without problems on higher PHPUnit/PHP versions.

### Added:
* Composer:
    - Dev dependency on PHPCSUtils. Only needed for running the tests.
        Does - for now - require a minimum stability of `dev` though.
    - A wider range of PHPUnit versions as the PHPCSUtils test case is compatible with these.
* Test bootstrap:
    - Define some PHPCS constants which are expected for the test run.
    - Loading of the PHPCSUtils autoload file.
        To run the tests locally using git clones instead of a Composer setup, make sure to set a `PHPCSUTILS_DIR` environment variable pointing to the clone of PHPCSUtils.
    - Loading of the PHPCS native `Tokens` class to prevent issues with tokens not being defined.

### Changed:
* Composer:
    - Raise the minimum PHPCS requirement to `3.1.0` as otherwise it would conflict with PHPCSUtils.
        ⚠️ This needs a changelog entry : warning:
    - Remove the arguments for the PHPUnit script. These are no longer needed.
* Tests: Merged the two test files for the one sniff into one file using the `UtilityMethodTestCase` as a base instead of the PHPCS native `AbstractSniffUnitTest`.

### Removed:
* Travis: all PHPUnit versions are now unconditionally supported. PHPUnit support no longer depends on which PHPCS version is installed.
* Travis: PHPCS 4.x does not need to be installed using `--prefer-source` anymore as we're no longer using the PHPCS native test case basis.
* Test bootstrap: the setting of the `PHPCS_IGNORE_TEST` environment variable as it is no longer needed (PHPCS test setup specific).
@jrfnl jrfnl merged commit 8072d01 into develop Sep 3, 2020
@jrfnl jrfnl deleted the feature/make-tests-stable branch September 3, 2020 21:23
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.

None yet

1 participant