mirror of
https://github.com/gosticks/wordpress-develop.git
synced 2026-06-28 22:30:04 +00:00
Allow is_post_type_viewable() to accept a post type name.
Previously, it accepted only a post type object. Props spacedmonkey. Fixes #35609. git-svn-id: https://develop.svn.wordpress.org/trunk@36402 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
@@ -71,4 +71,24 @@ class Tests_Post_IsPostTypeViewable extends WP_UnitTestCase {
|
||||
$page = get_post_type_object( 'page' );
|
||||
$this->assertTrue( is_post_type_viewable( $page ) );
|
||||
}
|
||||
|
||||
/**
|
||||
* @ticket 35609
|
||||
*/
|
||||
public function test_should_accept_post_type_name() {
|
||||
register_post_type( 'wptests_pt', array(
|
||||
'publicly_queryable' => true,
|
||||
'_builtin' => false,
|
||||
'public' => false,
|
||||
) );
|
||||
|
||||
$this->assertTrue( is_post_type_viewable( 'wptests_pt' ) );
|
||||
}
|
||||
|
||||
/**
|
||||
* @ticket 35609
|
||||
*/
|
||||
public function test_should_return_false_for_bad_post_type_name() {
|
||||
$this->assertFalse( is_post_type_viewable( 'foo' ) );
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user