WordPress-Coding-Standards/bin/pre-commit
2014-07-04 15:09:25 -07:00

14 lines
424 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 {} \;
phpunit --filter WordPress "$phpcs_root/tests/AllTests.php"