fix edge cases for plugin setup
Some checks failed
PHPUnit / PHPUnit – PHP (push) Failing after 55s

This commit is contained in:
André Menrath 2024-09-24 14:28:06 +02:00
parent 0595ce4fd7
commit da9e71008d
2 changed files with 6 additions and 2 deletions

View file

@ -59,7 +59,7 @@ class Setup {
* @since 1.0.0
*/
protected function __construct() {
$this->activitypub_plugin_is_active = defined( 'ACTIVITYPUB_PLUGIN_VERSION' );
$this->activitypub_plugin_is_active = defined( 'ACTIVITYPUB_PLUGIN_VERSION' ) || is_plugin_active( 'activitypub/activitypub.php' );
// BeforeFirstRelease: decide whether we want to do anything at all when ActivityPub plugin is note active.
// if ( ! $this->activitypub_plugin_is_active ) {
// deactivate_plugins( ACTIVITYPUB_EVENT_EXTENSIONS_PLUGIN_FILE );
@ -206,7 +206,7 @@ class Setup {
// The ActivityPub plugin is not active.
add_action( 'admin_notices', array( 'Activitypub_Event_Extensions\Admin\General_Admin_Notices', 'activitypub_plugin_not_enabled' ), 10, 1 );
}
if ( version_compare( $this->activitypub_plugin_version, ACTIVITYPUB_EVENT_EXTENSIONS_ACTIVITYPUB_PLUGIN_MIN_VERSION ) ) {
if ( ! version_compare( $this->activitypub_plugin_version, ACTIVITYPUB_EVENT_EXTENSIONS_ACTIVITYPUB_PLUGIN_MIN_VERSION ) ) {
// The ActivityPub plugin is too old.
add_action( 'admin_notices', array( 'Activitypub_Event_Extensions\Admin\General_Admin_Notices', 'activitypub_plugin_version_too_old' ), 10, 1 );
}

View file

@ -164,6 +164,10 @@ class Test_The_Events_Calendar extends WP_UnitTestCase {
->set( 'category', array( $category_id_theatre ) )
->create();
$test1 = wp_set_post_categories( $wp_object->ID, $category_id_theatre );
$terms = get_the_terms( $wp_object->ID, 'tribe_events_cat' );
get_the_terms( $post_id, 'tribe_events_cat' );
// Call the transformer.
$event_array = \Activitypub\Transformer\Factory::get_transformer( $wp_object )->to_object()->to_array();