Skip to content

Commit 9b5ee54

Browse files
committed
Added missing test for getting log service.
1 parent a925460 commit 9b5ee54

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed

plugins/wpgraphql-logging/src/Admin/ViewLogsPage.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -299,7 +299,7 @@ protected function render_view_page(): void {
299299
*
300300
* @return \WPGraphQL\Logging\Logger\Api\LogServiceInterface The log service instance.
301301
*/
302-
protected function get_log_service(): LogServiceInterface {
302+
public function get_log_service(): LogServiceInterface {
303303
return LogStoreService::get_log_service();
304304
}
305305
}

plugins/wpgraphql-logging/tests/wpunit/Admin/View/ViewLogsPageTest.php

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
use WPGraphQL\Logging\Admin\ViewLogsPage;
99
use Codeception\TestCase\WPTestCase;
1010
use Brain\Monkey;
11+
use WPGraphQL\Logging\Logger\Api\LogServiceInterface;
1112

1213
/**
1314
* Test for the ViewLogsPage
@@ -213,4 +214,11 @@ public function test_get_redirect_url_constructs_correct_url(): void {
213214
$url
214215
);
215216
}
217+
218+
public function test_get_log_service_returns_log_service_instance(): void {
219+
$this->set_as_admin();
220+
$instance = ViewLogsPage::init();
221+
$log_service = $instance->get_log_service();
222+
$this->assertInstanceOf(LogServiceInterface::class, $log_service);
223+
}
216224
}

0 commit comments

Comments
 (0)