test
All checks were successful
PHPUnit / PHPUnit – PHP (push) Successful in 52s

This commit is contained in:
André Menrath 2024-09-24 10:51:28 +02:00
parent e7960707d3
commit d1bb939328
2 changed files with 8 additions and 1 deletions

View file

@ -43,7 +43,7 @@
], ],
"test": [ "test": [
"composer install", "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" "phpunit"
] ]
} }

View file

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