Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Optionally use DTT from PHPUnit command #50

Merged
merged 2 commits into from
Aug 8, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading