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: |
|
path: |
|
||||||
${{ env.WP_CORE_DIR }}
|
${{ env.WP_CORE_DIR }}
|
||||||
${{ env.WP_TESTS_DIR }}
|
${{ env.WP_TESTS_DIR }}
|
||||||
key: cache-wordpress-3
|
key: cache-wordpress-4
|
||||||
|
|
||||||
- name: Cache Composer
|
- name: Cache Composer
|
||||||
id: cache-composer-phpunit
|
id: cache-composer-phpunit
|
||||||
|
@ -74,7 +74,12 @@ jobs:
|
||||||
if: steps.cache-wordpress.outputs.cache-hit != 'false'
|
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
|
run: bash bin/install-wp-tests.sh wordpress_test root root 127.0.0.1 6.6 false true true true
|
||||||
|
|
||||||
- name: Run PHPUnit
|
- name: Run Integration tests for The Events Calendar
|
||||||
run: cd /workspace/Event-Federation/wordpress-activitypub-event-extensions/ && ./vendor/bin/phpunit
|
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:
|
env:
|
||||||
PHP_VERSION: ${{ matrix.php-version }}
|
PHP_VERSION: ${{ matrix.php-version }}
|
||||||
|
|
|
@ -209,7 +209,12 @@ install_wp_plugin() {
|
||||||
|
|
||||||
# Get the latest tag.
|
# Get the latest tag.
|
||||||
LATEST_TAG=$(svn log https://plugins.svn.wordpress.org/$PLUGIN_NAME/tags --limit 1 | awk 'NR == 4 { print $4 }')
|
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"
|
URL="https://downloads.wordpress.org/plugin/$PLUGIN_FILE"
|
||||||
|
|
||||||
# Check if the plugin file already exists
|
# Check if the plugin file already exists
|
||||||
|
@ -226,16 +231,13 @@ install_wp_plugins() {
|
||||||
echo "Skipping WordPress plugin installation."
|
echo "Skipping WordPress plugin installation."
|
||||||
return 0
|
return 0
|
||||||
fi
|
fi
|
||||||
# Always install the ActivityPub plugin.
|
# Install the one and only ActivityPub plugin (greetings @pfefferle).
|
||||||
install_wp_plugin activitypub
|
install_wp_plugin activitypub
|
||||||
|
# Install (not-activate) all supported event plugins.
|
||||||
install_wp_plugin the-events-calendar
|
install_wp_plugin the-events-calendar
|
||||||
# Install additional plugins.
|
install_wp_plugin very-simple-event-list
|
||||||
# if [[ -n "$PLUGINS" ]]; then
|
install_wp_plugin gatherpress
|
||||||
# IFS=',' read -ra PLUGIN_ARRAY <<< "$PLUGINS"
|
install_wp_plugin events-manager
|
||||||
# for plugin in "${PLUGIN_ARRAY[@]}"; do
|
|
||||||
# install_wp_plugin "$plugin"
|
|
||||||
# done
|
|
||||||
# fi
|
|
||||||
}
|
}
|
||||||
|
|
||||||
install_wp
|
install_wp
|
||||||
|
|
|
@ -41,10 +41,20 @@
|
||||||
"lint:fix": [
|
"lint:fix": [
|
||||||
"vendor/bin/phpcbf"
|
"vendor/bin/phpcbf"
|
||||||
],
|
],
|
||||||
"test": [
|
"prepare-test": [
|
||||||
"composer install",
|
"composer install",
|
||||||
"bin/install-wp-tests.sh wordpress-test root wordpress-test test-db latest true",
|
"bin/install-wp-tests.sh wordpress-test root wordpress-test test-db latest true"
|
||||||
"phpunit"
|
],
|
||||||
]
|
"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
|
MARIADB_ROOT_PASSWORD: wordpress-test
|
||||||
healthcheck:
|
healthcheck:
|
||||||
test: ["CMD", "healthcheck.sh", "--connect", "--innodb_initialized"]
|
test: ["CMD", "healthcheck.sh", "--connect", "--innodb_initialized"]
|
||||||
start_period: 5s
|
start_period: 2s
|
||||||
interval: 4s
|
interval: 1s
|
||||||
timeout: 5s
|
timeout: 5s
|
||||||
retries: 5
|
retries: 10
|
||||||
|
|
||||||
test-php:
|
test-php:
|
||||||
build:
|
build:
|
||||||
|
|
|
@ -30,17 +30,46 @@ require_once "{$_tests_dir}/includes/functions.php";
|
||||||
*/
|
*/
|
||||||
function _manually_load_plugin() {
|
function _manually_load_plugin() {
|
||||||
$plugin_dir = ABSPATH . '/wp-content/plugins/';
|
$plugin_dir = ABSPATH . '/wp-content/plugins/';
|
||||||
|
|
||||||
|
// Always manually load the ActivityPub plugin.
|
||||||
require_once $plugin_dir . 'activitypub/activitypub.php';
|
require_once $plugin_dir . 'activitypub/activitypub.php';
|
||||||
$event_plugin = 'the-events-calendar';
|
|
||||||
switch ( $event_plugin ) {
|
// Capture the --filter argument.
|
||||||
case 'the-events-calendar':
|
$activitypub_event_extension_integration_filter = null;
|
||||||
$plugin_file = 'the-events-calendar/the-events-calendar.php';
|
foreach ( $_SERVER['argv'] as $arg ) {
|
||||||
require_once $plugin_dir . $plugin_file;
|
if ( strpos( $arg, '--filter=' ) === 0 ) {
|
||||||
$current = get_option( 'active_plugins', array() );
|
$activitypub_event_extension_integration_filter = substr( $arg, strlen( '--filter=' ) );
|
||||||
$current[] = $plugin_file;
|
break;
|
||||||
sort( $current );
|
}
|
||||||
update_option( 'active_plugins', $current );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$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';
|
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.
|
* 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,
|
// We only test for one event plugin being active at the same time,
|
||||||
// even though we support multiple onces in theory.
|
// even though we support multiple onces in theory.
|
||||||
// But testing all combinations is beyond scope.
|
// But testing all combinations is beyond scope.
|
||||||
|
|
Loading…
Reference in a new issue