Skip to content
Snippets Groups Projects
Unverified Commit bfd30055 authored by Klaus Purer's avatar Klaus Purer Committed by GitHub
Browse files

fix(composer): Prevent composer autoload warnings by moving the tests outside...

fix(composer): Prevent composer autoload warnings by moving the tests outside the autoload directory (#3116414)
parent d1879816
Branches
Tags
No related merge requests found
Showing
with 25 additions and 20 deletions
/.gitattributes export-ignore
/.travis.yml export-ignore
/README.md export-ignore
/coder_sniffer/Drupal/Test export-ignore
/coder_sniffer/DrupalPractice/Test export-ignore
/phpcs.xml.dist
/phpunit.xml.dist
/phpcs.xml.dist export-ignore
/phpunit.xml.dist export-ignore
/vendor export-ignore
/tests export-ignore
......@@ -41,10 +41,10 @@ script:
- ./vendor/bin/phpcs -p
# Ensure that a custom standard can be invoked and the auto-loading of
# abstract classes works.
- ./vendor/bin/phpcs -p --standard=coder_sniffer/Drupal/Test/phpcs-ruleset.xml coder_sniffer/Drupal/Test/good/ --ignore=coder_sniffer/Drupal/Test/good/GoodUnitTest.php
- ./vendor/bin/phpcs -p --standard=tests/Drupal/phpcs-ruleset.xml tests/Drupal/good/ --ignore=tests/Drupal/good/GoodUnitTest.php
# Ensure that the DrupalPractice standard can be invoked standalone and the
# auto-loading of abstract classes works.
- ./vendor/bin/phpcs -p --standard=coder_sniffer/DrupalPractice coder_sniffer/DrupalPractice/Test/good/ --ignore=coder_sniffer/DrupalPractice/Test/good/GoodUnitTest.php
- ./vendor/bin/phpcs -p --standard=coder_sniffer/DrupalPractice tests/DrupalPractice/good/ --ignore=tests/DrupalPractice/good/GoodUnitTest.php
# Only run PHPStan on the latest PHP version, no need to run it multiple
# times.
- if [[ $PHPSTAN == "1" ]]; then ./vendor/bin/phpstan analyse; fi
......@@ -3,11 +3,12 @@
<description>The coding standard for coder_sniffer.</description>
<file>coder_sniffer</file>
<file>tests</file>
<!-- Test files that should not be checked. -->
<exclude-pattern>coder_sniffer/*/Test/*\.(inc|css|js|api\.php|tpl\.php)$</exclude-pattern>
<exclude-pattern>coder_sniffer/*/Test/*/(good|bad)\.php$</exclude-pattern>
<exclude-pattern>coder_sniffer/*/Test/*/drupal(6|7|8)/*\.php$</exclude-pattern>
<exclude-pattern>tests/*\.(inc|css|js|api\.php|tpl\.php)$</exclude-pattern>
<exclude-pattern>tests/*/(good|bad)\.php$</exclude-pattern>
<exclude-pattern>tests/*/drupal(6|7|8)/*\.php$</exclude-pattern>
<!-- The following comes from the 3.4.2 PHPCS ruleset.xml { -->
......@@ -153,8 +154,8 @@
<exclude-pattern>coder_sniffer/DrupalPractice/Sniffs/CodeAnalysis/VariableAnalysisSniff.php</exclude-pattern>
</rule>
<rule ref="PEAR.Commenting.FileComment.Missing">
<exclude-pattern>coder_sniffer/Drupal/Test</exclude-pattern>
<exclude-pattern>coder_sniffer/DrupalPractice/Test</exclude-pattern>
<exclude-pattern>tests/Drupal</exclude-pattern>
<exclude-pattern>tests/DrupalPractice/Test</exclude-pattern>
</rule>
<!-- Additional rules from Drupal that we want. -->
......
......@@ -2,17 +2,22 @@ parameters:
level: 6
paths:
- coder_sniffer
- tests
excludes_analyse:
# Copied legacy code that we don't care much about.
- 'coder_sniffer/DrupalPractice/Sniffs/CodeAnalysis/VariableAnalysisSniff.php'
# Test files that should not be checked.
- 'coder_sniffer/*/Test/*.tpl.php'
- 'coder_sniffer/*/Test/*.api.php'
- 'coder_sniffer/*/Test/*/good.php'
- 'coder_sniffer/*/Test/*/bad.php'
- 'coder_sniffer/*/Test/*/drupal[678]/*.php'
- 'tests/*/*.tpl.php'
- 'tests/*/*.api.php'
- 'tests/*/good.php'
- 'tests/*/bad.php'
- 'tests/*/drupal[678]/*.php'
# The tests directory is not autoloaded by Composer. Make PHPStan aware of
# it.
autoload_directories:
- tests
autoload_files:
- coder_sniffer/Drupal/Test/phpunit-bootstrap.php
- tests/Drupal/phpunit-bootstrap.php
ignoreErrors:
# PHPStan does not support variable variables, see https://github.com/phpstan/phpstan/issues/2810
-
......
<?xml version="1.0" encoding="UTF-8"?>
<phpunit bootstrap="coder_sniffer/Drupal/Test/phpunit-bootstrap.php" beStrictAboutTestsThatDoNotTestAnything="false" colors="true">
<phpunit bootstrap="tests/Drupal/phpunit-bootstrap.php" beStrictAboutTestsThatDoNotTestAnything="false" colors="true">
<testsuites>
<testsuite name="Coder Sniffer Drupal Test Suite">
<directory>coder_sniffer/Drupal/Test</directory>
<directory>tests/Drupal</directory>
</testsuite>
<testsuite name="Coder Sniffer DrupalPractice Test Suite">
<directory>coder_sniffer/DrupalPractice/Test</directory>
<directory>tests/DrupalPractice</directory>
</testsuite>
</testsuites>
</phpunit>
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment