WordPress-Coding-Standards/bin/pre-commit
jrfnl a71cd17f8c WPCS 2.0.0: Remove unit test work-arounds for PHPCS 2.x
The duplicates of the PHPCS 2.x test controller files can now be removed.

We also no longer need to load our `PHPCSAliases` file, not even for the autoloading of the abstract classes as PHPCS 3.1.0+handles this without problem.

For PHPUnit 7.x support, PHPCS does need a bootstrap file, but that is included with PHPCS, so all we need to do is reference that file in the command send to PHPUnit.
2018-12-19 13:40:27 +01:00

14 lines
492 B
Bash
Executable file

#!/bin/bash
set -e
cd "$(git rev-parse --show-toplevel)"
phpcs_root="$(dirname $(dirname $(which phpcs)))"
if [ -z "$phpcs_root" ] || [ ! -d "$phpcs_root" ] || [ ! -e "$phpcs_root/tests/AllTests.php" ]; then
echo "Unable to locate phpcs on path to locate the root of the PHP_CodeSniffer project" 1>&2
exit 1
fi
find . \( -name '*.php' \) -exec php -lf {} \;
PHPCS_DIR=$phpcs_root phpunit --filter WordPress --bootstrap="$phpcs_root/tests/bootstrap.php" "$phpcs_root/tests/AllTests.php"