From 448ca68cee6a8cc0a40bc85dd943b0930f333beb Mon Sep 17 00:00:00 2001 From: Dan0sz <18595395+Dan0sz@users.noreply.github.com> Date: Wed, 27 Mar 2024 15:06:13 +0100 Subject: [PATCH] Expandend ActionsTest and ignored some code from coverage we can't test. --- src/Actions.php | 16 ++++++++++------ src/Client.php | 6 ++++++ src/Cron.php | 7 +++++++ src/Uninstall.php | 8 ++++++++ tests/integration/ActionsTest.php | 18 ++++++++++++++++++ 5 files changed, 49 insertions(+), 6 deletions(-) diff --git a/src/Actions.php b/src/Actions.php index fdec02a1..d5301391 100644 --- a/src/Actions.php +++ b/src/Actions.php @@ -1,6 +1,7 @@ 'plausible-admin-bar', + 'id' => 'plausible-analytics', 'title' => 'Plausible Analytics', ]; @@ -93,7 +97,7 @@ public function admin_bar_node( $admin_bar ) { 'id' => 'view-analytics', 'title' => esc_html__( 'View Analytics', 'plausible-analytics' ), 'href' => admin_url( 'index.php?page=plausible_analytics_statistics' ), - 'parent' => 'plausible-admin-bar', + 'parent' => 'plausible-analytics', ]; // Add link to individual page stats. @@ -109,7 +113,7 @@ public function admin_bar_node( $admin_bar ) { is_home() ? '' : $uri, admin_url( 'index.php?page=plausible_analytics_statistics' ) ), - 'parent' => 'plausible-admin-bar', + 'parent' => 'plausible-analytics', ]; } } @@ -119,7 +123,7 @@ public function admin_bar_node( $admin_bar ) { 'id' => 'settings', 'title' => esc_html__( 'Settings', 'plausible-analytics' ), 'href' => admin_url( 'options-general.php?page=plausible_analytics' ), - 'parent' => 'plausible-admin-bar', + 'parent' => 'plausible-analytics', ]; foreach ( $args as $arg ) { diff --git a/src/Client.php b/src/Client.php index 3a204761..2a37906c 100644 --- a/src/Client.php +++ b/src/Client.php @@ -42,6 +42,7 @@ public function __construct( $token = '' ) { /** * Validates the API token (password) set in the current instance and caches the state to a transient valid for 1 day. + * * @return bool * @throws ApiException */ @@ -75,6 +76,7 @@ public function validate_api_token() { /** * Retrieve Features from Capabilities object. + * * @return false|Client\Model\CapabilitiesFeatures */ private function get_features() { @@ -89,6 +91,7 @@ private function get_features() { /** * Retrieve all capabilities assigned to configured API token. + * * @return bool|Client\Model\Capabilities */ private function get_capabilities() { @@ -101,6 +104,7 @@ private function get_capabilities() { /** * Retrieve Data Domain property from Capabilities object. + * * @return false|string */ private function get_data_domain() { @@ -115,10 +119,12 @@ private function get_data_domain() { /** * Create Shared Link in Plausible Dashboard. + * * @return void */ public function create_shared_link() { $shared_link = (object) []; + $result = (object) []; try { $result = $this->api_instance->plausibleWebPluginsAPIControllersSharedLinksCreate( diff --git a/src/Cron.php b/src/Cron.php index 3383c31e..a79153b9 100644 --- a/src/Cron.php +++ b/src/Cron.php @@ -1,6 +1,7 @@ admin_bar_node( $admin_bar ); + + $this->assertNotEmpty( $admin_bar->get_node( 'plausible-analytics' ) ); + } }