generated from alleyinteractive/create-wordpress-plugin
-
Notifications
You must be signed in to change notification settings - Fork 2
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
Loading enhancement for blocks and slotfills #90
Closed
Closed
Changes from all commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
7c68d66
Merge branch 'develop' into feature/post-support
renatonascalves 9e47ca0
New load behavior, allowing for hooking into for headless sites
renatonascalves d453f43
Merge branch 'feature/post-support' into feature/new-load
renatonascalves e956c16
Tests
renatonascalves 17c0eca
Merge branch 'feature/new-load' of https://github.com/alleyinteractiv…
renatonascalves 6cb7203
Making `phpcs` happy
renatonascalves 9d7ad81
Update src/class-supported-post-types.php
renatonascalves c0008e2
Merge branch 'develop' into feature/new-load
renatonascalves 5ab85df
Adjust `wp_curate_load` logic
renatonascalves b449f6a
Making `phpunit` happy
renatonascalves 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
This file contains 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 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 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 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 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 was deleted.
Oops, something went wrong.
This file contains 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,52 @@ | ||
<?php | ||
/** | ||
* WP Curate Tests: Supported Post Types Feature Test | ||
* | ||
* @package wp-curate | ||
*/ | ||
|
||
namespace Alley\WP\WP_Curate\Tests\Feature; | ||
|
||
use Alley\WP\WP_Curate\Supported_Post_Types; | ||
use Alley\WP\WP_Curate\Tests\Test_Case; | ||
|
||
/** | ||
* Supported_Post_Types_Test feature test. | ||
*/ | ||
class Supported_Post_Types_Test extends Test_Case { | ||
|
||
public function test_get_default_post_types(): void { | ||
$post_types = new Supported_Post_Types(); | ||
|
||
$this->assertIsArray( $post_types->get_supported_post_types() ); | ||
$this->assertContains( 'post', $post_types->get_supported_post_types() ); | ||
} | ||
|
||
public function test_get_excluded_post_types(): void { | ||
$post_types = new Supported_Post_Types(); | ||
|
||
add_filter( 'wp_curate_supported_post_types', fn () => [ 'page' ] ); | ||
|
||
$this->assertNotContains( 'post', $post_types->get_supported_post_types() ); | ||
$this->assertContains( 'page', $post_types->get_supported_post_types() ); | ||
|
||
remove_filter( 'wp_curate_supported_post_types', fn () => [ 'page' ] ); | ||
} | ||
|
||
public function test_returning_default_load(): void { | ||
$post_types = new Supported_Post_Types(); | ||
|
||
$this->assertTrue( $post_types->load() ); | ||
$this->assertTrue( $post_types->load( [ 'page' ] ) ); | ||
} | ||
|
||
public function test_hooking_into_load(): void { | ||
$post_types = new Supported_Post_Types(); | ||
|
||
add_filter( 'wp_curate_load', '__return_true' ); | ||
|
||
$this->assertTrue( $post_types->load() ); | ||
|
||
remove_filter( 'wp_curate_load', '__return_true' ); | ||
} | ||
} |
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does it make sense to use a singleton for this?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It does!