Skip to content
Snippets Groups Projects
Commit e447bb06 authored by Travis Carden's avatar Travis Carden Committed by Adam G-H
Browse files

Issue #3309270 by TravisCarden: Add Composer command for running tests

parent 438237fd
No related branches found
No related tags found
No related merge requests found
......@@ -27,10 +27,15 @@
},
"scripts": {
"phpcbf": "scripts/phpcbf.sh",
"phpcs": "scripts/phpcs.sh"
"phpcs": "scripts/phpcs.sh",
"test": [
"Composer\\Config::disableProcessTimeout",
"scripts/phpunit.sh"
]
},
"scripts-descriptions": {
"phpcbf": "Automatically fixes standards violations where possible.",
"phpcs": "Checks code for standards compliance."
"phpcs": "Checks code for standards compliance.",
"test": "Runs PHPUnit tests."
}
}
#!/usr/bin/env bash
# NAME
# phpcbf.sh - Automatically fixe standards violations where possible.
# phpcbf.sh - Automatically fixes standards violations where possible.
#
# SYNOPSIS
# bash phpcbf.sh
......@@ -15,7 +15,7 @@
cd "$(dirname "$0")" || exit 0;
## Find PHPCBF in Drupal core. Check up to three directories up.
# Find PHPCBF in Drupal core. Check up to three directories up.
DIR=$(pwd)
for i in {0..3}; do
DIR=$(dirname "$DIR")
......
......@@ -15,7 +15,7 @@
cd "$(dirname "$0")" || exit 0;
## Find PHPCS in Drupal core. Check up to three directories up.
# Find PHPCS in Drupal core. Check up to three directories up.
DIR=$(pwd)
for i in {0..3}; do
DIR=$(dirname "$DIR")
......
#!/usr/bin/env bash
# NAME
# phpunit.sh - Runs PHPUnit tests.
#
# SYNOPSIS
# bash phpunit.sh
#
# DESCRIPTION
# Run all Automatic Updates PHPUnit tests.
#
# It is assumed that this module is inside a Drupal core installation, in
# modules or modules/contrib. See setup_local_dev.sh.
cd "$(dirname "$0")" || exit 0;
# Find PHPUnit in Drupal core. Check up to three directories up.
DIR=$(pwd)
for i in {0..3}; do
DIR=$(dirname "$DIR")
PHPUNIT_BIN="$DIR/vendor/bin/phpunit"
PHPUNIT_CONFIG="$DIR/core/phpunit.xml"
if test -f "$PHPUNIT_BIN"; then
break
fi
done
# Exit if PHPUnit can't be found.
if test ! -f "$PHPUNIT_BIN"; then
echo "Could not find PHPUnit. Are you inside a Drupal site's 'modules' directory?"
exit 1
fi
# Exit if PHPUnit can't be found.
if test ! -f "$PHPUNIT_CONFIG"; then
echo "Could not find PHPUnit configuration. See setup_local_dev.sh."
exit 1
fi
# Run PHPUnit on the module directory.
php "$PHPUNIT_BIN" \
-c "$PHPUNIT_CONFIG" \
"$(cd .. && pwd)"
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment