How can I do a pre-commit hook for PHP Symfony code to analyze code coverage and code sniffer report? What are commands and tools I should use?
As of now, I can generate a code coverage report using PHPUnit in clover format:
#!/bin/bash
echo "##################################################################################################"
echo "Starting PHPUnit tests : "`date "+%y-%m-%d %H-%M-%S"`
echo "##################################################################################################"
php app/console -e=dev doctrine:database:drop --force
php app/console -e=dev doctrine:database:create
php app/console -e=dev doctrine:schema:create
php app/console -e=dev -n doctrine:fixtures:load
#phpunit -c app --coverage-html build/html
phpunit -c app --log-junit build/unit.xml
'[' -f build/coverage.xml ']'
phpunit -c app --coverage-clover build/coverage.xml
php app/console -e=dev doctrine:schema:drop --force
php app/console -e=dev doctrine:database:drop --force
echo "Finishing Cron at "`date "+%y-%m-%d %H-%M-%S"`
echo "Cron Task Complete"
echo "##################################################################################################"