Skip to content

Commit

Permalink
make test.sh configurable and add comments
Browse files Browse the repository at this point in the history
  • Loading branch information
gregor-j committed May 27, 2024
1 parent c41144d commit cbf8f30
Showing 1 changed file with 15 additions and 7 deletions.
22 changes: 15 additions & 7 deletions Test/test.sh
Original file line number Diff line number Diff line change
@@ -1,15 +1,23 @@
#!/usr/bin/env sh

phpdismod xdebug;

# start mysql database service
service mysql start

# create default database and user from cake2-app-template:/Config/.env.default
mysql -h localhost -u root -e "CREATE DATABASE database_name;CREATE DATABASE test_database_name;CREATE USER 'user'@'localhost' IDENTIFIED BY 'password';GRANT ALL PRIVILEGES ON * . * TO 'user'@'localhost';"

# use this repository symlinked into the app template
composer config repositories.cakephp-filter-plugin '{"type": "path", "url": "/cakephp-filter-plugin", "options": {"symlink": true}}'
# prevent composer from looking up packages on packagist.org
composer config repo.packagist false
# require the current dev version of the filter plugin
composer require --prefer-source kba-team/cakephp-filter-plugin:@dev
vendor/bin/phpunit Plugin/Filter/Test/Case/Controller/Component/FilterComponentTest.php
E=$?
# Either use the test case from the parameter, or run all tests
if [ -n "${1}" ]; then
# call PHPUnit and remember return code
vendor/bin/phpunit "Plugin/Filter/${1}"
E=$?
else
(>&2 echo "ERROR: Missing test case!")
fi
# stop mysql service at the end of the tests
service mysql stop
# exit with the return code of phpunit
exit $E

0 comments on commit cbf8f30

Please sign in to comment.