Add integration tests for The Events Calendar #31

Merged
linos merged 17 commits from improve_tests into main 2024-09-24 16:24:32 +02:00
2 changed files with 8 additions and 1 deletions
Showing only changes of commit d1bb939328 - Show all commits

View file

@ -43,7 +43,7 @@
],
"test": [
"composer install",
"tests/install-wp-tests.sh wordpress-test root wordpress-test test-db latest true",
"bin/install-wp-tests.sh wordpress-test root wordpress-test test-db latest true",
"phpunit"
]
}

View file

@ -39,6 +39,7 @@ class Test_Sample extends WP_UnitTestCase {
$aec->activate_activitypub_support_for_active_event_plugins();
$this->assertContains( 'tribe_events', get_option( 'activitypub_support_post_types' ) );
// Create a The Events Calendar Event without content.
$wp_object = tribe_events()
->set_args(
array(
@ -51,10 +52,16 @@ class Test_Sample extends WP_UnitTestCase {
)
->create();
// Call the transformer Factory.
$transformer = \Activitypub\Transformer\Factory::get_transformer( $wp_object );
// Check that we got the right transformer.
$this->assertInstanceOf( \Activitypub_Event_Extensions\Activitypub\Transformer\The_Events_Calendar::class, $transformer );
// Let the transformer do the work.
$event_array = $transformer->to_object()->to_array();
// Check that the event ActivityStreams representation contains everything as expected.
$this->assertArrayHasKey( 'type', $event_array );
$this->assertEquals( 'Event', $event_array['type'] );