unit-coverage 747 B

123456789101112131415161718192021222324
  1. #!/usr/bin/env bash
  2. display_help() {
  3. echo -e "Description:
  4. Generate unit tests coverage report in folder: dev/tests/unit/report
  5. Usage:
  6. bin/test/unit-coverage <unit_test_path>
  7. Arguments:
  8. <unit_test_path> Specify a path to your test or folder with tests Ex: bin/test/unit-coverage app/code/Vendor/Module
  9. Options:
  10. -h, --help Display help message"
  11. }
  12. if [[ $1 == "-h" || $1 == "--help" ]]; then
  13. display_help
  14. elif [[ -z $1 ]]; then
  15. echo -e "Please specify a path to your test or folder with tests (ex. app/code/Vendor/Module)"
  16. else
  17. bin/php -d xdebug.mode=coverage vendor/bin/phpunit -c dev/tests/unit/phpunit.xml.dist --coverage-html ./dev/tests/unit/report /var/www/html/"$1"
  18. echo -e "Report path: dev/tests/unit/report"
  19. fi