diff options
Diffstat (limited to '.ddev/commands/web')
-rwxr-xr-x | .ddev/commands/web/phpstan | 9 | ||||
-rwxr-xr-x | .ddev/commands/web/phpunit | 38 | ||||
-rwxr-xr-x | .ddev/commands/web/util | 13 |
3 files changed, 45 insertions, 15 deletions
diff --git a/.ddev/commands/web/phpstan b/.ddev/commands/web/phpstan new file mode 100755 index 0000000..35c7f88 --- /dev/null +++ b/.ddev/commands/web/phpstan @@ -0,0 +1,9 @@ +#!/usr/bin/env bash + +## Description: Run phpstan in the ddev environment +## Usage: phpstan [options] [paths] +## Example: ddev phpstan --error-format=raw > errors.log + +set -e + +./vendor/bin/phpstan $* diff --git a/.ddev/commands/web/phpunit b/.ddev/commands/web/phpunit index 126406a..5026539 100755 --- a/.ddev/commands/web/phpunit +++ b/.ddev/commands/web/phpunit @@ -2,22 +2,37 @@ ## Description: Run phpunit in the ddev environment ## Usage: phpunit -## Example: ddev phpunit [coverage|debug] [...phpunit args] - -# if first arg is either `coverage` or `debug`, set the xdebug mode -# accordingly. Default mode is `develop`, to get the built in dev -# helpers in xdebug. -# See https://xdebug.org/docs/all_settings#mode +## Example: ddev phpunit coverage + +# The meaning of the first arg is: +# +# - setup: Create the test DB for the current database engine +# - coverage: Produce coverage info in tests/results/coverage +# - debug: Runs the tests with the debugger enabled +# - profile: Collects profiling information from the test run. +# +# The first arg can also be empty, in which case the tests are run +# without enabling any of the debugger modes. +# +# Using coverage, debug or profile required that xdebug is enabled. set -e +export XDEBUG_CONFIG="output_dir=tests/results" + +export HZ_TEST_DB_HOST=db +export HZ_TEST_DB_USER=test_user +export HZ_TEST_DB_PASS=hubzilla +export HZ_TEST_DB_TYPE=$DDEV_DATABASE_FAMILY +export HZ_TEST_DB_ROOT_USER=db +export HZ_TEST_DB_ROOT_PASS=db + case $1 in coverage | debug | profile) mode=$1; shift ;; + setup) tests/create_test_db.sh; exit ;; *) mode=off esac -# DB_ROOT_USER=db tests/create_test_db_pgsql.sh - # Clean out old logs [ -a tests/results/unit_test.log ] && rm tests/results/unit_test.log @@ -26,11 +41,4 @@ if [ "$mode" == "coverage" ]; then extra_args='--coverage-html=tests/results/coverage'; fi -export XDEBUG_CONFIG="output_dir=tests/results" - -export HZ_TEST_DB_HOST=db -export HZ_TEST_DB_USER=db -export HZ_TEST_DB_PASS=db -export HZ_TEST_DB_TYPE=$DDEV_DATABASE_FAMILY - XDEBUG_MODE=$mode vendor/bin/phpunit -c tests/phpunit.xml $extra_args "$@" diff --git a/.ddev/commands/web/util b/.ddev/commands/web/util new file mode 100755 index 0000000..c6a8fc5 --- /dev/null +++ b/.ddev/commands/web/util @@ -0,0 +1,13 @@ +#!/usr/bin/env bash +# +## Description: Run a script from the Hubzilla util directory in the container +## Usage: util <script> [args...] +## Example: ddev util addon list all + +script=$1 && shift + +if [ -x ./util/$scrpt ]; then + ./util/$script $* +else + echo "[-] Error: util/$script was not fund." +fi |