drupal_test.sh 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. #!/bin/bash
  2. set -x
  3. set -e
  4. REPO=`pwd`
  5. cd /tmp
  6. rm -rf drupal-twig-test
  7. composer create-project --no-interaction drupal-composer/drupal-project:8.x-dev drupal-twig-test
  8. cd drupal-twig-test
  9. (cd vendor/twig && rm -rf twig && ln -sf $REPO twig)
  10. echo '$config["system.logging"]["error_level"] = "verbose";' >> web/sites/default/settings.php
  11. php ./web/core/scripts/drupal install --no-interaction demo_umami > output
  12. perl -p -i -e 's/^([A-Za-z]+)\: (.+)$/export DRUPAL_\1=\2/' output
  13. source output
  14. wget https://get.symfony.com/cli/installer -O - | bash
  15. export PATH="$HOME/.symfony/bin:$PATH"
  16. symfony server:start -d --no-tls
  17. curl -OLsS https://get.blackfire.io/blackfire-player.phar
  18. chmod +x blackfire-player.phar
  19. cat > drupal-tests.bkf <<EOF
  20. name "Drupal tests"
  21. scenario
  22. name "homepage"
  23. set name "admin"
  24. set pass "pass"
  25. visit url('/')
  26. expect status_code() == 200
  27. click link('Articles')
  28. expect status_code() == 200
  29. click link('Dairy-free and delicious milk chocolate')
  30. expect body() matches "/Dairy\-free milk chocolate is made in largely the same way as regular chocolate/"
  31. expect status_code() == 200
  32. click link('Log in')
  33. expect status_code() == 200
  34. submit button("Log in")
  35. param name name
  36. param pass pass
  37. expect status_code() == 303
  38. follow
  39. expect status_code() == 200
  40. click link('Structure')
  41. expect status_code() == 200
  42. EOF
  43. ./blackfire-player.phar run drupal-tests.bkf --endpoint=`symfony var:export SYMFONY_DEFAULT_ROUTE_URL` --variable name=$DRUPAL_Username --variable pass=$DRUPAL_Password
  44. symfony server:stop