Compare commits

...

43 commits

Author SHA1 Message Date
e4f195cf62 set timezone and status for tribe 2024-10-02 19:49:46 +02:00
a6938edf46 fix events manager tests: strip tags for content
All checks were successful
PHP Code Checker / PHP Code Checker (pull_request) Successful in 41s
PHPUnit / PHPUnit – PHP 8.1 (pull_request) Successful in 1m5s
PHPUnit / PHPUnit – PHP 8.2 (pull_request) Successful in 1m9s
PHPUnit / PHPUnit – PHP 8.3 (pull_request) Successful in 1m2s
2024-10-02 19:08:53 +02:00
9d2f17583d tests for events manager: fix status
Some checks failed
PHP Code Checker / PHP Code Checker (pull_request) Successful in 44s
PHPUnit / PHPUnit – PHP 8.1 (pull_request) Failing after 1m8s
PHPUnit / PHPUnit – PHP 8.2 (pull_request) Failing after 1m6s
PHPUnit / PHPUnit – PHP 8.3 (pull_request) Failing after 1m6s
2024-10-02 19:06:22 +02:00
1aedb964a9 fix gatherpress tests: event must always be published
Some checks failed
PHP Code Checker / PHP Code Checker (pull_request) Successful in 42s
PHPUnit / PHPUnit – PHP 8.1 (pull_request) Failing after 1m4s
PHPUnit / PHPUnit – PHP 8.2 (pull_request) Failing after 1m16s
PHPUnit / PHPUnit – PHP 8.3 (pull_request) Has been cancelled
2024-10-02 19:03:04 +02:00
982c9c3e44 strip tags within gatherpress tests
Some checks failed
PHP Code Checker / PHP Code Checker (pull_request) Successful in 41s
PHPUnit / PHPUnit – PHP 8.1 (pull_request) Failing after 1m5s
PHPUnit / PHPUnit – PHP 8.2 (pull_request) Failing after 1m6s
PHPUnit / PHPUnit – PHP 8.3 (pull_request) Failing after 1m0s
2024-10-02 18:54:27 +02:00
2301900baa gatherpress: prevent gatherpress blocks from being rendered in activitystreams
Some checks failed
PHP Code Checker / PHP Code Checker (pull_request) Successful in 40s
PHPUnit / PHPUnit – PHP 8.1 (pull_request) Failing after 1m5s
PHPUnit / PHPUnit – PHP 8.2 (pull_request) Failing after 1m4s
PHPUnit / PHPUnit – PHP 8.3 (pull_request) Failing after 1m7s
2024-10-02 18:46:57 +02:00
676bb20751 replace strip_tags with wp_strip_all_tags in tests
Some checks failed
PHP Code Checker / PHP Code Checker (pull_request) Successful in 46s
PHPUnit / PHPUnit – PHP 8.1 (pull_request) Failing after 1m12s
PHPUnit / PHPUnit – PHP 8.2 (pull_request) Failing after 1m16s
PHPUnit / PHPUnit – PHP 8.3 (pull_request) Failing after 1m11s
2024-10-02 18:13:41 +02:00
3975386a52 set hardcoded template for content
Some checks failed
PHP Code Checker / PHP Code Checker (pull_request) Failing after 42s
PHPUnit / PHPUnit – PHP 8.1 (pull_request) Failing after 1m5s
PHPUnit / PHPUnit – PHP 8.2 (pull_request) Failing after 1m6s
PHPUnit / PHPUnit – PHP 8.3 (pull_request) Failing after 1m5s
2024-10-02 18:10:59 +02:00
62c4e87fb2 improve tests or the events calendar 2024-10-02 18:07:12 +02:00
724a884738 add_post_type_support when updating activitypub_support_post_types
Some checks failed
PHP Code Checker / PHP Code Checker (pull_request) Successful in 45s
PHPUnit / PHPUnit – PHP 8.1 (pull_request) Failing after 1m2s
PHPUnit / PHPUnit – PHP 8.2 (pull_request) Failing after 1m8s
PHPUnit / PHPUnit – PHP 8.3 (pull_request) Failing after 1m12s
2024-10-02 18:01:20 +02:00
3f7f996e10 fix format_categories for empty term list
Some checks failed
PHP Code Checker / PHP Code Checker (pull_request) Successful in 50s
PHPUnit / PHPUnit – PHP 8.1 (pull_request) Failing after 1m8s
PHPUnit / PHPUnit – PHP 8.2 (pull_request) Failing after 1m7s
PHPUnit / PHPUnit – PHP 8.3 (pull_request) Failing after 1m9s
2024-10-02 17:11:14 +02:00
f76fa57665 improve formatting of categories
Some checks failed
PHP Code Checker / PHP Code Checker (pull_request) Successful in 42s
PHPUnit / PHPUnit – PHP 8.1 (pull_request) Failing after 1m11s
PHPUnit / PHPUnit – PHP 8.2 (pull_request) Failing after 1m14s
PHPUnit / PHPUnit – PHP 8.3 (pull_request) Failing after 1m11s
2024-10-02 16:31:32 +02:00
596e36f309 fix array in array in get_tag 2024-10-02 16:31:13 +02:00
1813a518f3 Do not set actor and do not override getAttributedTo.
Some checks failed
PHP Code Checker / PHP Code Checker (pull_request) Failing after 43s
PHPUnit / PHPUnit – PHP 8.1 (pull_request) Successful in 1m7s
PHPUnit / PHPUnit – PHP 8.2 (pull_request) Successful in 1m14s
PHPUnit / PHPUnit – PHP 8.3 (pull_request) Successful in 1m12s
This was introduced to make interoperability with Mobilizon but it should be fixed on their side.
2024-10-02 13:11:57 +02:00
2b93267272 rename extract_excerpt to retrieve_excerpt 2024-10-02 13:08:54 +02:00
b3b07d4b6a removed todo
Some checks failed
PHP Code Checker / PHP Code Checker (pull_request) Failing after 37s
PHPUnit / PHPUnit – PHP 8.1 (pull_request) Successful in 1m2s
PHPUnit / PHPUnit – PHP 8.2 (pull_request) Successful in 1m3s
PHPUnit / PHPUnit – PHP 8.3 (pull_request) Successful in 59s
2024-10-01 19:03:44 +02:00
ad09fa947c renamed get_excerpt back to extract_excerpt
Some checks failed
PHP Code Checker / PHP Code Checker (pull_request) Failing after 39s
PHPUnit / PHPUnit – PHP 8.1 (pull_request) Successful in 1m19s
PHPUnit / PHPUnit – PHP 8.2 (pull_request) Successful in 1m6s
PHPUnit / PHPUnit – PHP 8.3 (pull_request) Successful in 1m1s
2024-10-01 18:58:54 +02:00
1a5e19f3c1 added comment
Some checks failed
PHP Code Checker / PHP Code Checker (pull_request) Failing after 37s
PHPUnit / PHPUnit – PHP 8.1 (pull_request) Successful in 1m7s
PHPUnit / PHPUnit – PHP 8.2 (pull_request) Successful in 1m2s
PHPUnit / PHPUnit – PHP 8.3 (pull_request) Successful in 1m2s
2024-09-30 19:24:32 +02:00
f5df3102ad style guide fixes
Some checks failed
PHP Code Checker / PHP Code Checker (pull_request) Failing after 40s
PHPUnit / PHPUnit – PHP 8.1 (pull_request) Successful in 1m3s
PHPUnit / PHPUnit – PHP 8.2 (pull_request) Successful in 1m5s
PHPUnit / PHPUnit – PHP 8.3 (pull_request) Successful in 1m6s
2024-09-30 19:07:05 +02:00
66e06655c2 changed content/summary logic and removed the racecondition
Some checks failed
PHP Code Checker / PHP Code Checker (pull_request) Failing after 40s
PHPUnit / PHPUnit – PHP 8.1 (pull_request) Successful in 1m5s
PHPUnit / PHPUnit – PHP 8.2 (pull_request) Successful in 1m7s
PHPUnit / PHPUnit – PHP 8.3 (pull_request) Successful in 1m6s
2024-09-30 18:55:59 +02:00
64bf5b2a58 fixed events manager content test
Some checks failed
PHP Code Checker / PHP Code Checker (pull_request) Failing after 36s
PHPUnit / PHPUnit – PHP 8.1 (pull_request) Successful in 1m2s
PHPUnit / PHPUnit – PHP 8.2 (pull_request) Successful in 58s
PHPUnit / PHPUnit – PHP 8.3 (pull_request) Successful in 1m0s
2024-09-29 17:48:19 +02:00
57889bca3f fixed TEC content test
Some checks failed
PHP Code Checker / PHP Code Checker (pull_request) Failing after 33s
PHPUnit / PHPUnit – PHP 8.1 (pull_request) Failing after 1m0s
PHPUnit / PHPUnit – PHP 8.2 (pull_request) Failing after 59s
PHPUnit / PHPUnit – PHP 8.3 (pull_request) Failing after 1m0s
2024-09-29 17:45:52 +02:00
ef86fb2263 forgot to rename method call
Some checks failed
PHP Code Checker / PHP Code Checker (pull_request) Failing after 35s
PHPUnit / PHPUnit – PHP 8.1 (pull_request) Failing after 56s
PHPUnit / PHPUnit – PHP 8.2 (pull_request) Failing after 56s
PHPUnit / PHPUnit – PHP 8.3 (pull_request) Failing after 53s
2024-09-29 16:01:28 +02:00
d3f16706f8 added generic get_content from wp_object to class-event
Some checks failed
PHP Code Checker / PHP Code Checker (pull_request) Failing after 35s
PHPUnit / PHPUnit – PHP 8.1 (pull_request) Failing after 57s
PHPUnit / PHPUnit – PHP 8.2 (pull_request) Failing after 55s
PHPUnit / PHPUnit – PHP 8.3 (pull_request) Failing after 55s
2024-09-29 15:55:37 +02:00
b4d3a7efa0 changed extract_excerpt to get_excerpt 2024-09-29 15:48:01 +02:00
4f61a1c97e removed link at get_content() for all event
Some checks failed
PHP Code Checker / PHP Code Checker (pull_request) Failing after 36s
PHPUnit / PHPUnit – PHP 8.1 (pull_request) Failing after 1m0s
PHPUnit / PHPUnit – PHP 8.2 (pull_request) Failing after 55s
PHPUnit / PHPUnit – PHP 8.3 (pull_request) Failing after 57s
2024-09-29 15:45:56 +02:00
5fa3876c1a added comment on bloguser
Some checks failed
PHP Code Checker / PHP Code Checker (pull_request) Failing after 37s
PHPUnit / PHPUnit – PHP 8.1 (pull_request) Successful in 1m4s
PHPUnit / PHPUnit – PHP 8.2 (pull_request) Successful in 1m1s
PHPUnit / PHPUnit – PHP 8.3 (pull_request) Successful in 58s
2024-09-29 15:32:50 +02:00
993fc2b24f phpsniffer happy
Some checks failed
PHP Code Checker / PHP Code Checker (pull_request) Failing after 33s
PHPUnit / PHPUnit – PHP 8.1 (pull_request) Successful in 1m0s
PHPUnit / PHPUnit – PHP 8.2 (pull_request) Successful in 1m3s
PHPUnit / PHPUnit – PHP 8.3 (pull_request) Successful in 1m1s
2024-09-29 15:31:07 +02:00
24844f57c1 remove old get_summary from gatherpress and event manager in favour of the new one in class-event 2024-09-29 15:00:13 +02:00
228dba06ae Revert "improved readability of get_summary by using ternary operator"
Some checks failed
PHP Code Checker / PHP Code Checker (pull_request) Failing after 32s
PHPUnit / PHPUnit – PHP 8.1 (pull_request) Successful in 1m1s
PHPUnit / PHPUnit – PHP 8.2 (pull_request) Successful in 58s
PHPUnit / PHPUnit – PHP 8.3 (pull_request) Successful in 58s
This reverts commit 7c9424526d.
2024-09-29 14:04:07 +02:00
7d979a1c5e removed trivial to_object functions
Some checks failed
PHP Code Checker / PHP Code Checker (pull_request) Failing after 32s
PHPUnit / PHPUnit – PHP 8.1 (pull_request) Successful in 57s
PHPUnit / PHPUnit – PHP 8.2 (pull_request) Successful in 59s
PHPUnit / PHPUnit – PHP 8.3 (pull_request) Successful in 1m2s
2024-09-29 13:57:01 +02:00
1b4642d92e moved getting EM event into constructor 2024-09-29 13:56:17 +02:00
9be7cb2ce2 removed more unused code
Some checks failed
PHP Code Checker / PHP Code Checker (pull_request) Failing after 35s
PHPUnit / PHPUnit – PHP 8.1 (pull_request) Successful in 57s
PHPUnit / PHPUnit – PHP 8.2 (pull_request) Successful in 1m1s
PHPUnit / PHPUnit – PHP 8.3 (pull_request) Successful in 59s
2024-09-29 13:50:52 +02:00
20f6947bea duplicated code 2024-09-29 13:48:37 +02:00
608e18f8c1 removed unused stuff
Some checks failed
PHP Code Checker / PHP Code Checker (pull_request) Failing after 35s
PHPUnit / PHPUnit – PHP 8.1 (pull_request) Successful in 58s
PHPUnit / PHPUnit – PHP 8.2 (pull_request) Successful in 59s
PHPUnit / PHPUnit – PHP 8.3 (pull_request) Successful in 1m0s
2024-09-29 13:45:58 +02:00
b39f9997ae making php_codesniffer happy
Some checks failed
PHP Code Checker / PHP Code Checker (pull_request) Failing after 34s
PHPUnit / PHPUnit – PHP 8.1 (pull_request) Successful in 59s
PHPUnit / PHPUnit – PHP 8.2 (pull_request) Successful in 56s
PHPUnit / PHPUnit – PHP 8.3 (pull_request) Successful in 1m3s
2024-09-29 13:25:37 +02:00
a66dc74577 added comments about removing some old stuff
Some checks failed
PHP Code Checker / PHP Code Checker (pull_request) Failing after 36s
PHPUnit / PHPUnit – PHP 8.1 (pull_request) Successful in 1m0s
PHPUnit / PHPUnit – PHP 8.2 (pull_request) Successful in 1m1s
PHPUnit / PHPUnit – PHP 8.3 (pull_request) Successful in 1m3s
2024-09-29 12:52:17 +02:00
516bfd33d8 fixed wrong nullable type declaration 2024-09-29 11:45:17 +02:00
c469b7a00e made format_time() private 2024-09-29 11:44:47 +02:00
39632560ff added comments 2024-09-29 11:44:21 +02:00
f0b73d8674 duplicated code 2024-09-29 11:44:14 +02:00
7c9424526d improved readability of get_summary by using ternary operator 2024-09-29 11:43:59 +02:00
f99f009e2e splitted up format time function 2024-09-29 11:42:52 +02:00
10 changed files with 150 additions and 228 deletions

