install event plugins in ci
This commit is contained in:
parent
68b7963fe6
commit
8d2c8b2d35
4 changed files with 56 additions and 5 deletions
|
@ -4,6 +4,7 @@ on:
|
||||||
push:
|
push:
|
||||||
branches:
|
branches:
|
||||||
- main
|
- main
|
||||||
|
- improve_tests
|
||||||
pull_request:
|
pull_request:
|
||||||
|
|
||||||
env:
|
env:
|
||||||
|
|
|
@ -30,6 +30,11 @@ require_once "{$_tests_dir}/includes/functions.php";
|
||||||
*/
|
*/
|
||||||
function _manually_load_plugin() {
|
function _manually_load_plugin() {
|
||||||
require dirname( __DIR__ ) . '/activitypub-event-extensions.php';
|
require dirname( __DIR__ ) . '/activitypub-event-extensions.php';
|
||||||
|
$event_plugin = getenv( 'WP_EVENT_PLUGIN' );
|
||||||
|
switch ( $event_plugin ) {
|
||||||
|
case 'the-events-calendar':
|
||||||
|
require ABSPATH . '/wp-content/mu-plugins/the-events-calendar/the-events-calendar.php';
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
tests_add_filter( 'muplugins_loaded', '_manually_load_plugin' );
|
tests_add_filter( 'muplugins_loaded', '_manually_load_plugin' );
|
||||||
|
|
|
@ -15,6 +15,16 @@ SKIP_WP_INSTALL=${7-false}
|
||||||
SKIP_PLUGINS_INSTALL=${8-false}
|
SKIP_PLUGINS_INSTALL=${8-false}
|
||||||
SKIP_TEST_SUITE_INSTALL=${9-false}
|
SKIP_TEST_SUITE_INSTALL=${9-false}
|
||||||
|
|
||||||
|
# Initialize the plugin list
|
||||||
|
PLUGINS=""
|
||||||
|
|
||||||
|
# Parse optional --plugins argument
|
||||||
|
while [[ "$#" -gt 0 ]]; do
|
||||||
|
case $1 in
|
||||||
|
--plugins) PLUGINS="$2"; shift ;;
|
||||||
|
esac
|
||||||
|
shift
|
||||||
|
done
|
||||||
|
|
||||||
TMPDIR=${TMPDIR-/tmp}
|
TMPDIR=${TMPDIR-/tmp}
|
||||||
TMPDIR=$(echo $TMPDIR | sed -e "s/\/$//")
|
TMPDIR=$(echo $TMPDIR | sed -e "s/\/$//")
|
||||||
|
@ -189,16 +199,42 @@ install_db() {
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
install_wp_plugin() {
|
||||||
|
PLUGIN_NAME=$1
|
||||||
|
|
||||||
|
if [ -d "$WP_CORE_DIR/wp-content/mu-plugins/$PLUGIN_NAME" ]; then
|
||||||
|
return;
|
||||||
|
fi
|
||||||
|
|
||||||
|
# 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"
|
||||||
|
URL="https://downloads.wordpress.org/plugin/$PLUGIN_FILE"
|
||||||
|
|
||||||
|
# Check if the plugin file already exists
|
||||||
|
if ! test -f "$TMPDIR/$PLUGIN_FILE"; then
|
||||||
|
download $URL "$TMPDIR/$PLUGIN_FILE"
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Unzip the plugin into the WordPress must-use plugins directory
|
||||||
|
unzip -o "$TMPDIR/$PLUGIN_FILE" -d "$WP_CORE_DIR/wp-content/mu-plugins/"
|
||||||
|
}
|
||||||
|
|
||||||
install_wp_plugins() {
|
install_wp_plugins() {
|
||||||
if [ "$SKIP_PLUGINS_INSTALL" = "true" ]; then
|
if [ "$SKIP_PLUGINS_INSTALL" = "true" ]; then
|
||||||
echo "Skipping WordPress plugin installation."
|
echo "Skipping WordPress plugin installation."
|
||||||
return 0
|
return 0
|
||||||
fi
|
fi
|
||||||
ACTIVITYPUB_FILE="activitypub.3.2.5.zip"
|
# Always install the ActivityPub plugin.
|
||||||
if ! test -f $TMPDIR/$ACTIVITYPUB_FILE; then
|
install_wp_plugin activitypub
|
||||||
download https://downloads.wordpress.org/plugin/$ACTIVITYPUB_FILE $TMPDIR/$ACTIVITYPUB_FILE
|
install_wp_plugin the-events-calendar
|
||||||
fi
|
# Install additional plugins.
|
||||||
unzip -o $TMPDIR/$ACTIVITYPUB_FILE -d $WP_CORE_DIR/wp-content/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
|
install_wp
|
||||||
|
|
|
@ -17,4 +17,13 @@ class Test_Sample extends WP_UnitTestCase {
|
||||||
// Replace this with some actual testing code.
|
// Replace this with some actual testing code.
|
||||||
$this->assertTrue( true );
|
$this->assertTrue( true );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Tesd tes
|
||||||
|
*/
|
||||||
|
public function test_the_events_calendar() {
|
||||||
|
// Replace this with some actual testing code.
|
||||||
|
$class_exists = class_exists( 'Tribe__Events__Main' );
|
||||||
|
$this->assertTrue( $class_exists );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue