Opened 7 years ago
Closed 7 years ago
#45097 closed task (blessed) (fixed)
Introduce WP_Block_Type and WP_Block_Type_Registry classes
| Reported by: |
|
Owned by: |
|
|---|---|---|---|
| Milestone: | 5.0 | Priority: | normal |
| Severity: | normal | Version: | |
| Component: | REST API | Keywords: | has-patch has-unit-tests fixed-5.0 |
| Focuses: | rest-api | Cc: |
Description
The WP_Block_Type and WP_Block_Type_Registry classes currently exist in Gutenberg. They should be in WordPress core instead.
Attachments (3)
Change History (15)
#1
@
7 years ago
- Owner set to desrosj
- Status changed from new to assigned
- Type changed from defect (bug) to task (blessed)
This ticket was mentioned in Slack in #core-editor by danielbachhuber. View the logs.
7 years ago
#4
@
7 years ago
In 45097.2.diff, further adaptation of the patch:
- Updates
@sinceto5.0.0. - Updates
@packagetoWordPressand@subpackagetoBlocks. - Removes
'gutenberg'textdomain. - Renames unit test files according to existing standards.
@adamsilverstein I'm not sure why the tests are passing in Travis for you. Locally, I get:
1) WP_Test_Block_Type_Registry::test_register_block_type_instance Error: Class 'WP_Dummy_Block_Type' not found /Users/danielbachhuber/projects/wordpress-develop/tests/phpunit/tests/blocks/block-type-registry.php:111 2) WP_Test_Block_Type::test_has_block_with_mixed_content Error: Call to undefined function has_block() /Users/danielbachhuber/projects/wordpress-develop/tests/phpunit/tests/blocks/block-type.php:195 3) WP_Test_Block_Type::test_has_block_with_invalid_content Error: Call to undefined function has_block() /Users/danielbachhuber/projects/wordpress-develop/tests/phpunit/tests/blocks/block-type.php:224 4) WP_Test_Block_Type::test_post_has_block Error: Call to undefined function has_block() /Users/danielbachhuber/projects/wordpress-develop/tests/phpunit/tests/blocks/block-type.php:237
It seems like we'll need to wait for has_block to land (#45037 I think) before we can continue with this.
#5
@
7 years ago
@adamsilverstein I'm not sure why the tests are passing in Travis for you. Locally, I get:
I'll try locally as well, did you start from the 5.0 branch when applying the patch?
This ticket was mentioned in Slack in #core-restapi by desrosj. View the logs.
7 years ago
#7
@
7 years ago
- Keywords has-patch has-unit-tests added; needs-patch needs-unit-tests removed
Handfull of minor changes in 45097.3.diff:
- Added a handful of missing
@sincetags. @accessand@statictags have been removed. Per the PHP Documentation Standards, these are no longer used, or not necessary.- Moved the
class-wp-dummy-block-type.phpinto thetests/phpunit/includesfolder from Gutenberg. This fixes the first failure @danielbachhuber was seeing. Also, renamed this class toWP_Fake_Block_Typeto be more pleasant. - Removes
setup()method fromWP_Test_Block_Type(it was not performing any actions). - Adds missing visibility for methods in test classes.
- Add missing
@sinceand@tickettags for test methods.
I also set up a build on my fork. I am seeing the same issues as @danielbachhuber.
I contemplated marking each test that requires has_block() skipped if the function does not exist. That would allow this to land and would turn the tests on later post-merge, but those skips should be removed after that. @danielbachhuber @adamsilverstein what are your thoughts on that?
In 45097.diff:
WP_Block_TypeandWP_Block_Type_Registryand related tests.