-
Notifications
You must be signed in to change notification settings - Fork 28
Add Extendify compatibility class #1007
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
66c8f25
remove test
remyperona 739bff1
remove function
remyperona 716d04d
remove unused section
remyperona 4b39853
remove option
remyperona c545c45
use filter instead of option
remyperona 0f9cb7f
remove unused function
remyperona 1436544
add Extendify compatibility
remyperona f8afbd7
add tests
remyperona bd83e80
add missing doc comment
remyperona File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
13 changes: 13 additions & 0 deletions
13
Tests/Fixtures/classes/ThirdParty/Hostings/Extendify/HidePluginFamilyTest.php
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,13 @@ | ||
| <?php | ||
| return [ | ||
| 'testShouldReturnSameWhenOptionNotPresent' => [ | ||
| 'value' => false, | ||
| 'option' => false, | ||
| 'expected' => false, | ||
| ], | ||
| 'testShouldReturnTrueWhenOptionPresent' => [ | ||
| 'value' => false, | ||
| 'option' => 'some_site_id', | ||
| 'expected' => true, | ||
| ], | ||
| ]; | ||
11 changes: 0 additions & 11 deletions
11
Tests/Fixtures/inc/functions/Partners/ImagifySavePartnerHideOurPluginsTest.php
This file was deleted.
Oops, something went wrong.
25 changes: 25 additions & 0 deletions
25
Tests/Unit/classes/ThirdParty/Hostings/Extendify/HidePluginFamilyTest.php
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,25 @@ | ||
| <?php | ||
| declare( strict_types=1 ); | ||
|
|
||
| namespace Imagify\Tests\Unit\classes\ThirdParty\Hostings\Extendify; | ||
|
|
||
| use Brain\Monkey\Functions; | ||
| use Imagify\Tests\Unit\TestCase; | ||
| use Imagify\ThirdParty\Hostings\Extendify; | ||
|
|
||
| class HidePluginFamilyTest extends TestCase { | ||
| /** | ||
| * @dataProvider configTestData | ||
| */ | ||
| public function testShouldReturnExpected( $value, $option, $expected ) { | ||
| $extendify = new Extendify(); | ||
|
|
||
| Functions\when( 'get_option' ) | ||
| ->justReturn( $option ); | ||
remyperona marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
|
||
| $this->assertSame( | ||
| $expected, | ||
| $extendify->hide_plugin_family( $value ) | ||
| ); | ||
| } | ||
| } | ||
remyperona marked this conversation as resolved.
Show resolved
Hide resolved
|
||
35 changes: 0 additions & 35 deletions
35
Tests/Unit/inc/functions/Partners/ImagifySavePartnerHideOurPluginsTest.php
This file was deleted.
Oops, something went wrong.
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,39 @@ | ||
| <?php | ||
| declare( strict_types=1 ); | ||
|
|
||
| namespace Imagify\ThirdParty\Hostings; | ||
|
|
||
| use Imagify\EventManagement\SubscriberInterface; | ||
|
|
||
| /** | ||
| * Extendify compatibility class | ||
remyperona marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| */ | ||
| class Extendify implements SubscriberInterface { | ||
| /** | ||
| * Returns an array of events that this subscriber wants to listen to. | ||
| * | ||
| * @return array | ||
| */ | ||
| public static function get_subscribed_events(): array { | ||
| return [ | ||
| 'imagify_hide_plugin_family' => 'hide_plugin_family', | ||
| ]; | ||
| } | ||
|
|
||
| /** | ||
| * Hide the plugin family if the Extendify site ID option is present. | ||
| * | ||
| * @param bool $hide Current value. | ||
| * | ||
| * @return bool | ||
| */ | ||
| public function hide_plugin_family( $hide ) { | ||
remyperona marked this conversation as resolved.
Show resolved
Hide resolved
remyperona marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| $option = get_option( 'extendify_site_id', false ); | ||
|
|
||
| if ( false === $option ) { | ||
| return $hide; | ||
| } | ||
|
|
||
| return true; | ||
| } | ||
| } | ||
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
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
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
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
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
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
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.