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