View file

@ -54,7 +54,7 @@
], ],
"test-debug": [ "test-debug": [
"@prepare-test", "@prepare-test",
"@test-vs-event-list" "@test-gatherpress"
], ],
"test-vs-event-list": "phpunit --filter=vs_event_list", "test-vs-event-list": "phpunit --filter=vs_event_list",
"test-the-events-calendar": "phpunit --filter=the_events_calendar", "test-the-events-calendar": "phpunit --filter=the_events_calendar",

View file

@ -21,6 +21,11 @@ use DateTime;
* *
* Everything that transforming several WordPress post types that represent events * Everything that transforming several WordPress post types that represent events
* have in common, as well as sane defaults for events should be defined here. * have in common, as well as sane defaults for events should be defined here.
*
* BeforeFirstRelease:
* [ ] remove link at the end of the content.
* [ ] add organizer.
* [ ] do add Cancelled reason in the content.
*/ */
abstract class Event extends Post { abstract class Event extends Post {
@ -31,17 +36,6 @@ abstract class Event extends Post {
*/ */
protected $wp_taxonomy; protected $wp_taxonomy;
/**
* Returns the User-URL of the Author of the Post.
*
* If `single_user` mode is enabled, the URL of the Blog-User is returned.
*
* @return string The User-URL.
*/
protected function get_actor(): ?string {
return $this->get_attributed_to();
}
/** /**
* Returns the ActivityStreams 2.0 Object-Type for an Event. * Returns the ActivityStreams 2.0 Object-Type for an Event.
* *
@ -60,6 +54,16 @@ abstract class Event extends Post {
return comments_open( $this->wp_object ); return comments_open( $this->wp_object );
} }
/**
* Set a hardcoded template for the content.
*
* This actually disabled templates for the content.
* Maybe this independent templates for events will be added later.
*/
protected function get_post_content_template(): string {
return '[ap_content]';
}
/** /**
* Returns the title of the event. * Returns the title of the event.
* *
@ -77,7 +81,7 @@ abstract class Event extends Post {
* @param WP_Post $wp_object The WordPress post object (event). * @param WP_Post $wp_object The WordPress post object (event).
* @param string $wp_taxonomy The taxonomy slug of the event post type. * @param string $wp_taxonomy The taxonomy slug of the event post type.
*/ */
public function __construct( $wp_object, $wp_taxonomy ) { public function __construct( $wp_object, $wp_taxonomy = 'category' ) {
parent::__construct( $wp_object ); parent::__construct( $wp_object );
$this->wp_taxonomy = $wp_taxonomy; $this->wp_taxonomy = $wp_taxonomy;
} }
@ -107,8 +111,13 @@ abstract class Event extends Post {
/** /**
* Set the event category, via the mapping setting. * Set the event category, via the mapping setting.
*
* @return ?string
*/ */
public function get_category(): ?string { public function get_category(): ?string {
if ( is_null( $this->wp_taxonomy ) ) {
return null;
}
$current_category_mapping = \get_option( 'activitypub_event_extensions_event_category_mappings', array() ); $current_category_mapping = \get_option( 'activitypub_event_extensions_event_category_mappings', array() );
$terms = \get_the_terms( $this->wp_object, $this->wp_taxonomy ); $terms = \get_the_terms( $this->wp_object, $this->wp_taxonomy );
@ -126,8 +135,8 @@ abstract class Event extends Post {
* *
* @return ?string * @return ?string
*/ */
protected function extract_excerpt(): ?string { protected function retrieve_excerpt(): ?string {
if ( $this->wp_object->excerpt ) { if ( $this->wp_object->post_excerpt ) {
return $this->wp_object->post_excerpt; return $this->wp_object->post_excerpt;
} else { } else {
return null; return null;
@ -161,11 +170,24 @@ abstract class Event extends Post {
/** /**
* Compose a human readable formatted start time. * Compose a human readable formatted start time.
*
* @param bool $is_start_time Whether format the events start or end time.
*/ */
protected function format_time( $is_start_time = true ) { protected function format_start_time(): string {
$time = $is_start_time ? $this->get_start_time() : $this->get_end_time(); return $this->format_time( $this->get_start_time() );
}
/**
* Compose a human readable formatted end time.
*/
protected function format_end_time(): string {
return $this->format_time( $this->get_end_time() );
}
/**
* Compose a human readable formatted time.
*
* @param ?string $time The time which needs to be formatted.
*/
private static function format_time( $time ) {
if ( is_null( $time ) ) { if ( is_null( $time ) ) {
return ''; return '';
} }
@ -199,14 +221,31 @@ abstract class Event extends Post {
/** /**
* Format the category using the translation. * Format the category using the translation.
*/ */
protected function format_category(): string { protected function format_categories(): string {
require_once ACTIVITYPUB_EVENT_EXTENSIONS_PLUGIN_DIR . '/includes/event-categories.php'; if ( is_null( $this->wp_taxonomy ) ) {
$category = $this->get_category(); return '';
if ( array_key_exists( $category, ACTIVITYPUB_EVENT_EXTENSIONS_EVENT_CATEGORIES ) ) {
return ACTIVITYPUB_EVENT_EXTENSIONS_EVENT_CATEGORIES[ $category ];
} else {
return ACTIVITYPUB_EVENT_EXTENSIONS_EVENT_CATEGORIES['MEETING'];
} }
$categories = array();
// Add the federated category string.
require_once ACTIVITYPUB_EVENT_EXTENSIONS_PLUGIN_DIR . '/includes/event-categories.php';
$federated_category = $this->get_category();
if ( array_key_exists( $federated_category, ACTIVITYPUB_EVENT_EXTENSIONS_EVENT_CATEGORIES ) ) {
$categories[] = ACTIVITYPUB_EVENT_EXTENSIONS_EVENT_CATEGORIES[ $federated_category ];
}
// Add all category terms.
$terms = \get_the_terms( $this->wp_object, $this->wp_taxonomy );
if ( $terms && ! is_wp_error( $terms ) ) {
foreach ( $terms as $term ) {
$categories[] = $term->name;
}
}
if ( ! empty( $categories ) ) {
return implode( ' · ', array_unique( $categories ) );
}
return '';
} }
/** /**
@ -218,36 +257,37 @@ abstract class Event extends Post {
* @return string $summary The custom event summary. * @return string $summary The custom event summary.
*/ */
public function get_summary(): ?string { public function get_summary(): ?string {
add_filter( 'activitypub_object_content_template', array( self::class, 'remove_ap_permalink_from_template' ), 2 ); add_filter( 'activitypub_object_content_template', array( self::class, 'remove_ap_permalink_from_template' ), 2, 2 );
$excerpt = $this->extract_excerpt(); $excerpt = $this->retrieve_excerpt();
// BeforeFirstRelease: decide whether this should be a admin setting. // BeforeFirstRelease: decide whether this should be a admin setting.
$fallback_to_content = true; $fallback_to_content = true;
if ( is_null( $excerpt ) && $fallback_to_content ) { if ( is_null( $excerpt ) && $fallback_to_content ) {
$excerpt = $this->get_content(); $excerpt = parent::get_content();
} }
remove_filter( 'activitypub_object_content_template', array( self::class, 'remove_ap_permalink_from_template' ) ); remove_filter( 'activitypub_object_content_template', array( self::class, 'remove_ap_permalink_from_template' ) );
$category = $this->format_category(); $category = $this->format_categories();
$start_time = $this->format_time(); $start_time = $this->format_start_time();
$end_time = $this->format_time( false ); $end_time = $this->format_end_time();
$address = $this->format_address(); $address = $this->format_address();
$formatted_items = array(); $formatted_items = array();
if ( ! empty( $category ) ) { if ( ! empty( $category ) ) {
$formatted_items[] = "🏷️ $category"; $formatted_items[] = '🏷️ ' . __( 'Category', 'activitypub-event-extensions' ) . ': ' . $category;
} }
if ( ! empty( $start_time ) ) { if ( ! empty( $start_time ) ) {
$formatted_items[] = "🗓️ {$start_time}"; $formatted_items[] = '🗓️ ' . __( 'Start', 'activitypub-event-extensions' ) . ': ' . $start_time;
} }
if ( ! empty( $end_time ) ) { if ( ! empty( $end_time ) ) {
$formatted_items[] = "{$end_time}"; $formatted_items[] = '⏳ ' . __( 'End', 'activitypub-event-extensions' ) . ': ' . $end_time;
} }
if ( ! empty( $address ) ) { if ( ! empty( $address ) ) {
$formatted_items[] = "📍 {$address}"; $formatted_items[] = '📍 ' . __( 'Address', 'activitypub-event-extensions' ) . ': ' . $address;
} }
// Compose the summary based on the number of meta items. // Compose the summary based on the number of meta items.
if ( count( $formatted_items ) > 1 ) { if ( count( $formatted_items ) > 1 ) {
$summary = '<ul><li>' . implode( '</li><li>', $formatted_items ) . '</li></ul>'; $summary = '<ul><li>' . implode( '</li><li>', $formatted_items ) . '</li></ul>';
@ -261,6 +301,17 @@ abstract class Event extends Post {
return $summary; return $summary;
} }
/**
* By default set the timezone of the WordPress site.
*
* This is likely to be overwritten by the actual transformer.
*
* @return string The timezone string of the site.
*/
public function get_timezone(): string {
return wp_timezone_string();
}
/** /**
* Remove the permalink shortcode from a WordPress template. * Remove the permalink shortcode from a WordPress template.
* *
@ -268,10 +319,16 @@ abstract class Event extends Post {
* used when converting a object, where the URL is usually appended anyway. * used when converting a object, where the URL is usually appended anyway.
* *
* @param string $template The template string. * @param string $template The template string.
* @param WP_Post|WP_Comment $wp_object The wp_object which was used to select the template.
*/ */
public static function remove_ap_permalink_from_template( $template ) { public static function remove_ap_permalink_from_template( $template, $wp_object ) {
// we could override the template here, to get out custom template from an option.
if ( 'event' === $wp_object->post_type ) {
$template = str_replace( '[ap_permalink]', '', $template ); $template = str_replace( '[ap_permalink]', '', $template );
$template = str_replace( '[ap_permalink type="html"]', '', $template ); $template = str_replace( '[ap_permalink type="html"]', '', $template );
}
return $template; return $template;
} }
@ -285,6 +342,8 @@ abstract class Event extends Post {
$activitypub_object = new Event_Object(); $activitypub_object = new Event_Object();
$activitypub_object = $this->transform_object_properties( $activitypub_object ); $activitypub_object = $this->transform_object_properties( $activitypub_object );
// maybe move the following logic (till end of the function) into getter functions.
$published = \strtotime( $this->wp_object->post_date_gmt ); $published = \strtotime( $this->wp_object->post_date_gmt );
$activitypub_object->set_published( \gmdate( 'Y-m-d\TH:i:s\Z', $published ) ); $activitypub_object->set_published( \gmdate( 'Y-m-d\TH:i:s\Z', $published ) );
@ -304,7 +363,7 @@ abstract class Event extends Post {
$activitypub_object->set_to( $activitypub_object->set_to(
array( array(
'https://www.w3.org/ns/activitystreams#Public', 'https://www.w3.org/ns/activitystreams#Public',
$this->get_actor_object()->get_followers(), $this->get_actor_object()->get_followers(), // this fails on my machine.
) )
); );

View file

@ -37,42 +37,17 @@ final class Events_Manager extends Event_Transformer {
protected $em_event; protected $em_event;
/** /**
* Get transformer name. * Extend the constructor, to also set the Eventsmanager objects.
* *
* Retrieve the transformers name. * This is a special class object form The Events Calendar which
* has a lot of useful functions, we make use of our getter functions.
* *
* @since 1.0.0 * @param WP_Post $wp_object The WordPress object.
* @access public * @param string $wp_taxonomy The taxonomy slug of the event post type.
* @return string Widget name.
*/ */
public function get_transformer_name() { public function __construct( $wp_object, $wp_taxonomy ) {
return 'activitypub-event-transformers/events-manager'; parent::__construct( $wp_object, $wp_taxonomy );
} $this->em_event = new EM_Event( $this->wp_object->ID, 'post_id' );
/**
* Get transformer title.
*
* Retrieve the transformers label.
*
* @since 1.0.0
* @access public
* @return string Widget title.
*/
public function get_transformer_label() {
return 'Events Manager';
}
/**
* Get supported post types.
*
* Retrieve the list of supported WordPress post types this transformer widget can handle.
*
* @since 1.0.0
* @access public
* @return array Widget categories.
*/
public static function get_supported_post_types() {
return array();
} }
/** /**
@ -114,9 +89,6 @@ final class Events_Manager extends Event_Transformer {
if ( $em_location->location_state ) { if ( $em_location->location_state ) {
$address['addressRegion'] = $em_location->location_state; $address['addressRegion'] = $em_location->location_state;
} }
if ( $em_location->location_postcode ) {
$address['postalCode'] = $em_location->location_postcode;
}
$location->set_address( $address ); $location->set_address( $address );
return $location; return $location;
@ -163,8 +135,8 @@ final class Events_Manager extends Event_Transformer {
* @return int * @return int
*/ */
public function get_remaining_attendee_capacity() { public function get_remaining_attendee_capacity() {
$em_bookings = $this->em_event->get_bookings()->get_bookings(); $em_bookings_count = $this->get_participant_count();
$remaining_attendee_capacity = $this->em_event->event_spaces - count( $em_bookings->bookings ); $remaining_attendee_capacity = $this->em_event->event_spaces - $em_bookings_count;
return $remaining_attendee_capacity; return $remaining_attendee_capacity;
} }
@ -178,23 +150,6 @@ final class Events_Manager extends Event_Transformer {
return count( $em_bookings->bookings ); return count( $em_bookings->bookings );
} }
/**
* Hardcoded function for generating a summary.
*/
public function get_summary(): ?string {
if ( $this->em_event->post_excerpt ) {
$excerpt = $this->em_event->post_excerpt;
} else {
$excerpt = $this->get_content();
}
$address = $this->em_event->get_location()->location_name;
$start_time = strtotime( $this->get_start_time() );
$datetime_format = get_option( 'date_format' ) . ' ' . get_option( 'time_format' );
$start_time_string = wp_date( $datetime_format, $start_time );
$summary = "📍 {$address}\n📅 {$start_time_string}\n\n{$excerpt}";
return $summary;
}
/** /**
* Get the event link as an ActivityPub Link object, but as an associative array. * Get the event link as an ActivityPub Link object, but as an associative array.
* *
@ -260,20 +215,4 @@ final class Events_Manager extends Event_Transformer {
protected function get_name(): string { protected function get_name(): string {
return $this->em_event->event_name; return $this->em_event->event_name;
} }
/**
* Transform the WordPress Object into an ActivityPub Object.
*
* @return Activitypub\Activity\Event
*/
public function to_object(): Event {
$this->em_event = new EM_Event( $this->wp_object->ID, 'post_id' );
$activitypub_object = new Event();
$activitypub_object = $this->transform_object_properties( $activitypub_object );
$activitypub_object->set_external_participation_url( $this->get_url() );
return $activitypub_object;
}
} }

View file

@ -24,13 +24,6 @@ use GatherPress\Core\Event as GatherPress_Event;
*/ */
final class GatherPress extends Event { final class GatherPress extends Event {
/**
* The target ActivityPub Event object of the transformer.
*
* @var Event
*/
protected $ap_object;
/** /**
* The current GatherPress Event object. * The current GatherPress Event object.
* *
@ -60,19 +53,6 @@ final class GatherPress extends Event {
$this->gp_venue = $this->gp_event->get_venue_information(); $this->gp_venue = $this->gp_event->get_venue_information();
} }
/**
* Get supported post types.
*
* Retrieve the list of supported WordPress post types this transformer widget can handle.
*
* @since 1.0.0
* @access public
* @return array Widget categories.
*/
public static function get_supported_post_types() {
return array( GatherPress_Event::POST_TYPE );
}
/** /**
* Get the event location. * Get the event location.
* *
@ -138,47 +118,30 @@ final class GatherPress extends Event {
} }
/** /**
* Returns the User-URL of the Author of the Post. * Prevents gatherpress blocks from being rendered for the content.
* *
* If `single_user` mode is enabled, the URL of the Blog-User is returned. * @param mixed $block_content The blocks content.
* * @param mixed $block The block.
* @return string The User-URL.
*/ */
protected function get_attributed_to(): string { public static function filter_gatherpress_blocks( $block_content, $block ) {
$user = new Blog(); // Check if the block name starts with 'gatherpress'.
return $user->get_url(); if ( strpos( $block['blockName'], 'gatherpress/' ) === 0 ) {
return ''; // Skip rendering this block.
}
return $block_content; // Return the content for other blocks.
} }
/** /**
* Create a custom summary. * Apply the filter for preventing the rendering off gatherpress blocks just in time.
* *
* It contains also the most important meta-information. The summary is often used when the * @return Event_Object
* ActivityPub object type 'Event' is not supported, e.g. in Mastodon.
*
* @return string $summary The custom event summary.
*/ */
public function get_summary(): string { public function to_object(): Event_Object {
if ( $this->wp_object->excerpt ) { add_filter( 'render_block', array( self::class, 'filter_gatherpress_blocks' ), 10, 2 );
$excerpt = $this->wp_object->post_excerpt; $activitypub_object = parent::to_object();
} elseif ( get_post_meta( $this->wp_object->ID, 'event-summary', true ) ) { remove_filter( 'render_block', array( self::class, 'filter_gatherpress_blocks' ) );
$excerpt = get_post_meta( $this->wp_object->ID, 'event-summary', true ); return $activitypub_object;
} else {
$excerpt = $this->get_content();
}
$address = get_post_meta( $this->wp_object->ID, 'event-location', true );
$start_time = get_post_meta( $this->wp_object->ID, 'event-start-date', true );
$datetime_format = get_option( 'date_format' ) . ' ' . get_option( 'time_format' );
$start_time_string = wp_date( $datetime_format, $start_time );
$summary = "📍 {$address}\n📅 {$start_time_string}\n\n{$excerpt}";
return $summary;
}
/**
* Get the content.
*/
public function get_content(): string {
return $this->wp_object->post_content;
} }
/** /**
@ -189,16 +152,4 @@ final class GatherPress extends Event {
public function get_is_online(): bool { public function get_is_online(): bool {
return $this->gp_event->maybe_get_online_event_link() ? true : false; return $this->gp_event->maybe_get_online_event_link() ? true : false;
} }
/**
* Transform the WordPress Object into an ActivityPub Object.
*
* @return Activitypub\Activity\Event
*/
public function to_object(): Event_Object {
$activitypub_object = parent::to_object();
return $activitypub_object;
}
} }

View file

@ -65,7 +65,7 @@ final class The_Events_Calendar extends Event {
$tags[] = $tag; $tags[] = $tag;
} }
} }
$tags[] = parent::get_tag(); $tags = array_merge( $tags, parent::get_tag() );
return $tags; return $tags;
} }
@ -94,7 +94,7 @@ final class The_Events_Calendar extends Event {
* *
* @return string status of the event * @return string status of the event
*/ */
public function get_tribe_status() { public function get_status() {
if ( 'canceled' === $this->tribe_event->event_status ) { if ( 'canceled' === $this->tribe_event->event_status ) {
return 'CANCELLED'; return 'CANCELLED';
} }
@ -119,23 +119,6 @@ final class The_Events_Calendar extends Event {
return false; return false;
} }
/**
* Returns the content for the ActivityPub Item with
*
* The content will be generated based on the user settings.
*
* @return string The content.
*/
protected function get_content() {
$content = parent::get_content();
// /BeforeFirstRelease:
// * remove link at the end of the content.
// * add organizer.
// * do add Cancelled reason in the content.s
return $content;
}
/** /**
* Get the event location. * Get the event location.
* *
@ -198,15 +181,11 @@ final class The_Events_Calendar extends Event {
} }
/** /**
* Extend the default event transformers to_object function. * Get the timezone of the event.
* *
* This is the heart of the ActivityPub transformer. * @return string The timezone string of the site.
*
* @return Event_Object
*/ */
public function to_object(): Event_Object { public function get_timezone(): string {
$activitypub_object = parent::to_object(); return $this->tribe_event->timezone;
return $activitypub_object;
} }
} }

View file

@ -23,12 +23,6 @@ use Activitypub_Event_Extensions\Activitypub\Transformer\Event as Event_Transfor
* @since 1.0.0 * @since 1.0.0
*/ */
final class VS_Event_List extends Event_Transformer { final class VS_Event_List extends Event_Transformer {
/**
* The target transformer ActivityPub Event object.
*
* @var Event
*/
protected $ap_object;
/** /**
* Get the event location. * Get the event location.
@ -110,13 +104,11 @@ final class VS_Event_List extends Event_Transformer {
* *
* @return ?string * @return ?string
*/ */
protected function get_excerpt(): ?string { protected function retrieve_excerpt(): ?string {
if ( get_post_meta( $this->wp_object->ID, 'event-summary', true ) ) { if ( get_post_meta( $this->wp_object->ID, 'event-summary', true ) ) {
return get_post_meta( $this->wp_object->ID, 'event-summary', true ); return get_post_meta( $this->wp_object->ID, 'event-summary', true );
} elseif ( $this->wp_object->excerpt ) {
return $this->wp_object->post_excerpt;
} else { } else {
return null; return parent::retrieve_excerpt();
} }
} }
} }

View file

@ -272,6 +272,7 @@ class Setup {
foreach ( $this->active_event_plugins as $event_plugin ) { foreach ( $this->active_event_plugins as $event_plugin ) {
if ( ! in_array( $event_plugin->get_post_type(), $activitypub_supported_post_types, true ) ) { if ( ! in_array( $event_plugin->get_post_type(), $activitypub_supported_post_types, true ) ) {
$activitypub_supported_post_types[] = $event_plugin->get_post_type(); $activitypub_supported_post_types[] = $event_plugin->get_post_type();
add_post_type_support( $event_plugin->get_post_type(), 'activitypub' );
} }
} }
update_option( 'activitypub_support_post_types', $activitypub_supported_post_types ); update_option( 'activitypub_support_post_types', $activitypub_supported_post_types );

View file

@ -47,7 +47,7 @@ class Test_Events_Manager extends WP_UnitTestCase {
$wp_post_id = wp_insert_post( $wp_post_id = wp_insert_post(
array( array(
'post_title' => 'Events Manager Test event', 'post_title' => 'Events Manager Test event',
'post_status' => 'published', 'post_status' => 'publish',
'post_type' => EM_POST_TYPE_EVENT, 'post_type' => EM_POST_TYPE_EVENT,
'meta_input' => array( 'meta_input' => array(
'event_start_time' => strtotime( '+10 days 15:00:00' ), 'event_start_time' => strtotime( '+10 days 15:00:00' ),
@ -75,7 +75,7 @@ class Test_Events_Manager extends WP_UnitTestCase {
$event->event_start_date = gmdate( 'Y-m-d', strtotime( '+10 days 15:00:00' ) ); $event->event_start_date = gmdate( 'Y-m-d', strtotime( '+10 days 15:00:00' ) );
$event->event_start_time = '15:00:00'; $event->event_start_time = '15:00:00';
$event->start = strtotime( $event->event_start_date . ' ' . $event->event_start_time ); $event->start = strtotime( $event->event_start_date . ' ' . $event->event_start_time );
$event->force_status = 'published'; $event->force_status = 'publish';
$event->event_rsvp = false; $event->event_rsvp = false;
$this->assertTrue( $event->save() ); $this->assertTrue( $event->save() );
@ -85,7 +85,7 @@ class Test_Events_Manager extends WP_UnitTestCase {
// Check that we got the right transformer. // Check that we got the right transformer.
$this->assertEquals( 'Event', $event_array['type'] ); $this->assertEquals( 'Event', $event_array['type'] );
$this->assertEquals( 'Events Manager Test event', $event_array['name'] ); $this->assertEquals( 'Events Manager Test event', $event_array['name'] );
$this->assertEquals( '', $event_array['content'] ); $this->assertEquals( 'Event description', wp_strip_all_tags( $event_array['content'] ) );
$this->assertEquals( gmdate( 'Y-m-d', strtotime( '+10 days 15:00:00' ) ) . 'T15:00:00Z', $event_array['startTime'] ); $this->assertEquals( gmdate( 'Y-m-d', strtotime( '+10 days 15:00:00' ) ) . 'T15:00:00Z', $event_array['startTime'] );
$this->assertEquals( comments_open( $event->post_id ), $event_array['commentsEnabled'] ); $this->assertEquals( comments_open( $event->post_id ), $event_array['commentsEnabled'] );
$this->assertEquals( comments_open( $event->post_id ) ? 'allow_all' : 'closed', $event_array['repliesModerationOption'] ); $this->assertEquals( comments_open( $event->post_id ) ? 'allow_all' : 'closed', $event_array['repliesModerationOption'] );
@ -121,7 +121,7 @@ class Test_Events_Manager extends WP_UnitTestCase {
$event->event_end_time = '16:00:00'; $event->event_end_time = '16:00:00';
$event->start = strtotime( $event->event_start_date . ' ' . $event->event_start_time ); $event->start = strtotime( $event->event_start_date . ' ' . $event->event_start_time );
$event->end = strtotime( $event->event_end_date . ' ' . $event->event_end_time ); $event->end = strtotime( $event->event_end_date . ' ' . $event->event_end_time );
$event->force_status = 'published'; $event->force_status = 'publish';
$event->event_rsvp = false; $event->event_rsvp = false;
$this->assertTrue( $event->save() ); $this->assertTrue( $event->save() );
@ -131,7 +131,7 @@ class Test_Events_Manager extends WP_UnitTestCase {
// Check that we got the right transformer. // Check that we got the right transformer.
$this->assertEquals( 'Event', $event_array['type'] ); $this->assertEquals( 'Event', $event_array['type'] );
$this->assertEquals( 'Events Manager Test event', $event_array['name'] ); $this->assertEquals( 'Events Manager Test event', $event_array['name'] );
$this->assertEquals( '', $event_array['content'] ); $this->assertEquals( 'Event description', wp_strip_all_tags( $event_array['content'] ) );
$this->assertEquals( gmdate( 'Y-m-d', strtotime( '+10 days 15:00:00' ) ) . 'T15:00:00Z', $event_array['startTime'] ); $this->assertEquals( gmdate( 'Y-m-d', strtotime( '+10 days 15:00:00' ) ) . 'T15:00:00Z', $event_array['startTime'] );
$this->assertEquals( 'external', $event_array['joinMode'] ); $this->assertEquals( 'external', $event_array['joinMode'] );
$this->assertEquals( 'MEETING', $event_array['category'] ); $this->assertEquals( 'MEETING', $event_array['category'] );
@ -164,7 +164,7 @@ class Test_Events_Manager extends WP_UnitTestCase {
$event->event_end_time = '16:00:00'; $event->event_end_time = '16:00:00';
$event->start = strtotime( $event->event_start_date . ' ' . $event->event_start_time ); $event->start = strtotime( $event->event_start_date . ' ' . $event->event_start_time );
$event->end = strtotime( $event->event_end_date . ' ' . $event->event_end_time ); $event->end = strtotime( $event->event_end_date . ' ' . $event->event_end_time );
$event->force_status = 'published'; $event->force_status = 'publish';
$event->event_rsvp = false; $event->event_rsvp = false;
$this->assertTrue( $event->save() ); $this->assertTrue( $event->save() );
@ -174,7 +174,7 @@ class Test_Events_Manager extends WP_UnitTestCase {
// Check that we got the right transformer. // Check that we got the right transformer.
$this->assertEquals( 'Event', $event_array['type'] ); $this->assertEquals( 'Event', $event_array['type'] );
$this->assertEquals( 'Events Manager Test event', $event_array['name'] ); $this->assertEquals( 'Events Manager Test event', $event_array['name'] );
$this->assertEquals( '', $event_array['content'] ); $this->assertEquals( 'Event description', wp_strip_all_tags( $event_array['content'] ) );
$this->assertEquals( gmdate( 'Y-m-d', strtotime( '+10 days 15:00:00' ) ) . 'T15:00:00Z', $event_array['startTime'] ); $this->assertEquals( gmdate( 'Y-m-d', strtotime( '+10 days 15:00:00' ) ) . 'T15:00:00Z', $event_array['startTime'] );
$this->assertEquals( 'external', $event_array['joinMode'] ); $this->assertEquals( 'external', $event_array['joinMode'] );
$this->assertEquals( 'MEETING', $event_array['category'] ); $this->assertEquals( 'MEETING', $event_array['category'] );

View file

@ -49,6 +49,7 @@ class Test_GatherPress extends WP_UnitTestCase {
'post_title' => 'Unit Test Event', 'post_title' => 'Unit Test Event',
'post_type' => 'gatherpress_event', 'post_type' => 'gatherpress_event',
'post_content' => 'Unit Test description.', 'post_content' => 'Unit Test description.',
'post_status' => 'publish',
) )
); );
$event = new \GatherPress\Core\Event( $post_id ); $event = new \GatherPress\Core\Event( $post_id );
@ -77,7 +78,7 @@ class Test_GatherPress extends WP_UnitTestCase {
'post_title' => 'Unit Test Event', 'post_title' => 'Unit Test Event',
'post_type' => 'gatherpress_event', 'post_type' => 'gatherpress_event',
'post_content' => 'Unit Test description.', 'post_content' => 'Unit Test description.',
'post_status' => 'published', 'post_status' => 'publish',
) )
); );
$event = new \GatherPress\Core\Event( $post_id ); $event = new \GatherPress\Core\Event( $post_id );
@ -94,7 +95,7 @@ class Test_GatherPress extends WP_UnitTestCase {
// Check that the event ActivityStreams representation contains everything as expected. // Check that the event ActivityStreams representation contains everything as expected.
$this->assertEquals( 'Event', $event_array['type'] ); $this->assertEquals( 'Event', $event_array['type'] );
$this->assertEquals( 'Unit Test Event', $event_array['name'] ); $this->assertEquals( 'Unit Test Event', $event_array['name'] );
$this->assertEquals( 'Unit Test description.', $event_array['content'] ); $this->assertEquals( 'Unit Test description.', wp_strip_all_tags( $event_array['content'] ) );
$this->assertEquals( gmdate( 'Y-m-d', strtotime( '+10 days 15:00:00' ) ) . 'T15:00:00Z', $event_array['startTime'] ); $this->assertEquals( gmdate( 'Y-m-d', strtotime( '+10 days 15:00:00' ) ) . 'T15:00:00Z', $event_array['startTime'] );
$this->assertEquals( gmdate( 'Y-m-d', strtotime( '+10 days 16:00:00' ) ) . 'T16:00:00Z', $event_array['endTime'] ); $this->assertEquals( gmdate( 'Y-m-d', strtotime( '+10 days 16:00:00' ) ) . 'T16:00:00Z', $event_array['endTime'] );
$this->assertEquals( 'external', $event_array['joinMode'] ); $this->assertEquals( 'external', $event_array['joinMode'] );

View file

@ -37,14 +37,14 @@ class Test_The_Events_Calendar extends WP_UnitTestCase {
public const MOCKUP_EVENTS = array( public const MOCKUP_EVENTS = array(
'minimal_event' => array( 'minimal_event' => array(
'title' => 'My Event', 'title' => 'My Event',
'content' => 'Come to my event. Let\'s connect!', 'content' => 'Come to my event!',
'start_date' => '+10 days 15:00:00', 'start_date' => '+10 days 15:00:00',
'duration' => HOUR_IN_SECONDS, 'duration' => HOUR_IN_SECONDS,
'status' => 'publish', 'status' => 'publish',
), ),
'complex_event' => array( 'complex_event' => array(
'title' => 'My Event', 'title' => 'My Event',
'content' => 'Come to my event. Let\'s connect!', 'content' => 'Come to my event!',
'start_date' => '+10 days 15:00:00', 'start_date' => '+10 days 15:00:00',
'duration' => HOUR_IN_SECONDS, 'duration' => HOUR_IN_SECONDS,
'status' => 'publish', 'status' => 'publish',
@ -109,7 +109,7 @@ class Test_The_Events_Calendar extends WP_UnitTestCase {
// Check that the event ActivityStreams representation contains everything as expected. // Check that the event ActivityStreams representation contains everything as expected.
$this->assertEquals( 'Event', $event_array['type'] ); $this->assertEquals( 'Event', $event_array['type'] );
$this->assertEquals( 'My Event', $event_array['name'] ); $this->assertEquals( 'My Event', $event_array['name'] );
$this->assertEquals( '', $event_array['content'] ); $this->assertEquals( 'Come to my event!', wp_strip_all_tags( $event_array['content'] ) );
$this->assertEquals( gmdate( 'Y-m-d', strtotime( '+10 days 15:00:00' ) ) . 'T15:00:00Z', $event_array['startTime'] ); $this->assertEquals( gmdate( 'Y-m-d', strtotime( '+10 days 15:00:00' ) ) . 'T15:00:00Z', $event_array['startTime'] );
$this->assertEquals( gmdate( 'Y-m-d', strtotime( '+10 days 16:00:00' ) ) . 'T16:00:00Z', $event_array['endTime'] ); $this->assertEquals( gmdate( 'Y-m-d', strtotime( '+10 days 16:00:00' ) ) . 'T16:00:00Z', $event_array['endTime'] );
$this->assertTrue( $event_array['commentsEnabled'] ); $this->assertTrue( $event_array['commentsEnabled'] );
@ -170,7 +170,7 @@ class Test_The_Events_Calendar extends WP_UnitTestCase {
// Check that the event ActivityStreams representation contains everything as expected. // Check that the event ActivityStreams representation contains everything as expected.
$this->assertEquals( 'Event', $event_array['type'] ); $this->assertEquals( 'Event', $event_array['type'] );
$this->assertEquals( 'My Event', $event_array['name'] ); $this->assertEquals( 'My Event', $event_array['name'] );
$this->assertEquals( '', $event_array['content'] ); $this->assertEquals( 'Come to my event!', wp_strip_all_tags( $event_array['content'] ) );
$this->assertEquals( gmdate( 'Y-m-d', strtotime( '+10 days 15:00:00' ) ) . 'T15:00:00Z', $event_array['startTime'] ); $this->assertEquals( gmdate( 'Y-m-d', strtotime( '+10 days 15:00:00' ) ) . 'T15:00:00Z', $event_array['startTime'] );
$this->assertEquals( gmdate( 'Y-m-d', strtotime( '+10 days 16:00:00' ) ) . 'T16:00:00Z', $event_array['endTime'] ); $this->assertEquals( gmdate( 'Y-m-d', strtotime( '+10 days 16:00:00' ) ) . 'T16:00:00Z', $event_array['endTime'] );
$this->assertEquals( gmdate( 'Y-m-d', strtotime( '+10 days 16:00:00' ) ) . 'T16:00:00Z', $event_array['commentsEnabled'] ); $this->assertEquals( gmdate( 'Y-m-d', strtotime( '+10 days 16:00:00' ) ) . 'T16:00:00Z', $event_array['commentsEnabled'] );
@ -197,7 +197,7 @@ class Test_The_Events_Calendar extends WP_UnitTestCase {
// Check that the event ActivityStreams representation contains everything as expected. // Check that the event ActivityStreams representation contains everything as expected.
$this->assertEquals( 'Event', $event_array['type'] ); $this->assertEquals( 'Event', $event_array['type'] );
$this->assertEquals( 'My Event', $event_array['name'] ); $this->assertEquals( 'My Event', $event_array['name'] );
$this->assertEquals( '', $event_array['content'] ); $this->assertEquals( 'Come to my event!', wp_strip_all_tags( $event_array['content'] ) );
$this->assertEquals( gmdate( 'Y-m-d', strtotime( '+10 days 15:00:00' ) ) . 'T15:00:00Z', $event_array['startTime'] ); $this->assertEquals( gmdate( 'Y-m-d', strtotime( '+10 days 15:00:00' ) ) . 'T15:00:00Z', $event_array['startTime'] );
$this->assertEquals( gmdate( 'Y-m-d', strtotime( '+10 days 16:00:00' ) ) . 'T16:00:00Z', $event_array['endTime'] ); $this->assertEquals( gmdate( 'Y-m-d', strtotime( '+10 days 16:00:00' ) ) . 'T16:00:00Z', $event_array['endTime'] );
$this->assertEquals( gmdate( 'Y-m-d', strtotime( '+10 days 16:00:00' ) ) . 'T16:00:00Z', $event_array['commentsEnabled'] ); $this->assertEquals( gmdate( 'Y-m-d', strtotime( '+10 days 16:00:00' ) ) . 'T16:00:00Z', $event_array['commentsEnabled'] );