568 backend throw exceptions when data sources are not available#22059
Conversation
Pull Request Test Coverage Report for Build 3f76ee4d8a19f7f37ddaf64cb1cb3825804427b0Warning: This coverage report may be inaccurate.This pull request's base commit is no longer the HEAD commit of its target branch. This means it includes changes from outside the original pull request, including, potentially, unrelated coverage changes.
Details
💛 - Coveralls |
| * @return bool If the entire onboarding has been completed. | ||
| */ | ||
| public function is_onboarded() { | ||
| return ( $this->is_connected() && $this->is_setup_completed() && $this->is_connected() ); |
There was a problem hiding this comment.
Double $this->is_connected()?
There was a problem hiding this comment.
Oops the first one should have been is_enabled to prevent those fatals you mentioned.
There was a problem hiding this comment.
I would really like us to extend the Dashboard_Repository_Interface to have a has_available_data_sources() (name TBD) function and then move the checks there for every repository.
In this case, it would be
public function get_data( Parameters $parameters ): Data_Container {
if ( ! $this->has_available_data_sources() ) {
throw new Not_Available_Data_Source_Exception();
}
return $this->site_kit_search_console_adapter->get_data( $parameters );
}
public function has_available_data_sources() {
return ( $this->site_kit_configuration->is_onboarded() );
}
There was a problem hiding this comment.
We decided that this should be a part of the adapter interface instead. Will implement it outside this PR, to avoid conflicts with #22067
Context
Summary
This PR can be summarized in the following changelog entry:
Relevant technical choices:
Test instructions
Test instructions for the acceptance test before the PR gets merged
This PR can be acceptance tested by following these steps:
wp-json/yoast/v1/time_based_seo_metrics?options[widget]=querywp-json/yoast/v1/time_based_seo_metrics?options[widget]=pagewp-json/yoast/v1/time_based_seo_metrics?options[widget]=οrganicSessionsDailywp-json/yoast/v1/time_based_seo_metrics?options[widget]=οrganicSessionsCompare"error": "<repository name> is not available yet. Not all prerequisites have been met."message where<repository name>points to the relevant repository depending on the request"error": "<repository name> is not available yet. Not all prerequisites have been met."message where<repository name>points to the relevant repository depending on the requestwp-json/yoast/v1/time_based_seo_metrics?options[widget]=οrganicSessionsDailyrequest and thewp-json/yoast/v1/time_based_seo_metrics?options[widget]=οrganicSessionsComparerequest"error": "Organic Sessions Repository is not available yet. Not all prerequisites have been met."messagewpseoScriptData.dashboard.siteKitConfiguration.isGAConnectedin the console and confirm you getfalse.wp-json/yoast/v1/time_based_seo_metrics?options[widget]=queryandwp-json/yoast/v1/time_based_seo_metrics?options[widget]=pagerequests.wp-json/yoast/v1/time_based_seo_metrics?options[widget]=οrganicSessionsDailyrequest and thewp-json/yoast/v1/time_based_seo_metrics?options[widget]=οrganicSessionsComparerequestwpseoScriptData.dashboard.siteKitConfiguration.isGAConnectedin the console and confirm you now gettrue."error": "<repository name> is not available yet. Not all prerequisites have been met."message where<repository name>points to the relevant repository depending on the requestRelevant test scenarios
Test instructions for QA when the code is in the RC
QA can test this PR by following these steps:
Impact check
This PR affects the following parts of the plugin, which may require extra testing:
UI changes
Other environments
[shopify-seo], added test instructions for Shopify and attached theShopifylabel to this PR.Documentation
Quality assurance
Innovation
innovationlabel.Fixes #