| | 62 | /** |
| | 63 | * @ticket 35985 |
| | 64 | * @covers register_post_type() |
| | 65 | */ |
| | 66 | function test_register_post_type_exclude_from_search_should_default_to_opposite_value_of_public() { |
| | 67 | /* |
| | 68 | * 'public' Default is false |
| | 69 | * 'exclude_from_search' Default is null (opposite 'public') |
| | 70 | */ |
| | 71 | $args = $this->register_post_type( array( 'public' => $public = false ) ); |
| | 72 | |
| | 73 | $this->assertNotEquals( $public, $args->exclude_from_search ); |
| | 74 | } |
| | 75 | |
| | 76 | /** |
| | 77 | * @ticket 35985 |
| | 78 | * @covers register_post_type() |
| | 79 | */ |
| | 80 | function test_register_post_type_publicly_queryable_should_default_to_value_of_public() { |
| | 81 | /* |
| | 82 | * 'public' Default is false |
| | 83 | * 'publicly_queryable' Default is null ('public') |
| | 84 | */ |
| | 85 | $args = $this->register_post_type( array( 'public' => $public = false ) ); |
| | 86 | |
| | 87 | $this->assertSame( $public, $args->publicly_queryable ); |
| | 88 | } |
| | 89 | |
| | 90 | /** |
| | 91 | * @ticket 35985 |
| | 92 | * @covers register_post_type() |
| | 93 | */ |
| | 94 | function test_register_post_type_show_ui_should_default_to_value_of_public() { |
| | 95 | /* |
| | 96 | * 'public' Default is false |
| | 97 | * 'show_ui' Default is null ('public') |
| | 98 | */ |
| | 99 | $args = $this->register_post_type( array( 'public' => $public = false ) ); |
| | 100 | |
| | 101 | $this->assertSame( $public, $args->show_ui ); |
| | 102 | } |
| | 103 | |
| | 104 | /** |
| | 105 | * @ticket 35985 |
| | 106 | * @covers register_post_type() |
| | 107 | */ |
| | 108 | function test_register_post_type_show_in_menu_should_default_to_value_of_show_ui() { |
| | 109 | /* |
| | 110 | * 'public' Default is false |
| | 111 | * 'show_ui' Default is null ('public') |
| | 112 | * 'show_in_menu Default is null ('show_ui' > 'public') |
| | 113 | */ |
| | 114 | $args = $this->register_post_type( array( 'public' => $public = false ) ); |
| | 115 | |
| | 116 | // Should fall back to 'show_ui'. |
| | 117 | $this->assertSame( $args->show_ui, $args->show_in_menu ); |
| | 118 | |
| | 119 | // Should fall back to 'show_ui', then 'public'. |
| | 120 | $this->assertSame( $public, $args->show_in_menu ); |
| | 121 | } |
| | 122 | |
| | 123 | /** |
| | 124 | * @ticket 35985 |
| | 125 | * @covers register_post_type() |
| | 126 | */ |
| | 127 | function test_register_post_type_show_in_nav_menus_should_default_to_value_of_public() { |
| | 128 | /* |
| | 129 | * 'public' Default is false |
| | 130 | * 'show_in_nav_menus' Default is null ('public') |
| | 131 | */ |
| | 132 | $args = $this->register_post_type( array( 'public' => $public = false ) ); |
| | 133 | |
| | 134 | $this->assertSame( $public, $args->show_in_nav_menus ); |
| | 135 | } |
| | 136 | |
| | 137 | /** |
| | 138 | * @ticket 35985 |
| | 139 | * @covers register_post_type() |
| | 140 | */ |
| | 141 | function test_register_post_type_show_in_admin_bar_should_default_to_value_of_show_in_menu() { |
| | 142 | /* |
| | 143 | * 'public' Default is false |
| | 144 | * 'show_in_menu' Default is null ('show_ui' > 'public') |
| | 145 | * 'show_in_admin_bar' Default is null ('show_in_menu' > 'show_ui' > 'public') |
| | 146 | */ |
| | 147 | $args = $this->register_post_type( array( 'public' => $public = false ) ); |
| | 148 | |
| | 149 | // Should fall back to 'show_in_menu'. |
| | 150 | $this->assertSame( $args->show_in_menu, $args->show_in_admin_bar ); |
| | 151 | |
| | 152 | // Should fall back to 'show_ui'. |
| | 153 | $this->assertSame( $args->show_ui, $args->show_in_admin_bar ); |
| | 154 | |
| | 155 | // Should fall back to 'public'. |
| | 156 | $this->assertSame( $public, $args->show_in_admin_bar ); |
| | 157 | } |
| | 158 | |