forked from lecterror/cakephp-filter-plugin
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
make test.sh configurable and add comments
- Loading branch information
Showing
1 changed file
with
15 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |