basic tests for event organiser
Some checks failed
PHP Code Checker / PHP Code Checker (pull_request) Failing after 51s
PHPUnit / PHPUnit – PHP 7.4 (pull_request) Failing after 1m3s
PHPUnit / PHPUnit – PHP 8.1 (pull_request) Has been cancelled
PHPUnit / PHPUnit – PHP 8.2 (pull_request) Has been cancelled
PHPUnit / PHPUnit – PHP 8.3 (pull_request) Has been cancelled
PHPUnit / PHPUnit – PHP 8.0 (pull_request) Has been cancelled
Some checks failed
PHP Code Checker / PHP Code Checker (pull_request) Failing after 51s
PHPUnit / PHPUnit – PHP 7.4 (pull_request) Failing after 1m3s
PHPUnit / PHPUnit – PHP 8.1 (pull_request) Has been cancelled
PHPUnit / PHPUnit – PHP 8.2 (pull_request) Has been cancelled
PHPUnit / PHPUnit – PHP 8.3 (pull_request) Has been cancelled
PHPUnit / PHPUnit – PHP 8.0 (pull_request) Has been cancelled
This commit is contained in:
parent
9356476901
commit
e981827e0a
3 changed files with 29 additions and 5 deletions
|
@ -20,18 +20,39 @@ use ActivityPub_Event_Bridge\Activitypub\Transformer\Event;
|
|||
* @since 1.0.0
|
||||
*/
|
||||
final class Event_Organiser extends Event {
|
||||
/**
|
||||
* Extended constructor.
|
||||
*
|
||||
* The wp_object is overridden with a the wp_object with filters. This object
|
||||
* also contains attributes specific to the Event organiser plugin like the
|
||||
* occurrence id.
|
||||
*
|
||||
* @param WP_Post $wp_object The WordPress object.
|
||||
* @param string $wp_taxonomy The taxonomy slug of the event post type.
|
||||
*/
|
||||
public function __construct( $wp_object, $wp_taxonomy ) {
|
||||
parent::__construct( $wp_object, $wp_taxonomy );
|
||||
$this->wp_object = get_posts(
|
||||
array(
|
||||
'ID' => $wp_object->ID,
|
||||
'post_type' => 'event',
|
||||
'suppress_filters' => false,
|
||||
)
|
||||
)[0];
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the end time from the event object.
|
||||
*/
|
||||
protected function get_end_time(): ?string {
|
||||
return eo_get_the_end( 'Y-m-d\TH:i:s\Z', $this->wp_object->ID );
|
||||
return eo_get_the_end( 'Y-m-d\TH:i:s\Z', $this->wp_object->ID, $this->wp_object->occurrence_id );
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the end time from the event object.
|
||||
*/
|
||||
protected function get_start_time(): string {
|
||||
return eo_get_the_start( 'Y-m-d\TH:i:s\Z', $this->wp_object->ID );
|
||||
return eo_get_the_start( 'Y-m-d\TH:i:s\Z', $this->wp_object->ID, $this->wp_object->occurrence_id );
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -103,9 +103,9 @@ function _manually_load_plugin() {
|
|||
$mec_factory->install();
|
||||
}
|
||||
|
||||
if ( 'event-organiser' === $activitypub_event_bridge_integration_filter ) {
|
||||
if ( 'event_organiser' === $activitypub_event_bridge_integration_filter ) {
|
||||
require_once $plugin_dir . 'event-organiser/includes/event-organiser-install.php';
|
||||
eventorganiser_install();
|
||||
// eventorganiser_install();
|
||||
}
|
||||
|
||||
// At last manually load our WordPress plugin.
|
||||
|
|
|
@ -15,7 +15,7 @@ class Test_Event_Organiser extends WP_UnitTestCase {
|
|||
public function set_up() {
|
||||
parent::set_up();
|
||||
|
||||
if ( ! class_exists( '\EO_Query_Result' ) ) {
|
||||
if ( ! function_exists( 'eo_get_events' ) ) {
|
||||
self::markTestSkipped( 'Event Organiser plugin is not active.' );
|
||||
}
|
||||
|
||||
|
@ -50,6 +50,7 @@ class Test_Event_Organiser extends WP_UnitTestCase {
|
|||
$post_data = array(
|
||||
'post_title' => 'Unit Test Event',
|
||||
'post_content' => 'Unit Test description.',
|
||||
'post_status' => 'publish',
|
||||
);
|
||||
|
||||
$post_id = eo_insert_event( $post_data, $event_data );
|
||||
|
@ -59,6 +60,7 @@ class Test_Event_Organiser extends WP_UnitTestCase {
|
|||
|
||||
// Check that we got the right transformer.
|
||||
$this->assertInstanceOf( \ActivityPub_Event_Bridge\Activitypub\Transformer\Event_Organiser::class, $transformer );
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -76,6 +78,7 @@ class Test_Event_Organiser extends WP_UnitTestCase {
|
|||
$post_data = array(
|
||||
'post_title' => 'Unit Test Event',
|
||||
'post_content' => 'Unit Test description.',
|
||||
'post_status' => 'publish',
|
||||
);
|
||||
|
||||
$post_id = eo_insert_event( $post_data, $event_data );
|
||||
|
|
Loading…
Reference in a new issue