Automated commit
Signed-off-by: Oliver Davies <oliver@oliverdavies.uk>
This commit is contained in:
parent
0ccc967ca8
commit
1d401246d2
296 changed files with 0 additions and 0 deletions
|
|
@ -0,0 +1,37 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
#: exec_target = cli
|
||||
|
||||
## Creates a phpunit.xml file and runs PHPUnit tests in Drupal 8
|
||||
##
|
||||
## Usage: fin phpunit <args>
|
||||
##
|
||||
## This first ensures that a `core/phpunit.xml` file exists, either by copying a
|
||||
## stub from `.docksal/drupal/core/phpunit.xml` if that exists, or copying and
|
||||
## renaming `core/phpunit.xml.dist`.
|
||||
##
|
||||
## If `core/phpunit.xml` exists, the phpunit command with then be run, appending
|
||||
## any optional arguments such as the directory path (run `fin phpunit -h`) to
|
||||
## see a full list of options.
|
||||
|
||||
DOCROOT_PATH="${PROJECT_ROOT}/${DOCROOT}"
|
||||
DRUPAL_CORE_PATH="${DOCROOT_PATH}/core"
|
||||
|
||||
run_tests() {
|
||||
${PROJECT_ROOT}/vendor/bin/phpunit -c ${DRUPAL_CORE_PATH} "$@"
|
||||
}
|
||||
|
||||
if [ ! -e ${DRUPAL_CORE_PATH}/phpunit.xml ]; then
|
||||
if [ -e "${PROJECT_ROOT}/.docksal/drupal/core/phpunit.xml" ]; then
|
||||
echo "Copying ${PROJECT_ROOT}/.docksal/drupal/core/phpunit.xml to ${DRUPAL_CORE_PATH}/phpunit.xml"
|
||||
cp "${PROJECT_ROOT}/.docksal/drupal/core/phpunit.xml" ${DRUPAL_CORE_PATH}/phpunit.xml
|
||||
run_tests "$@"
|
||||
else
|
||||
echo "Copying phpunit.xml.dist to phpunit.xml."
|
||||
echo "Please edit it's values as needed and re-run 'fin phpunit'."
|
||||
cp ${DRUPAL_CORE_PATH}/phpunit.xml.dist ${DRUPAL_CORE_PATH}/phpunit.xml
|
||||
exit 1;
|
||||
fi
|
||||
else
|
||||
run_tests "$@"
|
||||
fi
|
||||
Loading…
Add table
Add a link
Reference in a new issue