add multiple phpunit runs with filters for each event plugin integration
All checks were successful
All checks were successful
This commit is contained in:
parent
5dfd6806eb
commit
5f6f02cc81
6 changed files with 75 additions and 29 deletions
|
@ -37,7 +37,7 @@ jobs:
|
|||
path: |
|
||||
${{ env.WP_CORE_DIR }}
|
||||
${{ env.WP_TESTS_DIR }}
|
||||
key: cache-wordpress-3
|
||||
key: cache-wordpress-4
|
||||
|
||||
- name: Cache Composer
|
||||
id: cache-composer-phpunit
|
||||
|
@ -74,7 +74,12 @@ jobs:
|
|||
if: steps.cache-wordpress.outputs.cache-hit != 'false'
|
||||
run: bash bin/install-wp-tests.sh wordpress_test root root 127.0.0.1 6.6 false true true true
|
||||
|
||||
- name: Run PHPUnit
|
||||
run: cd /workspace/Event-Federation/wordpress-activitypub-event-extensions/ && ./vendor/bin/phpunit
|
||||
- name: Run Integration tests for The Events Calendar
|
||||
run: cd /workspace/Event-Federation/wordpress-activitypub-event-extensions/ && ./vendor/bin/phpunit --filter=the_events_calendar
|
||||
env:
|
||||
PHP_VERSION: ${{ matrix.php-version }}
|
||||
|
||||
- name: Run Integration tests for VS Event List
|
||||
run: cd /workspace/Event-Federation/wordpress-activitypub-event-extensions/ && ./vendor/bin/phpunit --filter=vs_event_list
|
||||
env:
|
||||
PHP_VERSION: ${{ matrix.php-version }}
|
||||
|
|
|
@ -209,7 +209,12 @@ install_wp_plugin() {
|
|||
|
||||
# Get the latest tag.
|
||||
LATEST_TAG=$(svn log https://plugins.svn.wordpress.org/$PLUGIN_NAME/tags --limit 1 | awk 'NR == 4 { print $4 }')
|
||||
PLUGIN_FILE="$PLUGIN_NAME.$LATEST_TAG.zip"
|
||||
if [ -n "$LATEST_TAG" ]; then
|
||||
PLUGIN_FILE="$PLUGIN_NAME.$LATEST_TAG.zip"
|
||||
else
|
||||
PLUGIN_FILE="$PLUGIN_NAME.zip"
|
||||
fi
|
||||
|
||||
URL="https://downloads.wordpress.org/plugin/$PLUGIN_FILE"
|
||||
|
||||
# Check if the plugin file already exists
|
||||
|
@ -226,16 +231,13 @@ install_wp_plugins() {
|
|||
echo "Skipping WordPress plugin installation."
|
||||
return 0
|
||||
fi
|
||||
# Always install the ActivityPub plugin.
|
||||
# Install the one and only ActivityPub plugin (greetings @pfefferle).
|
||||
install_wp_plugin activitypub
|
||||
# Install (not-activate) all supported event plugins.
|
||||
install_wp_plugin the-events-calendar
|
||||
# Install additional plugins.
|
||||
# if [[ -n "$PLUGINS" ]]; then
|
||||
# IFS=',' read -ra PLUGIN_ARRAY <<< "$PLUGINS"
|
||||
# for plugin in "${PLUGIN_ARRAY[@]}"; do
|
||||
# install_wp_plugin "$plugin"
|
||||
# done
|
||||
# fi
|
||||
install_wp_plugin very-simple-event-list
|
||||
install_wp_plugin gatherpress
|
||||
install_wp_plugin events-manager
|
||||
}
|
||||
|
||||
install_wp
|
||||
|
|
|
@ -41,10 +41,20 @@
|
|||
"lint:fix": [
|
||||
"vendor/bin/phpcbf"
|
||||
],
|
||||
"test": [
|
||||
"prepare-test": [
|
||||
"composer install",
|
||||
"bin/install-wp-tests.sh wordpress-test root wordpress-test test-db latest true",
|
||||
"phpunit"
|
||||
]
|
||||
"bin/install-wp-tests.sh wordpress-test root wordpress-test test-db latest true"
|
||||
],
|
||||
"test": [
|
||||
"@prepare-test",
|
||||
"@test-vs-event-list",
|
||||
"@test-the-events-calendar",
|
||||
"@test-gatherpress",
|
||||
"@test-events-manager"
|
||||
],
|
||||
"test-vs-event_list": "phpunit --filter=vs_event_list",
|
||||
"test-the-events-calendar": "phpunit --filter=the_events_calendar",
|
||||
"test-gatherpress": "phpunit --filter=gatherpress",
|
||||
"test-events-manager": "phpunit --filter=events-manager"
|
||||
}
|
||||
}
|
||||
|
|
|
@ -26,10 +26,10 @@ services:
|
|||
MARIADB_ROOT_PASSWORD: wordpress-test
|
||||
healthcheck:
|
||||
test: ["CMD", "healthcheck.sh", "--connect", "--innodb_initialized"]
|
||||
start_period: 5s
|
||||
interval: 4s
|
||||
start_period: 2s
|
||||
interval: 1s
|
||||
timeout: 5s
|
||||
retries: 5
|
||||
retries: 10
|
||||
|
||||
test-php:
|
||||
build:
|
||||
|
|
|
@ -30,17 +30,46 @@ require_once "{$_tests_dir}/includes/functions.php";
|
|||
*/
|
||||
function _manually_load_plugin() {
|
||||
$plugin_dir = ABSPATH . '/wp-content/plugins/';
|
||||
|
||||
// Always manually load the ActivityPub plugin.
|
||||
require_once $plugin_dir . 'activitypub/activitypub.php';
|
||||
$event_plugin = 'the-events-calendar';
|
||||
switch ( $event_plugin ) {
|
||||
case 'the-events-calendar':
|
||||
$plugin_file = 'the-events-calendar/the-events-calendar.php';
|
||||
require_once $plugin_dir . $plugin_file;
|
||||
$current = get_option( 'active_plugins', array() );
|
||||
$current[] = $plugin_file;
|
||||
sort( $current );
|
||||
update_option( 'active_plugins', $current );
|
||||
|
||||
// Capture the --filter argument.
|
||||
$activitypub_event_extension_integration_filter = null;
|
||||
foreach ( $_SERVER['argv'] as $arg ) {
|
||||
if ( strpos( $arg, '--filter=' ) === 0 ) {
|
||||
$activitypub_event_extension_integration_filter = substr( $arg, strlen( '--filter=' ) );
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
$plugin_file = null;
|
||||
// See if we want to run integration tests for a specific event-plugin.
|
||||
switch ( $activitypub_event_extension_integration_filter ) {
|
||||
case 'the_events_calendar':
|
||||
$plugin_file = 'the-events-calendar/the-events-calendar.php';
|
||||
break;
|
||||
case 'vs_event_list':
|
||||
$plugin_file = 'very-simple-event-list/vsel.php';
|
||||
break;
|
||||
case 'events_manager':
|
||||
$plugin_file = 'events-manager/events-manager.php';
|
||||
break;
|
||||
case 'gatherpress':
|
||||
$plugin_file = 'gatherpress/gatherpress.php';
|
||||
break;
|
||||
}
|
||||
|
||||
if ( $plugin_file ) {
|
||||
// Manually load the event plugin.
|
||||
require_once $plugin_dir . $plugin_file;
|
||||
$current = get_option( 'active_plugins', array() );
|
||||
$current[] = $plugin_file;
|
||||
sort( $current );
|
||||
update_option( 'active_plugins', $current );
|
||||
}
|
||||
|
||||
// At last manually load our WordPress plugin.
|
||||
require dirname( __DIR__ ) . '/activitypub-event-extensions.php';
|
||||
}
|
||||
|
||||
|
|
|
@ -72,7 +72,7 @@ class Test_The_Events_Calendar extends WP_UnitTestCase {
|
|||
/**
|
||||
* Test that the right transformer gets applied.
|
||||
*/
|
||||
public function test_transformer_class() {
|
||||
public function test_the_events_calendar_transformer_class() {
|
||||
// We only test for one event plugin being active at the same time,
|
||||
// even though we support multiple onces in theory.
|
||||
// But testing all combinations is beyond scope.
|
||||
|
|
Loading…
Reference in a new issue