Update schema information for template controller.#1870
Update schema information for template controller.#1870spacedmonkey wants to merge 14 commits intoWordPress:trunkfrom
Conversation
| } | ||
|
|
||
| if ( is_wp_error( $result ) ) { | ||
| if ( 'db_update_error' === $result->get_error_code() ) { |
There was a problem hiding this comment.
Any chance this could come up because of an invalid input that e.g. violates some db constraint? An example would be trying to insert a duplicated value when a field is UNIQUE – it would appear to be a db error but the problem would actually be with the inputs. This specific one is unlikely here, but you get the idea.
There was a problem hiding this comment.
Either way, if were get a database error, we should return that.
There was a problem hiding this comment.
@adamziel I'm not aware of any such cases, but if they do exist, we should probably update wp_insert_post to handle those errors to return something more descriptive.
|
I read the PR and it looks good and makes sense. I didn't have a chance to test it yet, though. It would be nice to run Gutenberg e2e tests with this PR applied. |
|
Thanks for putting this together @spacedmonkey. Let's rename the test classes and test files to follow the standards while we're at it. |
I took care of renaming file and test classes in commit 27c3bb6. |
|
Thanks @hellofromtonya! |
| * @covers WP_REST_Templates_Controller::get_items | ||
| */ | ||
| public function test_get_items() { | ||
| function find_and_normalize_template_by_id( $templates, $id ) { |
There was a problem hiding this comment.
This creates a globally scoped function, we can make this an anonymous function.
Trac ticket: https://core.trac.wordpress.org/ticket/54422
This Pull Request is for code review only. Please keep all other discussion in the Trac ticket. Do not merge this Pull Request. See GitHub Pull Requests for Code Review in the Core Handbook for more details.