run-tests.sh 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. #!/bin/sh
  2. set -e
  3. start_browser_api(){
  4. CURRENT_DIR=$(pwd)
  5. LOCAL_PHANTOMJS="${CURRENT_DIR}/bin/phantomjs"
  6. if [ -f ${LOCAL_PHANTOMJS} ]; then
  7. ${LOCAL_PHANTOMJS} --ssl-protocol=any --ignore-ssl-errors=true vendor/jcalderonzumba/gastonjs/src/Client/main.js 8510 1024 768 2>&1 &
  8. else
  9. phantomjs --ssl-protocol=any --ignore-ssl-errors=true vendor/jcalderonzumba/gastonjs/src/Client/main.js 8510 1024 768 2>&1 >> /dev/null &
  10. fi
  11. sleep 2
  12. }
  13. stop_services(){
  14. ps axo pid,command | grep phantomjs | grep -v grep | awk '{print $1}' | xargs -I {} kill {}
  15. ps axo pid,command | grep php | grep -v grep | grep -v phpstorm | awk '{print $1}' | xargs -I {} kill {}
  16. sleep 2
  17. }
  18. star_local_browser(){
  19. CURRENT_DIR=$(pwd)
  20. cd ${CURRENT_DIR}/vendor/behat/mink/driver-testsuite/web-fixtures
  21. if [ "$TRAVIS" = true ]; then
  22. echo "Starting webserver fox fixtures...."
  23. ~/.phpenv/versions/5.6/bin/php -S 127.0.0.1:6789 > /dev/null 2>&1 &
  24. else
  25. php -S 127.0.0.1:6789 2>&1 >> /dev/null &
  26. fi
  27. sleep 2
  28. }
  29. mkdir -p /tmp/jcalderonzumba/phantomjs
  30. stop_services
  31. start_browser_api
  32. star_local_browser
  33. cd ${CURRENT_DIR}
  34. ${CURRENT_DIR}/bin/phpunit --configuration integration_tests.xml
  35. stop_services
  36. start_browser_api