From 60ebd72e4172c89a62f7bb5a4e2d571d59f31b23 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Menrath?= Date: Sat, 4 Jan 2025 12:32:32 +0100 Subject: [PATCH] Fix test for static private method --- tests/includes/class-test-outbox-parser.php | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/tests/includes/class-test-outbox-parser.php b/tests/includes/class-test-outbox-parser.php index dab679b..35ee4f6 100644 --- a/tests/includes/class-test-outbox-parser.php +++ b/tests/includes/class-test-outbox-parser.php @@ -135,7 +135,14 @@ class Test_Outbox_Parser extends \WP_UnitTestCase { 'object' => 'https://remote2.example/@actor/status/2', ), ); - $count = \Event_Bridge_For_ActivityPub\Outbox_Parser::import_events_from_items( $items, 'https://remote.example/@organizer' ); + + // The function we want to test is private, so we need a Reflection class. + $reflection = new \ReflectionClass( \Event_Bridge_For_ActivityPub\Outbox_Parser::class ); + + $method = $reflection->getMethod( 'import_events_from_items' ); + $method->setAccessible( true ); + + $count = $method->invoke( null, $items, 'https://remote.example/@organizer' ); $this->assertEquals( 2, $count );