Fix Hook_Formatter::format to accept WP_Hook object as argument
Tests / tests (push) Successful in 5s
Release / upload-asset (push) Successful in 4s

This commit is contained in:
sandros committed 2026-09-27 23:12:44 +02:00
1 parent a30722c751
commit fad92f739c
2 files changed
+84 -36

No files matched your search

+22 -1
View File
@@ -58,5 +58,26 @@ class HookTest extends LapsTestCase {
$this->assertEquals( [], $formatter->format( [] ) );
}
}
/**
* @depends test__construct
*/
public function testFormatWpHook( Hook_Formatter $formatter ) {
if ( ! class_exists( 'WP_Hook' ) ) {
eval( 'class WP_Hook { public $callbacks = []; }' );
}
$wp_hook = new \WP_Hook();
$wp_hook->callbacks = [
10 => [
[ 'function' => 'trim', 'accepted_args' => 1 ],
],
];
$result = $formatter->format( $wp_hook );
$this->assertIsArray( $result );
$this->assertEquals( [ 'trim' ], $result );
}
}