fix linter issues
All checks were successful
PHPUnit / PHPUnit – PHP 8.1 (push) Successful in 1m4s
PHPUnit / PHPUnit – PHP 8.2 (push) Successful in 1m0s
PHPUnit / PHPUnit – PHP 8.3 (push) Successful in 52s
PHP Code Checker / PHP Code Checker (pull_request) Successful in 41s
PHPUnit / PHPUnit – PHP 8.1 (pull_request) Successful in 57s
PHPUnit / PHPUnit – PHP 8.2 (pull_request) Successful in 1m3s
PHPUnit / PHPUnit – PHP 8.3 (pull_request) Successful in 58s

This commit is contained in:
André Menrath 2024-09-24 16:10:05 +02:00
parent 4febff50ef
commit 8fecbe792f
3 changed files with 19 additions and 5 deletions

View file

@ -149,7 +149,7 @@ final class The_Events_Calendar extends Event {
$venues = $this->wp_object->venues; $venues = $this->wp_object->venues;
// Get first venue. We currently only support a single venue. // Get first venue. We currently only support a single venue.
if ( $venues instanceof \Tribe\Events\Collections\Lazy_Post_Collection ){ if ( $venues instanceof \Tribe\Events\Collections\Lazy_Post_Collection ) {
$venue = $venues->first(); $venue = $venues->first();
} elseif ( empty( $this->wp_object->venues ) || ! empty( $this->wp_object->venues[0] ) ) { } elseif ( empty( $this->wp_object->venues ) || ! empty( $this->wp_object->venues[0] ) ) {
return null; return null;

View file

@ -59,14 +59,15 @@ class Setup {
* @since 1.0.0 * @since 1.0.0
*/ */
protected function __construct() { protected function __construct() {
$this->activitypub_plugin_is_active = defined( 'ACTIVITYPUB_PLUGIN_VERSION' ) || is_plugin_active( 'activitypub/activitypub.php' ); $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. // BeforeFirstRelease: decide whether we want to do anything at all when ActivityPub plugin is note active.
// if ( ! $this->activitypub_plugin_is_active ) { // if ( ! $this->activitypub_plugin_is_active ) {
// deactivate_plugins( ACTIVITYPUB_EVENT_EXTENSIONS_PLUGIN_FILE ); // deactivate_plugins( ACTIVITYPUB_EVENT_EXTENSIONS_PLUGIN_FILE );
// return; // return;
// }. // }.
$this->active_event_plugins = self::detect_active_event_plugins(); $this->active_event_plugins = self::detect_active_event_plugins();
$this->activitypub_plugin_version = defined( 'ACTIVITYPUB_PLUGIN_VERSION' ) ? constant( 'ACTIVITYPUB_PLUGIN_VERSION' ): '0'; $this->activitypub_plugin_version = self::get_activitypub_plugin_version();
$this->setup_hooks(); $this->setup_hooks();
} }
@ -95,6 +96,19 @@ class Setup {
return self::$instance; return self::$instance;
} }
/**
* LooksUp the current version of the ActivityPub.
*
* @return string The semantic Version.
*/
private static function get_activitypub_plugin_version(): string {
if ( defined( 'ACTIVITYPUB_PLUGIN_VERSION' ) ) {
return constant( 'ACTIVITYPUB_PLUGIN_VERSION' );
}
$version = get_file_data( WP_PLUGIN_DIR . '/activitypub/activitypub.php', array( 'Version' ) )[0];
return $version ?? '0.0.0';
}
/** /**
* Getter function for the active event plugins. * Getter function for the active event plugins.
* *

View file

@ -14,8 +14,8 @@ class Test_The_Events_Calendar extends WP_UnitTestCase {
*/ */
public const MOCKUP_VENUS = array( public const MOCKUP_VENUS = array(
'minimal_venue' => array( 'minimal_venue' => array(
'venue' => 'Minimal Venue', 'venue' => 'Minimal Venue',
'status' => 'publish', 'status' => 'publish',
), ),
'complex_venue' => array( 'complex_venue' => array(
'venue' => 'Complex Venue', 'venue' => 'Complex Venue',