Return a WP_Error if an empty name is provided when registering a post type.

Fixes #31134
Props tyxla, MikeHansenMe


git-svn-id: https://develop.svn.wordpress.org/trunk@31450 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
John Blackbourn
2015-02-13 16:42:36 +00:00
parent 22fc19e06d
commit f4d6d4e66b
2 changed files with 23 additions and 3 deletions
+20
View File
@@ -19,6 +19,26 @@ class Tests_Post_Types extends WP_UnitTestCase {
_unregister_post_type( 'foo' );
}
/**
* @ticket 31134
*
* @expectedIncorrectUsage register_post_type
*/
function test_register_post_type_length_long() {
// post type too long
$this->assertInstanceOf( 'WP_Error', register_post_type( 'abcdefghijklmnopqrstuvwxyz0123456789' ) );
}
/**
* @ticket 31134
*
* @expectedIncorrectUsage register_post_type
*/
function test_register_post_type_length_short() {
// post type too short
$this->assertInstanceOf( 'WP_Error', register_post_type( '' ) );
}
function test_register_taxonomy_for_object_type() {
global $wp_taxonomies;