Make WordPress Core

Changeset 1020 in tests


Ignore:
Timestamp:
09/13/2012 04:56:24 PM (14 years ago)
Author:
nacin
Message:

Tests for #WP21586.

Location:
trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/includes/utils.php

    r856 r1020  
    352352function _unregister_post_type( $cpt_name ) {
    353353        unset( $GLOBALS['wp_post_types'][ $cpt_name ] );
     354        unset( $GLOBALS['_wp_post_type_features'][ $cpt_name ] );
    354355
    355356        foreach ( $GLOBALS['wp_taxonomies'] as $taxonomy ) {
  • trunk/tests/post/types.php

    r909 r1020  
    1616                $this->assertFalse( is_post_type_hierarchical( 'foo' ) );
    1717                $this->assertEquals( array(), get_object_taxonomies( 'foo' ) );
     18
     19                _unregister_post_type( 'foo' );
    1820        }
    1921
    … …  
    3638                $this->assertFalse( is_object_in_taxonomy( 'bar', 'post_tag' ) );
    3739                $this->assertFalse( is_object_in_taxonomy( 'bar', 'post_tag' ) );
     40
     41                _unregister_post_type( 'bar' );
    3842        }
    3943
    … …  
    5054                $this->assertFalse( post_type_supports( 'notaposttype', 'notafeature' ) );
    5155        }
     56
     57        /**
     58         * @ticket 21586
     59         */
     60        function test_post_type_with_no_support() {
     61                register_post_type( 'foo', array( 'supports' => array() ) );
     62                $this->assertTrue( post_type_supports( 'foo', 'editor' ) );
     63                $this->assertTrue( post_type_supports( 'foo', 'title' ) );
     64                _unregister_post_type( 'foo' );
     65
     66                register_post_type( 'foo', array( 'supports' => false ) );
     67                $this->assertFalse( post_type_supports( 'foo', 'editor' ) );
     68                $this->assertFalse( post_type_supports( 'foo', 'title' ) );
     69                _unregister_post_type( 'foo' );
     70        }
    5271}
Note: See TracChangeset for help on using the changeset viewer.