Skip to content

Commit 797b03c

Browse files
committed
Init in init so it's testable
1 parent fbf9139 commit 797b03c

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

plugins/wp-graphql-headless-webhooks/src/Admin/WebhooksAdmin.php

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,14 @@ class WebhooksAdmin {
4141
*/
4242
public function __construct( WebhookRepositoryInterface $repository ) {
4343
$this->repository = $repository;
44+
}
4445

46+
/**
47+
* Initialize the admin functionality.
48+
*
49+
* @return void
50+
*/
51+
public function init(): void {
4552
add_action( 'admin_menu', [ $this, 'add_admin_menu' ] );
4653
add_action( 'admin_enqueue_scripts', [ $this, 'enqueue_assets' ] );
4754
add_action( 'admin_init', [ $this, 'handle_actions' ] );

plugins/wp-graphql-headless-webhooks/src/Plugin.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ private function setup(): void {
9696

9797
if ( class_exists( 'WPGraphQL\Webhooks\Admin\WebhooksAdmin' ) ) {
9898
$admin = new \WPGraphQL\Webhooks\Admin\WebhooksAdmin( $repository );
99-
// The constructor already sets up all necessary hooks
99+
$admin->init();
100100
}
101101
}
102102

0 commit comments

Comments
 (0)