fix docker compose file for running unit tests locally
This commit is contained in:
parent
c495e65105
commit
6edc402581
5 changed files with 25 additions and 13 deletions
1
.gitignore
vendored
1
.gitignore
vendored
|
@ -1,2 +1,3 @@
|
|||
vendor
|
||||
composer.lock
|
||||
.phpunit.result.cache
|
||||
|
|
|
@ -24,4 +24,9 @@ RUN curl -O https://raw.githubusercontent.com/wp-cli/builds/gh-pages/phar/wp-cli
|
|||
chmod +x wp-cli.phar && \
|
||||
mv wp-cli.phar /usr/local/bin/wp
|
||||
|
||||
COPY composer.json composer.lock /app/
|
||||
RUN composer install --no-scripts --no-autoloader
|
||||
RUN composer global require yoast/phpunit-polyfills:"^3.0" --dev
|
||||
ENV PATH="/root/.composer/vendor/bin:${PATH}"
|
||||
|
||||
RUN chmod +x -R ./
|
||||
|
|
|
@ -3,8 +3,8 @@
|
|||
"description": "The ActivityPub Event Extensions help for event custom post types to federate properly.",
|
||||
"type": "wordpress-plugin",
|
||||
"require": {
|
||||
"php": ">=5.6.0",
|
||||
"composer/installers": "^1.0 || ^2.0"
|
||||
"php": ">=8.1.0",
|
||||
"composer/installers": "^2.0"
|
||||
},
|
||||
"require-dev": {
|
||||
"phpcompatibility/php-compatibility": "*",
|
||||
|
@ -39,8 +39,8 @@
|
|||
],
|
||||
"test": [
|
||||
"composer install",
|
||||
"tests/install-wp-tests.sh activitypub-test root activitypub-test test-db latest true",
|
||||
"vendor/bin/phpunit"
|
||||
"tests/install-wp-tests.sh wordpress-test root wordpress-test test-db latest true",
|
||||
"phpunit"
|
||||
]
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,16 +1,19 @@
|
|||
version: '3'
|
||||
|
||||
# This files purpose is to run the PHPunit tests locally.
|
||||
|
||||
services:
|
||||
test-db:
|
||||
platform: linux/x86_64
|
||||
image: mariadb
|
||||
environment:
|
||||
MYSQL_DATABASE: wordpress
|
||||
MYSQL_ROOT_PASSWORD: wordpress
|
||||
MARIADB_DATABASE: wordpress-test
|
||||
MARIADB_ROOT_PASSWORD: wordpress-test
|
||||
healthcheck:
|
||||
test: ["CMD", "curl", "-f", "http://localhost:3306"]
|
||||
interval: 5s
|
||||
timeout: 2s
|
||||
retries: 5
|
||||
test: ["CMD", "healthcheck.sh", "--connect", "--innodb_initialized"]
|
||||
start_period: 5s
|
||||
interval: 4s
|
||||
timeout: 5s
|
||||
retries: 5
|
||||
|
||||
test-php:
|
||||
build:
|
7
tests/install-wp-tests.sh
Normal file → Executable file
7
tests/install-wp-tests.sh
Normal file → Executable file
|
@ -194,8 +194,11 @@ install_wp_plugins() {
|
|||
echo "Skipping WordPress plugin installation."
|
||||
return 0
|
||||
fi
|
||||
download https://downloads.wordpress.org/plugin/activitypub.3.2.5.zip $TMPDIR/activitypub.zip
|
||||
unzip $TMPDIR/activitypub.zip -d $WP_CORE_DIR/wp-content/plugins/
|
||||
ACTIVITYPUB_FILE="activitypub.3.2.5.zip"
|
||||
if ! test -f $TMPDIR/$ACTIVITYPUB_FILE; then
|
||||
download https://downloads.wordpress.org/plugin/$ACTIVITYPUB_FILE $TMPDIR/$ACTIVITYPUB_FILE
|
||||
fi
|
||||
unzip -o $TMPDIR/$ACTIVITYPUB_FILE -d $WP_CORE_DIR/wp-content/plugins/
|
||||
}
|
||||
|
||||
install_wp
|
||||
|
|
Loading…
Reference in a new issue