This repository was archived by the owner on Jul 12, 2024. It is now read-only.
Abstract onboarding plugin code into a PluginsHelper class#3999
Merged
findingsimple merged 13 commits intomasterfrom Mar 27, 2020
Merged
Abstract onboarding plugin code into a PluginsHelper class#3999findingsimple merged 13 commits intomasterfrom
findingsimple merged 13 commits intomasterfrom
Conversation
We plan to use these methods in the Marketing tab.
Using the new get_plugin_path_from_slug method
Also adds support for plugin slugs or paths as parameters.
Will make it less fragile when Woo plugin data changes
becdetat
reviewed
Mar 26, 2020
tests/plugins-helper.php
Outdated
| */ | ||
| public function test_is_plugin_installed() { | ||
|
|
||
| // WooCommerce is installed in the test envrionment. |
becdetat
reviewed
Mar 26, 2020
tests/plugins-helper.php
Outdated
| $installed = PluginsHelper::is_plugin_installed( 'woocommerce' ); | ||
| $this->assertEquals( true, $installed, 'WooCommerce should be installed.' ); | ||
|
|
||
| // Invalud plugin is not. |
becdetat
reviewed
Mar 26, 2020
tests/plugins-helper.php
Outdated
| // Get facebook plugin path. | ||
| $fb_path = PluginsHelper::get_plugin_path_from_slug( 'facebook-for-woocommerce' ); | ||
|
|
||
| // Activate facebookn plugin. |
Merged
octaedro
approved these changes
Mar 26, 2020
Contributor
octaedro
left a comment
There was a problem hiding this comment.
Hi Jason, you did a great job here. Everything is testing well and the code LGTM ![]()
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The Onboarding Feature has some existing plugin functionality for retrieving the active and installed plugins that could be useful to other features (e.g. Marketing Dashboard which also allows installation/activation of plugins).
This PR abstracts out the onboarding code into a PluginsHelper class and adds some additional helpers:
Detailed test instructions:
I've added some initial tests in b69652a and the existing Onboarding Plugins tests provide some coverage as well.
For manual testing i've put together simple plugin you can use https://gist.github.com/jconroy/daa9751d094dc0a311526f85b5f2c580 to check output of the various functions based on what you are running in your dev environment.
cc @danielbitzer (was most of your work, I'm just spinning it out for review)