helper.sh 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. #!/bin/bash
  2. #
  3. # This file was shamelessly copied over from mongofill. All credits belong to them:
  4. # https://github.com/mongofill/mongofill
  5. #
  6. case "$1" in
  7. setup) echo "Creating mongo-php-driver-legacy tests environment ..."
  8. git clone git@github.com:mongodb/mongo-php-driver-legacy.git
  9. cd mongo-php-driver-legacy
  10. phpize
  11. ./configure --quiet
  12. mv tests/utils/server.inc tests/utils/server.original.inc
  13. ;;
  14. clean) echo "Cleaning ..."
  15. rm -rf mongo-php-driver-legacy
  16. ;;
  17. run) echo "Running tests ..."
  18. cd mongo-php-driver-legacy
  19. echo "<?php" > tests/utils/server.inc
  20. echo "require_once __DIR__ . '/../../../../../vendor/autoload.php';" >> tests/utils/server.inc
  21. echo "require_once 'server.original.inc';" >> tests/utils/server.inc
  22. PHP=`make findphp`
  23. SHOW_ONLY_GROUPS="FAIL,XFAIL,BORK,WARN,LEAK,SKIP" REPORT_EXIT_STATUS=1 TEST_PHP_EXECUTABLE=$PHP $PHP run-tests.php -n -q -x --show-diff
  24. ;;
  25. boot) echo "Boot tests server ..."
  26. cd mongo-php-driver-legacy
  27. cp ../cfg.inc tests/utils/cfg.inc
  28. echo "<?php" > tests/utils/server.inc
  29. echo "require_once 'server.original.inc';" >> tests/utils/server.inc
  30. MONGO_SERVER_STANDALONE=yes MONGO_SERVER_STANDALONE_AUTH=yes MONGO_SERVER_REPLICASET=yes MONGO_SERVER_REPLICASET_AUTH=yes make servers
  31. ;;
  32. *) echo "Native mongo-php-driver-legacy tests helper"
  33. echo ""
  34. echo "Usage: $0 [setup|clean|run|boot]"
  35. echo " - setup: create the mongo-php-driver-legacy tests environment"
  36. echo " - boot: starts the mongodb servers, required by the tests"
  37. echo " - run: run the tests"
  38. echo " - clean: remove all the tests environment"
  39. ;;
  40. esac