Skip to content

Commit

Permalink
Optionally use DTT from PHPUnit command (#50)
Browse files Browse the repository at this point in the history
* removes DTT from PHPUnit command. adds deprecation message to dkan-test-phpunit.

* allow for use of DTT bootstrap
  • Loading branch information
paul-m authored Aug 8, 2024
1 parent 9a736e8 commit f421522
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 2 deletions.
12 changes: 10 additions & 2 deletions commands/web/dkan-phpunit
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,14 @@ if [[ ! -f $PHPUNIT_BINARY ]] ; then
composer install --no-progress
fi

# Use the weitzman/dtt bootstrap if it exists.
# Otherwise, Drupal's bootstrap.
# TODO Eventually we can remove this and just use Drupal core.
BOOTSTRAP_PATH=$DDEV_COMPOSER_ROOT/vendor/weitzman/drupal-test-traits/src/bootstrap.php
if [[ ! -f $BOOTSTRAP_PATH ]] ; then
BOOTSTRAP_PATH=$DDEV_COMPOSER_ROOT/$DOCROOT/core/tests/bootstrap.php
fi

echo "Starting PHPUnit test run."
DDEV_PATH="$PWD"
cd $TEST_PATH || exit 1
Expand All @@ -43,12 +51,12 @@ cd $TEST_PATH || exit 1
# - DRUPAL_ROOT
# - SIMPLETEST_BASE_URL
# - SIMPLETEST_DB
DRUPAL_ROOT="/var/www/html/docroot" \
DRUPAL_ROOT=$DDEV_COMPOSER_ROOT/$DOCROOT \
SIMPLETEST_BASE_URL=$DDEV_PRIMARY_URL \
SIMPLETEST_DB="mysql://db:db@$DDEV_PROJECT-db:3306/db" \
$DDEV_PATH/$PHPUNIT_BINARY \
--testsuite "$TEST_SUITE" \
--bootstrap /var/www/html/vendor/weitzman/drupal-test-traits/src/bootstrap.php \
--bootstrap $BOOTSTRAP_PATH \
--fail-on-risky \
"$@"
TEST_RESULTS=$?
Expand Down
5 changes: 5 additions & 0 deletions commands/web/dkan-test-phpunit
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,11 @@
# Avoid some XDebug error messages.
export XDEBUG_MODE=coverage

echo "**"
echo "* The dkan-test-phpunit command is deprecated."
echo "* Use dkan-phpunit instead."
echo "**"

TEST_PATH="docroot/modules/contrib/dkan"
TEST_SUITE="DKAN Test Suite"
PHPUNIT_BINARY=vendor/bin/phpunit
Expand Down

0 comments on commit f421522

Please sign in to comment.