diff --git a/.forgejo/workflows/phpunit.yml b/.forgejo/workflows/phpunit.yml index f8e08ac..151c527 100644 --- a/.forgejo/workflows/phpunit.yml +++ b/.forgejo/workflows/phpunit.yml @@ -107,5 +107,10 @@ jobs: - name: Run Integration tests for Modern Events Calendar Lite run: cd /workspace/Event-Federation/wordpress-activitypub-event-bridge/ && ./vendor/bin/phpunit --filter=modern_events_calendar_lite + env: + PHP_VERSION: ${{ matrix.php-version }} + + - name: Run Integration tests for EventPrime + run: cd /workspace/Event-Federation/wordpress-activitypub-event-bridge/ && ./vendor/bin/phpunit --filter=eventprime env: PHP_VERSION: ${{ matrix.php-version }} \ No newline at end of file diff --git a/composer.json b/composer.json index 4da8b48..d4c2b0b 100644 --- a/composer.json +++ b/composer.json @@ -54,11 +54,12 @@ "@test-events-manager", "@test-wp-event-manager", "@test-eventin", - "@test-modern-events-calendar-lite" + "@test-modern-events-calendar-lite", + "@test-eventprime" ], "test-debug": [ "@prepare-test", - "@test-gatherpress" + "@test-eventprime" ], "test-vs-event-list": "phpunit --filter=vs_event_list", "test-the-events-calendar": "phpunit --filter=the_events_calendar", @@ -67,6 +68,7 @@ "test-wp-event-manager": "phpunit --filter=wp_event_manager", "test-eventin": "phpunit --filter=eventin", "test-modern-events-calendar-lite": "phpunit --filter=modern_events_calendar_lite", + "test-eventprime": "phpunit --filter=eventprime", "test-all": "phpunit" } } diff --git a/includes/activitypub/transformer/class-eventprime.php b/includes/activitypub/transformer/class-eventprime.php index 2551b17..c247ebe 100644 --- a/includes/activitypub/transformer/class-eventprime.php +++ b/includes/activitypub/transformer/class-eventprime.php @@ -11,10 +11,8 @@ namespace ActivityPub_Event_Bridge\Activitypub\Transformer; // Exit if accessed directly. defined( 'ABSPATH' ) || exit; // @codeCoverageIgnore -use Activitypub\Activity\Extended_Object\Event as Event_Object; use Activitypub\Activity\Extended_Object\Place; use ActivityPub_Event_Bridge\Activitypub\Transformer\Event; -use GatherPress\Core\Event as GatherPress_Event; /** * ActivityPub Transformer for VS Event @@ -45,4 +43,36 @@ final class EventPrime extends Event { return ''; } } + + /** + * Get location from the event object. + */ + protected function get_location(): ?Place { + $venue_term_id = get_post_meta( $this->wp_object->ID, 'em_venue', true ); + if ( ! $venue_term_id ) { + return null; + } + + $venue = wp_get_post_terms( $this->wp_object->ID, 'em_venue' ); + + if ( empty( $venue ) ) { + return null; + } else { + $venue = $venue[0]; + } + + $place = new Place(); + + $place->set_name( $venue->name ); + $place->set_content( $venue->description ); + + $address = get_term_meta( $venue->term_id, 'em_address', true ); + $display_address = get_term_meta( $venue->term_id, 'em_display_address_on_frontend', true ); + + if ( $address && $display_address ) { + $place->set_address( get_term_meta( $venue->term_id, 'em_address', true ) ); + } + + return $place; + } }