Yeah, nice this test seems to be working. I added the following to .travis.yml
before_script:
- if find . -name "*.php" ! -path "./vendor/*" -exec php -l {} 2>&1 \; | grep "syntax error, unexpected"; then exit 1; fi
Then committed test2.php
with a syntax error echoo
instead of echo
The build failed as expected with the error:
$ if find . -name "*.php" ! -path "./vendor/*" -exec php -l {} 2>&1 \; | grep "syntax error, unexpected"; then exit 1; fi
PHP Parse error: syntax error, unexpected '"test"' (T_CONSTANT_ENCAPSED_STRING) in ./test2.php on line 4
Parse error: syntax error, unexpected '"test"' (T_CONSTANT_ENCAPSED_STRING) in ./test2.php on line 4
Which is factly the same error that I got when I ran the incorrect syntax php locally. After commiting a fix the build now passes
I’ve added a build status icon to the main Emoncms Readme.