From d1bb939328871f8544ed2c232d265933aeb194db Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Menrath?= Date: Tue, 24 Sep 2024 10:51:28 +0200 Subject: [PATCH] test --- composer.json | 2 +- tests/test-class-sample.php | 7 +++++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/composer.json b/composer.json index 2a2a7cc..ba5b52a 100644 --- a/composer.json +++ b/composer.json @@ -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" ] } diff --git a/tests/test-class-sample.php b/tests/test-class-sample.php index 1347d48..1cdba36 100644 --- a/tests/test-class-sample.php +++ b/tests/test-class-sample.php @@ -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'] );