@@ -21,9 +21,9 @@ discard block |
||
| 21 | 21 | */ |
| 22 | 22 | function setUp() { |
| 23 | 23 | parent::setUp(); |
| 24 | - require_once( WP_FIELDS_API_DIR . 'implementation/wp-includes/class-wp-customize-manager.php' ); |
|
| 24 | + require_once(WP_FIELDS_API_DIR.'implementation/wp-includes/class-wp-customize-manager.php'); |
|
| 25 | 25 | //require_once ABSPATH . WPINC . '/class-wp-customize-manager.php'; |
| 26 | - wp_set_current_user( $this->factory->user->create( array( 'role' => 'administrator' ) ) ); |
|
| 26 | + wp_set_current_user($this->factory->user->create(array('role' => 'administrator'))); |
|
| 27 | 27 | global $wp_customize; |
| 28 | 28 | $this->wp_customize = new WP_Customize_Manager(); |
| 29 | 29 | $wp_customize = $this->wp_customize; |
@@ -44,7 +44,7 @@ discard block |
||
| 44 | 44 | * @param array $items Menu item types. |
| 45 | 45 | * @return array Menu item types. |
| 46 | 46 | */ |
| 47 | - function filter_item_types( $items ) { |
|
| 47 | + function filter_item_types($items) { |
|
| 48 | 48 | $items[] = array( |
| 49 | 49 | 'title' => 'Custom', |
| 50 | 50 | 'type' => 'custom_type', |
@@ -62,14 +62,14 @@ discard block |
||
| 62 | 62 | * @param string $object The object name (e.g. category). |
| 63 | 63 | * @return array Menu items. |
| 64 | 64 | */ |
| 65 | - function filter_items( $items, $type, $object ) { |
|
| 65 | + function filter_items($items, $type, $object) { |
|
| 66 | 66 | $items[] = array( |
| 67 | 67 | 'id' => 'custom-1', |
| 68 | 68 | 'title' => 'Cool beans', |
| 69 | 69 | 'type' => $type, |
| 70 | 70 | 'type_label' => 'Custom Label', |
| 71 | 71 | 'object' => $object, |
| 72 | - 'url' => home_url( '/cool-beans/' ), |
|
| 72 | + 'url' => home_url('/cool-beans/'), |
|
| 73 | 73 | 'classes' => 'custom-menu-item cool-beans', |
| 74 | 74 | ); |
| 75 | 75 | |
@@ -82,9 +82,9 @@ discard block |
||
| 82 | 82 | * @see WP_Customize_Nav_Menus::__construct() |
| 83 | 83 | */ |
| 84 | 84 | function test_construct() { |
| 85 | - do_action( 'customize_register', $this->wp_customize ); |
|
| 86 | - $menus = new WP_Customize_Nav_Menus( $this->wp_customize ); |
|
| 87 | - $this->assertInstanceOf( 'WP_Customize_Manager', $menus->manager ); |
|
| 85 | + do_action('customize_register', $this->wp_customize); |
|
| 86 | + $menus = new WP_Customize_Nav_Menus($this->wp_customize); |
|
| 87 | + $this->assertInstanceOf('WP_Customize_Manager', $menus->manager); |
|
| 88 | 88 | } |
| 89 | 89 | |
| 90 | 90 | /** |
@@ -93,17 +93,17 @@ discard block |
||
| 93 | 93 | * @see WP_Customize_Nav_Menus::load_available_items_query() |
| 94 | 94 | */ |
| 95 | 95 | function test_load_available_items_query_returns_wp_error() { |
| 96 | - $menus = new WP_Customize_Nav_Menus( $this->wp_customize ); |
|
| 96 | + $menus = new WP_Customize_Nav_Menus($this->wp_customize); |
|
| 97 | 97 | |
| 98 | 98 | // Invalid post type $obj_name. |
| 99 | - $items = $menus->load_available_items_query( 'post_type', 'invalid' ); |
|
| 100 | - $this->assertInstanceOf( 'WP_Error', $items ); |
|
| 101 | - $this->assertEquals( 'nav_menus_invalid_post_type', $items->get_error_code() ); |
|
| 99 | + $items = $menus->load_available_items_query('post_type', 'invalid'); |
|
| 100 | + $this->assertInstanceOf('WP_Error', $items); |
|
| 101 | + $this->assertEquals('nav_menus_invalid_post_type', $items->get_error_code()); |
|
| 102 | 102 | |
| 103 | 103 | // Invalid taxonomy $obj_name. |
| 104 | - $items = $menus->load_available_items_query( 'taxonomy', 'invalid' ); |
|
| 105 | - $this->assertInstanceOf( 'WP_Error', $items ); |
|
| 106 | - $this->assertEquals( 'invalid_taxonomy', $items->get_error_code() ); |
|
| 104 | + $items = $menus->load_available_items_query('taxonomy', 'invalid'); |
|
| 105 | + $this->assertInstanceOf('WP_Error', $items); |
|
| 106 | + $this->assertEquals('invalid_taxonomy', $items->get_error_code()); |
|
| 107 | 107 | } |
| 108 | 108 | |
| 109 | 109 | /** |
@@ -112,29 +112,29 @@ discard block |
||
| 112 | 112 | * @see WP_Customize_Nav_Menus::load_available_items_query() |
| 113 | 113 | */ |
| 114 | 114 | function test_load_available_items_query_maybe_returns_home() { |
| 115 | - $menus = new WP_Customize_Nav_Menus( $this->wp_customize ); |
|
| 115 | + $menus = new WP_Customize_Nav_Menus($this->wp_customize); |
|
| 116 | 116 | |
| 117 | 117 | // Expected menu item array. |
| 118 | 118 | $expected = array( |
| 119 | 119 | 'id' => 'home', |
| 120 | - 'title' => _x( 'Home', 'nav menu home label' ), |
|
| 120 | + 'title' => _x('Home', 'nav menu home label'), |
|
| 121 | 121 | 'type' => 'custom', |
| 122 | - 'type_label' => __( 'Custom Link' ), |
|
| 122 | + 'type_label' => __('Custom Link'), |
|
| 123 | 123 | 'object' => '', |
| 124 | 124 | 'url' => home_url(), |
| 125 | 125 | ); |
| 126 | 126 | |
| 127 | 127 | // Create pages. |
| 128 | - $this->factory->post->create_many( 15, array( 'post_type' => 'page' ) ); |
|
| 128 | + $this->factory->post->create_many(15, array('post_type' => 'page')); |
|
| 129 | 129 | |
| 130 | 130 | // Home is included in menu items when page is zero. |
| 131 | - $items = $menus->load_available_items_query( 'post_type', 'page', 0 ); |
|
| 132 | - $this->assertContains( $expected, $items ); |
|
| 131 | + $items = $menus->load_available_items_query('post_type', 'page', 0); |
|
| 132 | + $this->assertContains($expected, $items); |
|
| 133 | 133 | |
| 134 | 134 | // Home is not included in menu items when page is larger than zero. |
| 135 | - $items = $menus->load_available_items_query( 'post_type', 'page', 1 ); |
|
| 136 | - $this->assertNotEmpty( $items ); |
|
| 137 | - $this->assertNotContains( $expected, $items ); |
|
| 135 | + $items = $menus->load_available_items_query('post_type', 'page', 1); |
|
| 136 | + $this->assertNotEmpty($items); |
|
| 137 | + $this->assertNotContains($expected, $items); |
|
| 138 | 138 | } |
| 139 | 139 | |
| 140 | 140 | /** |
@@ -143,13 +143,13 @@ discard block |
||
| 143 | 143 | * @see WP_Customize_Nav_Menus::load_available_items_query() |
| 144 | 144 | */ |
| 145 | 145 | function test_load_available_items_query_returns_post_item_with_page_number() { |
| 146 | - $menus = new WP_Customize_Nav_Menus( $this->wp_customize ); |
|
| 146 | + $menus = new WP_Customize_Nav_Menus($this->wp_customize); |
|
| 147 | 147 | |
| 148 | 148 | // Create page. |
| 149 | - $post_id = $this->factory->post->create( array( 'post_title' => 'Post Title' ) ); |
|
| 149 | + $post_id = $this->factory->post->create(array('post_title' => 'Post Title')); |
|
| 150 | 150 | |
| 151 | 151 | // Create pages. |
| 152 | - $this->factory->post->create_many( 10 ); |
|
| 152 | + $this->factory->post->create_many(10); |
|
| 153 | 153 | |
| 154 | 154 | // Expected menu item array. |
| 155 | 155 | $expected = array( |
@@ -158,13 +158,13 @@ discard block |
||
| 158 | 158 | 'type' => 'post_type', |
| 159 | 159 | 'type_label' => 'Post', |
| 160 | 160 | 'object' => 'post', |
| 161 | - 'object_id' => intval( $post_id ), |
|
| 162 | - 'url' => get_permalink( intval( $post_id ) ), |
|
| 161 | + 'object_id' => intval($post_id), |
|
| 162 | + 'url' => get_permalink(intval($post_id)), |
|
| 163 | 163 | ); |
| 164 | 164 | |
| 165 | 165 | // Offset the query and get the second page of menu items. |
| 166 | - $items = $menus->load_available_items_query( 'post_type', 'post', 1 ); |
|
| 167 | - $this->assertContains( $expected, $items ); |
|
| 166 | + $items = $menus->load_available_items_query('post_type', 'post', 1); |
|
| 167 | + $this->assertContains($expected, $items); |
|
| 168 | 168 | } |
| 169 | 169 | |
| 170 | 170 | /** |
@@ -173,10 +173,10 @@ discard block |
||
| 173 | 173 | * @see WP_Customize_Nav_Menus::load_available_items_query() |
| 174 | 174 | */ |
| 175 | 175 | function test_load_available_items_query_returns_page_item() { |
| 176 | - $menus = new WP_Customize_Nav_Menus( $this->wp_customize ); |
|
| 176 | + $menus = new WP_Customize_Nav_Menus($this->wp_customize); |
|
| 177 | 177 | |
| 178 | 178 | // Create page. |
| 179 | - $page_id = $this->factory->post->create( array( 'post_title' => 'Page Title', 'post_type' => 'page' ) ); |
|
| 179 | + $page_id = $this->factory->post->create(array('post_title' => 'Page Title', 'post_type' => 'page')); |
|
| 180 | 180 | |
| 181 | 181 | // Expected menu item array. |
| 182 | 182 | $expected = array( |
@@ -185,12 +185,12 @@ discard block |
||
| 185 | 185 | 'type' => 'post_type', |
| 186 | 186 | 'type_label' => 'Page', |
| 187 | 187 | 'object' => 'page', |
| 188 | - 'object_id' => intval( $page_id ), |
|
| 189 | - 'url' => get_permalink( intval( $page_id ) ), |
|
| 188 | + 'object_id' => intval($page_id), |
|
| 189 | + 'url' => get_permalink(intval($page_id)), |
|
| 190 | 190 | ); |
| 191 | 191 | |
| 192 | - $items = $menus->load_available_items_query( 'post_type', 'page', 0 ); |
|
| 193 | - $this->assertContains( $expected, $items ); |
|
| 192 | + $items = $menus->load_available_items_query('post_type', 'page', 0); |
|
| 193 | + $this->assertContains($expected, $items); |
|
| 194 | 194 | } |
| 195 | 195 | |
| 196 | 196 | /** |
@@ -199,10 +199,10 @@ discard block |
||
| 199 | 199 | * @see WP_Customize_Nav_Menus::load_available_items_query() |
| 200 | 200 | */ |
| 201 | 201 | function test_load_available_items_query_returns_post_item() { |
| 202 | - $menus = new WP_Customize_Nav_Menus( $this->wp_customize ); |
|
| 202 | + $menus = new WP_Customize_Nav_Menus($this->wp_customize); |
|
| 203 | 203 | |
| 204 | 204 | // Create post. |
| 205 | - $post_id = $this->factory->post->create( array( 'post_title' => 'Post Title' ) ); |
|
| 205 | + $post_id = $this->factory->post->create(array('post_title' => 'Post Title')); |
|
| 206 | 206 | |
| 207 | 207 | // Expected menu item array. |
| 208 | 208 | $expected = array( |
@@ -211,12 +211,12 @@ discard block |
||
| 211 | 211 | 'type' => 'post_type', |
| 212 | 212 | 'type_label' => 'Post', |
| 213 | 213 | 'object' => 'post', |
| 214 | - 'object_id' => intval( $post_id ), |
|
| 215 | - 'url' => get_permalink( intval( $post_id ) ), |
|
| 214 | + 'object_id' => intval($post_id), |
|
| 215 | + 'url' => get_permalink(intval($post_id)), |
|
| 216 | 216 | ); |
| 217 | 217 | |
| 218 | - $items = $menus->load_available_items_query( 'post_type', 'post', 0 ); |
|
| 219 | - $this->assertContains( $expected, $items ); |
|
| 218 | + $items = $menus->load_available_items_query('post_type', 'post', 0); |
|
| 219 | + $this->assertContains($expected, $items); |
|
| 220 | 220 | } |
| 221 | 221 | |
| 222 | 222 | /** |
@@ -225,10 +225,10 @@ discard block |
||
| 225 | 225 | * @see WP_Customize_Nav_Menus::load_available_items_query() |
| 226 | 226 | */ |
| 227 | 227 | function test_load_available_items_query_returns_term_item() { |
| 228 | - $menus = new WP_Customize_Nav_Menus( $this->wp_customize ); |
|
| 228 | + $menus = new WP_Customize_Nav_Menus($this->wp_customize); |
|
| 229 | 229 | |
| 230 | 230 | // Create term. |
| 231 | - $term_id = $this->factory->category->create( array( 'name' => 'Term Title' ) ); |
|
| 231 | + $term_id = $this->factory->category->create(array('name' => 'Term Title')); |
|
| 232 | 232 | |
| 233 | 233 | // Expected menu item array. |
| 234 | 234 | $expected = array( |
@@ -237,12 +237,12 @@ discard block |
||
| 237 | 237 | 'type' => 'taxonomy', |
| 238 | 238 | 'type_label' => 'Category', |
| 239 | 239 | 'object' => 'category', |
| 240 | - 'object_id' => intval( $term_id ), |
|
| 241 | - 'url' => get_term_link( intval( $term_id ), 'category' ), |
|
| 240 | + 'object_id' => intval($term_id), |
|
| 241 | + 'url' => get_term_link(intval($term_id), 'category'), |
|
| 242 | 242 | ); |
| 243 | 243 | |
| 244 | - $items = $menus->load_available_items_query( 'taxonomy', 'category', 0 ); |
|
| 245 | - $this->assertContains( $expected, $items ); |
|
| 244 | + $items = $menus->load_available_items_query('taxonomy', 'category', 0); |
|
| 245 | + $this->assertContains($expected, $items); |
|
| 246 | 246 | } |
| 247 | 247 | |
| 248 | 248 | /** |
@@ -251,9 +251,9 @@ discard block |
||
| 251 | 251 | * @see WP_Customize_Nav_Menus::load_available_items_query() |
| 252 | 252 | */ |
| 253 | 253 | function test_load_available_items_query_returns_custom_item() { |
| 254 | - add_filter( 'customize_nav_menu_available_item_types', array( $this, 'filter_item_types' ) ); |
|
| 255 | - add_filter( 'customize_nav_menu_available_items', array( $this, 'filter_items' ), 10, 4 ); |
|
| 256 | - $menus = new WP_Customize_Nav_Menus( $this->wp_customize ); |
|
| 254 | + add_filter('customize_nav_menu_available_item_types', array($this, 'filter_item_types')); |
|
| 255 | + add_filter('customize_nav_menu_available_items', array($this, 'filter_items'), 10, 4); |
|
| 256 | + $menus = new WP_Customize_Nav_Menus($this->wp_customize); |
|
| 257 | 257 | |
| 258 | 258 | // Expected menu item array. |
| 259 | 259 | $expected = array( |
@@ -262,12 +262,12 @@ discard block |
||
| 262 | 262 | 'type' => 'custom_type', |
| 263 | 263 | 'type_label' => 'Custom Label', |
| 264 | 264 | 'object' => 'custom_object', |
| 265 | - 'url' => home_url( '/cool-beans/' ), |
|
| 265 | + 'url' => home_url('/cool-beans/'), |
|
| 266 | 266 | 'classes' => 'custom-menu-item cool-beans', |
| 267 | 267 | ); |
| 268 | 268 | |
| 269 | - $items = $menus->load_available_items_query( 'custom_type', 'custom_object', 0 ); |
|
| 270 | - $this->assertContains( $expected, $items ); |
|
| 269 | + $items = $menus->load_available_items_query('custom_type', 'custom_object', 0); |
|
| 270 | + $this->assertContains($expected, $items); |
|
| 271 | 271 | } |
| 272 | 272 | |
| 273 | 273 | /** |
@@ -276,56 +276,56 @@ discard block |
||
| 276 | 276 | * @see WP_Customize_Nav_Menus::search_available_items_query() |
| 277 | 277 | */ |
| 278 | 278 | function test_search_available_items_query() { |
| 279 | - $menus = new WP_Customize_Nav_Menus( $this->wp_customize ); |
|
| 279 | + $menus = new WP_Customize_Nav_Menus($this->wp_customize); |
|
| 280 | 280 | |
| 281 | 281 | // Create posts |
| 282 | 282 | $post_ids = array(); |
| 283 | - $post_ids[] = $this->factory->post->create( array( 'post_title' => 'Search & Test' ) ); |
|
| 284 | - $post_ids[] = $this->factory->post->create( array( 'post_title' => 'Some Other Title' ) ); |
|
| 283 | + $post_ids[] = $this->factory->post->create(array('post_title' => 'Search & Test')); |
|
| 284 | + $post_ids[] = $this->factory->post->create(array('post_title' => 'Some Other Title')); |
|
| 285 | 285 | |
| 286 | 286 | // Create terms |
| 287 | 287 | $term_ids = array(); |
| 288 | - $term_ids[] = $this->factory->category->create( array( 'name' => 'Dogs Are Cool' ) ); |
|
| 289 | - $term_ids[] = $this->factory->category->create( array( 'name' => 'Cats Drool' ) ); |
|
| 288 | + $term_ids[] = $this->factory->category->create(array('name' => 'Dogs Are Cool')); |
|
| 289 | + $term_ids[] = $this->factory->category->create(array('name' => 'Cats Drool')); |
|
| 290 | 290 | |
| 291 | 291 | // Test empty results |
| 292 | 292 | $expected = array(); |
| 293 | - $results = $menus->search_available_items_query( array( 'pagenum' => 1, 's' => 'This Does NOT Exist' ) ); |
|
| 294 | - $this->assertEquals( $expected, $results ); |
|
| 293 | + $results = $menus->search_available_items_query(array('pagenum' => 1, 's' => 'This Does NOT Exist')); |
|
| 294 | + $this->assertEquals($expected, $results); |
|
| 295 | 295 | |
| 296 | 296 | // Test posts |
| 297 | - foreach ( $post_ids as $post_id ) { |
|
| 297 | + foreach ($post_ids as $post_id) { |
|
| 298 | 298 | $expected = array( |
| 299 | - 'id' => 'post-' . $post_id, |
|
| 300 | - 'title' => html_entity_decode( get_the_title( $post_id ) ), |
|
| 299 | + 'id' => 'post-'.$post_id, |
|
| 300 | + 'title' => html_entity_decode(get_the_title($post_id)), |
|
| 301 | 301 | 'type' => 'post_type', |
| 302 | - 'type_label' => get_post_type_object( 'post' )->labels->singular_name, |
|
| 302 | + 'type_label' => get_post_type_object('post')->labels->singular_name, |
|
| 303 | 303 | 'object' => 'post', |
| 304 | - 'object_id' => intval( $post_id ), |
|
| 305 | - 'url' => get_permalink( intval( $post_id ) ), |
|
| 304 | + 'object_id' => intval($post_id), |
|
| 305 | + 'url' => get_permalink(intval($post_id)), |
|
| 306 | 306 | ); |
| 307 | - wp_set_object_terms( $post_id, $term_ids, 'category' ); |
|
| 307 | + wp_set_object_terms($post_id, $term_ids, 'category'); |
|
| 308 | 308 | $search = $post_id === $post_ids[0] ? 'test & search' : 'other title'; |
| 309 | - $s = sanitize_text_field( wp_unslash( $search ) ); |
|
| 310 | - $results = $menus->search_available_items_query( array( 'pagenum' => 1, 's' => $s ) ); |
|
| 311 | - $this->assertEquals( $expected, $results[0] ); |
|
| 309 | + $s = sanitize_text_field(wp_unslash($search)); |
|
| 310 | + $results = $menus->search_available_items_query(array('pagenum' => 1, 's' => $s)); |
|
| 311 | + $this->assertEquals($expected, $results[0]); |
|
| 312 | 312 | } |
| 313 | 313 | |
| 314 | 314 | // Test terms |
| 315 | - foreach ( $term_ids as $term_id ) { |
|
| 316 | - $term = get_term_by( 'id', $term_id, 'category' ); |
|
| 315 | + foreach ($term_ids as $term_id) { |
|
| 316 | + $term = get_term_by('id', $term_id, 'category'); |
|
| 317 | 317 | $expected = array( |
| 318 | - 'id' => 'term-' . $term_id, |
|
| 318 | + 'id' => 'term-'.$term_id, |
|
| 319 | 319 | 'title' => $term->name, |
| 320 | 320 | 'type' => 'taxonomy', |
| 321 | - 'type_label' => get_taxonomy( 'category' )->labels->singular_name, |
|
| 321 | + 'type_label' => get_taxonomy('category')->labels->singular_name, |
|
| 322 | 322 | 'object' => 'category', |
| 323 | - 'object_id' => intval( $term_id ), |
|
| 324 | - 'url' => get_term_link( intval( $term_id ), 'category' ), |
|
| 323 | + 'object_id' => intval($term_id), |
|
| 324 | + 'url' => get_term_link(intval($term_id), 'category'), |
|
| 325 | 325 | ); |
| 326 | - $s = sanitize_text_field( wp_unslash( $term->name ) ); |
|
| 327 | - $results = $menus->search_available_items_query( array( 'pagenum' => 1, 's' => $s ) ); |
|
| 328 | - $this->assertEquals( $expected, $results[0] ); |
|
| 326 | + $s = sanitize_text_field(wp_unslash($term->name)); |
|
| 327 | + $results = $menus->search_available_items_query(array('pagenum' => 1, 's' => $s)); |
|
| 328 | + $this->assertEquals($expected, $results[0]); |
|
| 329 | 329 | } |
| 330 | 330 | } |
| 331 | 331 | |
@@ -335,10 +335,10 @@ discard block |
||
| 335 | 335 | * @see WP_Customize_Nav_Menus::enqueue_scripts() |
| 336 | 336 | */ |
| 337 | 337 | function test_enqueue_scripts() { |
| 338 | - do_action( 'customize_register', $this->wp_customize ); |
|
| 339 | - $menus = new WP_Customize_Nav_Menus( $this->wp_customize ); |
|
| 338 | + do_action('customize_register', $this->wp_customize); |
|
| 339 | + $menus = new WP_Customize_Nav_Menus($this->wp_customize); |
|
| 340 | 340 | $menus->enqueue_scripts(); |
| 341 | - $this->assertTrue( wp_script_is( 'customize-nav-menus' ) ); |
|
| 341 | + $this->assertTrue(wp_script_is('customize-nav-menus')); |
|
| 342 | 342 | } |
| 343 | 343 | |
| 344 | 344 | /** |
@@ -347,15 +347,15 @@ discard block |
||
| 347 | 347 | * @see WP_Customize_Nav_Menus::filter_dynamic_setting_args() |
| 348 | 348 | */ |
| 349 | 349 | function test_filter_dynamic_setting_args() { |
| 350 | - $menus = new WP_Customize_Nav_Menus( $this->wp_customize ); |
|
| 350 | + $menus = new WP_Customize_Nav_Menus($this->wp_customize); |
|
| 351 | 351 | |
| 352 | - $expected = array( 'type' => 'nav_menu_item' ); |
|
| 353 | - $results = $menus->filter_dynamic_setting_args( $this->wp_customize, 'nav_menu_item[123]' ); |
|
| 354 | - $this->assertEquals( $expected, $results ); |
|
| 352 | + $expected = array('type' => 'nav_menu_item'); |
|
| 353 | + $results = $menus->filter_dynamic_setting_args($this->wp_customize, 'nav_menu_item[123]'); |
|
| 354 | + $this->assertEquals($expected, $results); |
|
| 355 | 355 | |
| 356 | - $expected = array( 'type' => 'nav_menu' ); |
|
| 357 | - $results = $menus->filter_dynamic_setting_args( $this->wp_customize, 'nav_menu[123]' ); |
|
| 358 | - $this->assertEquals( $expected, $results ); |
|
| 356 | + $expected = array('type' => 'nav_menu'); |
|
| 357 | + $results = $menus->filter_dynamic_setting_args($this->wp_customize, 'nav_menu[123]'); |
|
| 358 | + $this->assertEquals($expected, $results); |
|
| 359 | 359 | } |
| 360 | 360 | |
| 361 | 361 | /** |
@@ -364,16 +364,16 @@ discard block |
||
| 364 | 364 | * @see WP_Customize_Nav_Menus::filter_dynamic_setting_class() |
| 365 | 365 | */ |
| 366 | 366 | function test_filter_dynamic_setting_class() { |
| 367 | - do_action( 'customize_register', $this->wp_customize ); |
|
| 368 | - $menus = new WP_Customize_Nav_Menus( $this->wp_customize ); |
|
| 367 | + do_action('customize_register', $this->wp_customize); |
|
| 368 | + $menus = new WP_Customize_Nav_Menus($this->wp_customize); |
|
| 369 | 369 | |
| 370 | 370 | $expected = 'WP_Customize_Nav_Menu_Item_Setting'; |
| 371 | - $results = $menus->filter_dynamic_setting_class( 'WP_Customize_Setting', 'nav_menu_item[123]', array( 'type' => 'nav_menu_item' ) ); |
|
| 372 | - $this->assertEquals( $expected, $results ); |
|
| 371 | + $results = $menus->filter_dynamic_setting_class('WP_Customize_Setting', 'nav_menu_item[123]', array('type' => 'nav_menu_item')); |
|
| 372 | + $this->assertEquals($expected, $results); |
|
| 373 | 373 | |
| 374 | 374 | $expected = 'WP_Customize_Nav_Menu_Setting'; |
| 375 | - $results = $menus->filter_dynamic_setting_class( 'WP_Customize_Setting', 'nav_menu[123]', array( 'type' => 'nav_menu' ) ); |
|
| 376 | - $this->assertEquals( $expected, $results ); |
|
| 375 | + $results = $menus->filter_dynamic_setting_class('WP_Customize_Setting', 'nav_menu[123]', array('type' => 'nav_menu')); |
|
| 376 | + $this->assertEquals($expected, $results); |
|
| 377 | 377 | } |
| 378 | 378 | |
| 379 | 379 | /** |
@@ -382,20 +382,20 @@ discard block |
||
| 382 | 382 | * @see WP_Customize_Nav_Menus::customize_register() |
| 383 | 383 | */ |
| 384 | 384 | function test_customize_register() { |
| 385 | - do_action( 'customize_register', $this->wp_customize ); |
|
| 386 | - $menu_id = wp_create_nav_menu( 'Primary' ); |
|
| 387 | - $post_id = $this->factory->post->create( array( 'post_title' => 'Hello World' ) ); |
|
| 388 | - $item_id = wp_update_nav_menu_item( $menu_id, 0, array( |
|
| 385 | + do_action('customize_register', $this->wp_customize); |
|
| 386 | + $menu_id = wp_create_nav_menu('Primary'); |
|
| 387 | + $post_id = $this->factory->post->create(array('post_title' => 'Hello World')); |
|
| 388 | + $item_id = wp_update_nav_menu_item($menu_id, 0, array( |
|
| 389 | 389 | 'menu-item-type' => 'post_type', |
| 390 | 390 | 'menu-item-object' => 'post', |
| 391 | 391 | 'menu-item-object-id' => $post_id, |
| 392 | 392 | 'menu-item-title' => 'Hello World', |
| 393 | 393 | 'menu-item-status' => 'publish', |
| 394 | - ) ); |
|
| 395 | - $setting = new WP_Customize_Nav_Menu_Item_Setting( $this->wp_customize, "nav_menu_item[$item_id]" ); |
|
| 396 | - do_action( 'customize_register', $this->wp_customize ); |
|
| 397 | - $this->assertEquals( 'Primary', $this->wp_customize->get_section( "nav_menu[$menu_id]" )->title ); |
|
| 398 | - $this->assertEquals( 'Hello World', $this->wp_customize->get_control( "nav_menu_item[$item_id]" )->label ); |
|
| 394 | + )); |
|
| 395 | + $setting = new WP_Customize_Nav_Menu_Item_Setting($this->wp_customize, "nav_menu_item[$item_id]"); |
|
| 396 | + do_action('customize_register', $this->wp_customize); |
|
| 397 | + $this->assertEquals('Primary', $this->wp_customize->get_section("nav_menu[$menu_id]")->title); |
|
| 398 | + $this->assertEquals('Hello World', $this->wp_customize->get_control("nav_menu_item[$item_id]")->label); |
|
| 399 | 399 | } |
| 400 | 400 | |
| 401 | 401 | /** |
@@ -405,16 +405,16 @@ discard block |
||
| 405 | 405 | */ |
| 406 | 406 | function test_intval_base10() { |
| 407 | 407 | |
| 408 | - $menus = new WP_Customize_Nav_Menus( $this->wp_customize ); |
|
| 408 | + $menus = new WP_Customize_Nav_Menus($this->wp_customize); |
|
| 409 | 409 | |
| 410 | - $this->assertEquals( 2, $menus->intval_base10( 2 ) ); |
|
| 411 | - $this->assertEquals( 4, $menus->intval_base10( 4.1 ) ); |
|
| 412 | - $this->assertEquals( 4, $menus->intval_base10( '4' ) ); |
|
| 413 | - $this->assertEquals( 4, $menus->intval_base10( '04' ) ); |
|
| 414 | - $this->assertEquals( 42, $menus->intval_base10( +42 ) ); |
|
| 410 | + $this->assertEquals(2, $menus->intval_base10(2)); |
|
| 411 | + $this->assertEquals(4, $menus->intval_base10(4.1)); |
|
| 412 | + $this->assertEquals(4, $menus->intval_base10('4')); |
|
| 413 | + $this->assertEquals(4, $menus->intval_base10('04')); |
|
| 414 | + $this->assertEquals(42, $menus->intval_base10( +42 )); |
|
| 415 | 415 | $this->assertEquals( -42, $menus->intval_base10( -42 ) ); |
| 416 | - $this->assertEquals( 26, $menus->intval_base10( 0x1A ) ); |
|
| 417 | - $this->assertEquals( 0, $menus->intval_base10( array() ) ); |
|
| 416 | + $this->assertEquals(26, $menus->intval_base10(0x1A)); |
|
| 417 | + $this->assertEquals(0, $menus->intval_base10(array())); |
|
| 418 | 418 | } |
| 419 | 419 | |
| 420 | 420 | /** |
@@ -424,31 +424,31 @@ discard block |
||
| 424 | 424 | */ |
| 425 | 425 | function test_available_item_types() { |
| 426 | 426 | |
| 427 | - $menus = new WP_Customize_Nav_Menus( $this->wp_customize ); |
|
| 427 | + $menus = new WP_Customize_Nav_Menus($this->wp_customize); |
|
| 428 | 428 | |
| 429 | 429 | $expected = array( |
| 430 | - array( 'title' => 'Posts', 'type' => 'post_type', 'object' => 'post' ), |
|
| 431 | - array( 'title' => 'Pages', 'type' => 'post_type', 'object' => 'page' ), |
|
| 432 | - array( 'title' => 'Categories', 'type' => 'taxonomy', 'object' => 'category' ), |
|
| 433 | - array( 'title' => 'Tags', 'type' => 'taxonomy', 'object' => 'post_tag' ), |
|
| 430 | + array('title' => 'Posts', 'type' => 'post_type', 'object' => 'post'), |
|
| 431 | + array('title' => 'Pages', 'type' => 'post_type', 'object' => 'page'), |
|
| 432 | + array('title' => 'Categories', 'type' => 'taxonomy', 'object' => 'category'), |
|
| 433 | + array('title' => 'Tags', 'type' => 'taxonomy', 'object' => 'post_tag'), |
|
| 434 | 434 | ); |
| 435 | 435 | |
| 436 | - if ( current_theme_supports( 'post-formats' ) ) { |
|
| 437 | - $expected[] = array( 'title' => 'Format', 'type' => 'taxonomy', 'object' => 'post_format' ); |
|
| 436 | + if (current_theme_supports('post-formats')) { |
|
| 437 | + $expected[] = array('title' => 'Format', 'type' => 'taxonomy', 'object' => 'post_format'); |
|
| 438 | 438 | } |
| 439 | 439 | |
| 440 | - $this->assertEquals( $expected, $menus->available_item_types() ); |
|
| 440 | + $this->assertEquals($expected, $menus->available_item_types()); |
|
| 441 | 441 | |
| 442 | - register_taxonomy( 'wptests_tax', array( 'post' ), array( 'labels' => array( 'name' => 'Foo' ) ) ); |
|
| 443 | - $expected[] = array( 'title' => 'Foo', 'type' => 'taxonomy', 'object' => 'wptests_tax' ); |
|
| 442 | + register_taxonomy('wptests_tax', array('post'), array('labels' => array('name' => 'Foo'))); |
|
| 443 | + $expected[] = array('title' => 'Foo', 'type' => 'taxonomy', 'object' => 'wptests_tax'); |
|
| 444 | 444 | |
| 445 | - $this->assertEquals( $expected, $menus->available_item_types() ); |
|
| 445 | + $this->assertEquals($expected, $menus->available_item_types()); |
|
| 446 | 446 | |
| 447 | - $expected[] = array( 'title' => 'Custom', 'type' => 'custom_type', 'object' => 'custom_object' ); |
|
| 447 | + $expected[] = array('title' => 'Custom', 'type' => 'custom_type', 'object' => 'custom_object'); |
|
| 448 | 448 | |
| 449 | - add_filter( 'customize_nav_menu_available_item_types', array( $this, 'filter_item_types' ) ); |
|
| 450 | - $this->assertEquals( $expected, $menus->available_item_types() ); |
|
| 451 | - remove_filter( 'customize_nav_menu_available_item_types', array( $this, 'filter_item_types' ) ); |
|
| 449 | + add_filter('customize_nav_menu_available_item_types', array($this, 'filter_item_types')); |
|
| 450 | + $this->assertEquals($expected, $menus->available_item_types()); |
|
| 451 | + remove_filter('customize_nav_menu_available_item_types', array($this, 'filter_item_types')); |
|
| 452 | 452 | |
| 453 | 453 | } |
| 454 | 454 | |
@@ -458,8 +458,8 @@ discard block |
||
| 458 | 458 | * @see WP_Customize_Nav_Menus::print_templates() |
| 459 | 459 | */ |
| 460 | 460 | function test_print_templates() { |
| 461 | - do_action( 'customize_register', $this->wp_customize ); |
|
| 462 | - $menus = new WP_Customize_Nav_Menus( $this->wp_customize ); |
|
| 461 | + do_action('customize_register', $this->wp_customize); |
|
| 462 | + $menus = new WP_Customize_Nav_Menus($this->wp_customize); |
|
| 463 | 463 | |
| 464 | 464 | ob_start(); |
| 465 | 465 | $menus->print_templates(); |
@@ -467,13 +467,13 @@ discard block |
||
| 467 | 467 | |
| 468 | 468 | $expected = sprintf( |
| 469 | 469 | '<button type="button" class="menus-move-up">%1$s</button><button type="button" class="menus-move-down">%2$s</button><button type="button" class="menus-move-left">%3$s</button><button type="button" class="menus-move-right">%4$s</button>', |
| 470 | - esc_html( 'Move up' ), |
|
| 471 | - esc_html( 'Move down' ), |
|
| 472 | - esc_html( 'Move one level up' ), |
|
| 473 | - esc_html( 'Move one level down' ) |
|
| 470 | + esc_html('Move up'), |
|
| 471 | + esc_html('Move down'), |
|
| 472 | + esc_html('Move one level up'), |
|
| 473 | + esc_html('Move one level down') |
|
| 474 | 474 | ); |
| 475 | 475 | |
| 476 | - $this->assertContains( $expected, $template ); |
|
| 476 | + $this->assertContains($expected, $template); |
|
| 477 | 477 | } |
| 478 | 478 | |
| 479 | 479 | /** |
@@ -482,42 +482,42 @@ discard block |
||
| 482 | 482 | * @see WP_Customize_Nav_Menus::available_items_template() |
| 483 | 483 | */ |
| 484 | 484 | function test_available_items_template() { |
| 485 | - add_filter( 'customize_nav_menu_available_item_types', array( $this, 'filter_item_types' ) ); |
|
| 486 | - do_action( 'customize_register', $this->wp_customize ); |
|
| 487 | - $menus = new WP_Customize_Nav_Menus( $this->wp_customize ); |
|
| 485 | + add_filter('customize_nav_menu_available_item_types', array($this, 'filter_item_types')); |
|
| 486 | + do_action('customize_register', $this->wp_customize); |
|
| 487 | + $menus = new WP_Customize_Nav_Menus($this->wp_customize); |
|
| 488 | 488 | |
| 489 | 489 | ob_start(); |
| 490 | 490 | $menus->available_items_template(); |
| 491 | 491 | $template = ob_get_clean(); |
| 492 | 492 | |
| 493 | - $expected = sprintf( 'Customizing ▸ %s', esc_html( $this->wp_customize->get_panel( 'nav_menus' )->title ) ); |
|
| 493 | + $expected = sprintf('Customizing ▸ %s', esc_html($this->wp_customize->get_panel('nav_menus')->title)); |
|
| 494 | 494 | |
| 495 | - $this->assertContains( $expected, $template ); |
|
| 495 | + $this->assertContains($expected, $template); |
|
| 496 | 496 | |
| 497 | - $post_types = get_post_types( array( 'show_in_nav_menus' => true ), 'object' ); |
|
| 498 | - if ( $post_types ) { |
|
| 499 | - foreach ( $post_types as $type ) { |
|
| 500 | - $this->assertContains( 'available-menu-items-post_type-' . esc_attr( $type->name ), $template ); |
|
| 501 | - $this->assertRegExp( '#<h4 class="accordion-section-title".*>\s*' . esc_html( $type->labels->singular_name ) . '#', $template ); |
|
| 502 | - $this->assertContains( 'data-type="post_type"', $template ); |
|
| 503 | - $this->assertContains( 'data-object="' . esc_attr( $type->name ) . '"', $template ); |
|
| 497 | + $post_types = get_post_types(array('show_in_nav_menus' => true), 'object'); |
|
| 498 | + if ($post_types) { |
|
| 499 | + foreach ($post_types as $type) { |
|
| 500 | + $this->assertContains('available-menu-items-post_type-'.esc_attr($type->name), $template); |
|
| 501 | + $this->assertRegExp('#<h4 class="accordion-section-title".*>\s*'.esc_html($type->labels->singular_name).'#', $template); |
|
| 502 | + $this->assertContains('data-type="post_type"', $template); |
|
| 503 | + $this->assertContains('data-object="'.esc_attr($type->name).'"', $template); |
|
| 504 | 504 | } |
| 505 | 505 | } |
| 506 | 506 | |
| 507 | - $taxonomies = get_taxonomies( array( 'show_in_nav_menus' => true ), 'object' ); |
|
| 508 | - if ( $taxonomies ) { |
|
| 509 | - foreach ( $taxonomies as $tax ) { |
|
| 510 | - $this->assertContains( 'available-menu-items-taxonomy-' . esc_attr( $tax->name ), $template ); |
|
| 511 | - $this->assertRegExp( '#<h4 class="accordion-section-title".*>\s*' . esc_html( $tax->labels->name ) . '#', $template ); |
|
| 512 | - $this->assertContains( 'data-type="taxonomy"', $template ); |
|
| 513 | - $this->assertContains( 'data-object="' . esc_attr( $tax->name ) . '"', $template ); |
|
| 507 | + $taxonomies = get_taxonomies(array('show_in_nav_menus' => true), 'object'); |
|
| 508 | + if ($taxonomies) { |
|
| 509 | + foreach ($taxonomies as $tax) { |
|
| 510 | + $this->assertContains('available-menu-items-taxonomy-'.esc_attr($tax->name), $template); |
|
| 511 | + $this->assertRegExp('#<h4 class="accordion-section-title".*>\s*'.esc_html($tax->labels->name).'#', $template); |
|
| 512 | + $this->assertContains('data-type="taxonomy"', $template); |
|
| 513 | + $this->assertContains('data-object="'.esc_attr($tax->name).'"', $template); |
|
| 514 | 514 | } |
| 515 | 515 | } |
| 516 | 516 | |
| 517 | - $this->assertContains( 'available-menu-items-custom_type', $template ); |
|
| 518 | - $this->assertRegExp( '#<h4 class="accordion-section-title".*>\s*Custom#', $template ); |
|
| 519 | - $this->assertContains( 'data-type="custom_type"', $template ); |
|
| 520 | - $this->assertContains( 'data-object="custom_object"', $template ); |
|
| 517 | + $this->assertContains('available-menu-items-custom_type', $template); |
|
| 518 | + $this->assertRegExp('#<h4 class="accordion-section-title".*>\s*Custom#', $template); |
|
| 519 | + $this->assertContains('data-type="custom_type"', $template); |
|
| 520 | + $this->assertContains('data-object="custom_object"', $template); |
|
| 521 | 521 | } |
| 522 | 522 | |
| 523 | 523 | /** |
@@ -526,16 +526,16 @@ discard block |
||
| 526 | 526 | * @see WP_Customize_Nav_Menus::customize_preview_init() |
| 527 | 527 | */ |
| 528 | 528 | function test_customize_preview_init() { |
| 529 | - do_action( 'customize_register', $this->wp_customize ); |
|
| 530 | - $menus = new WP_Customize_Nav_Menus( $this->wp_customize ); |
|
| 529 | + do_action('customize_register', $this->wp_customize); |
|
| 530 | + $menus = new WP_Customize_Nav_Menus($this->wp_customize); |
|
| 531 | 531 | |
| 532 | 532 | $menus->customize_preview_init(); |
| 533 | - $this->assertEquals( 10, has_action( 'template_redirect', array( $menus, 'render_menu' ) ) ); |
|
| 534 | - $this->assertEquals( 10, has_action( 'wp_enqueue_scripts', array( $menus, 'customize_preview_enqueue_deps' ) ) ); |
|
| 533 | + $this->assertEquals(10, has_action('template_redirect', array($menus, 'render_menu'))); |
|
| 534 | + $this->assertEquals(10, has_action('wp_enqueue_scripts', array($menus, 'customize_preview_enqueue_deps'))); |
|
| 535 | 535 | |
| 536 | - if ( ! isset( $_REQUEST[ WP_Customize_Nav_Menus::RENDER_QUERY_VAR ] ) ) { |
|
| 537 | - $this->assertEquals( 1000, has_filter( 'wp_nav_menu_args', array( $menus, 'filter_wp_nav_menu_args' ) ) ); |
|
| 538 | - $this->assertEquals( 10, has_filter( 'wp_nav_menu', array( $menus, 'filter_wp_nav_menu' ) ) ); |
|
| 536 | + if ( ! isset($_REQUEST[WP_Customize_Nav_Menus::RENDER_QUERY_VAR])) { |
|
| 537 | + $this->assertEquals(1000, has_filter('wp_nav_menu_args', array($menus, 'filter_wp_nav_menu_args'))); |
|
| 538 | + $this->assertEquals(10, has_filter('wp_nav_menu', array($menus, 'filter_wp_nav_menu'))); |
|
| 539 | 539 | } |
| 540 | 540 | } |
| 541 | 541 | |
@@ -545,16 +545,16 @@ discard block |
||
| 545 | 545 | * @see WP_Customize_Nav_Menus::filter_wp_nav_menu_args() |
| 546 | 546 | */ |
| 547 | 547 | function test_filter_wp_nav_menu_args() { |
| 548 | - do_action( 'customize_register', $this->wp_customize ); |
|
| 549 | - $menus = new WP_Customize_Nav_Menus( $this->wp_customize ); |
|
| 548 | + do_action('customize_register', $this->wp_customize); |
|
| 549 | + $menus = new WP_Customize_Nav_Menus($this->wp_customize); |
|
| 550 | 550 | |
| 551 | - $results = $menus->filter_wp_nav_menu_args( array( |
|
| 551 | + $results = $menus->filter_wp_nav_menu_args(array( |
|
| 552 | 552 | 'echo' => true, |
| 553 | 553 | 'fallback_cb' => 'wp_page_menu', |
| 554 | 554 | 'walker' => '', |
| 555 | - 'menu' => wp_create_nav_menu( 'Foo' ), |
|
| 556 | - ) ); |
|
| 557 | - $this->assertEquals( 1, $results['can_partial_refresh'] ); |
|
| 555 | + 'menu' => wp_create_nav_menu('Foo'), |
|
| 556 | + )); |
|
| 557 | + $this->assertEquals(1, $results['can_partial_refresh']); |
|
| 558 | 558 | |
| 559 | 559 | $expected = array( |
| 560 | 560 | 'echo', |
@@ -563,20 +563,20 @@ discard block |
||
| 563 | 563 | 'instance_number', |
| 564 | 564 | 'walker', |
| 565 | 565 | ); |
| 566 | - $results = $menus->filter_wp_nav_menu_args( array( |
|
| 566 | + $results = $menus->filter_wp_nav_menu_args(array( |
|
| 567 | 567 | 'echo' => false, |
| 568 | 568 | 'fallback_cb' => 'wp_page_menu', |
| 569 | 569 | 'walker' => new Walker_Nav_Menu(), |
| 570 | - ) ); |
|
| 571 | - $this->assertEqualSets( $expected, array_keys( $results ) ); |
|
| 572 | - $this->assertEquals( 'wp_page_menu', $results['fallback_cb'] ); |
|
| 573 | - $this->assertEquals( 0, $results['can_partial_refresh'] ); |
|
| 574 | - |
|
| 575 | - $this->assertNotEmpty( $menus->preview_nav_menu_instance_args[ $results['instance_number'] ] ); |
|
| 576 | - $preview_nav_menu_instance_args = $menus->preview_nav_menu_instance_args[ $results['instance_number'] ]; |
|
| 577 | - $this->assertEquals( '', $preview_nav_menu_instance_args['fallback_cb'] ); |
|
| 578 | - $this->assertEquals( '', $preview_nav_menu_instance_args['walker'] ); |
|
| 579 | - $this->assertNotEmpty( $preview_nav_menu_instance_args['args_hash'] ); |
|
| 570 | + )); |
|
| 571 | + $this->assertEqualSets($expected, array_keys($results)); |
|
| 572 | + $this->assertEquals('wp_page_menu', $results['fallback_cb']); |
|
| 573 | + $this->assertEquals(0, $results['can_partial_refresh']); |
|
| 574 | + |
|
| 575 | + $this->assertNotEmpty($menus->preview_nav_menu_instance_args[$results['instance_number']]); |
|
| 576 | + $preview_nav_menu_instance_args = $menus->preview_nav_menu_instance_args[$results['instance_number']]; |
|
| 577 | + $this->assertEquals('', $preview_nav_menu_instance_args['fallback_cb']); |
|
| 578 | + $this->assertEquals('', $preview_nav_menu_instance_args['walker']); |
|
| 579 | + $this->assertNotEmpty($preview_nav_menu_instance_args['args_hash']); |
|
| 580 | 580 | } |
| 581 | 581 | |
| 582 | 582 | /** |
@@ -585,27 +585,27 @@ discard block |
||
| 585 | 585 | * @see WP_Customize_Nav_Menus::filter_wp_nav_menu() |
| 586 | 586 | */ |
| 587 | 587 | function test_filter_wp_nav_menu() { |
| 588 | - do_action( 'customize_register', $this->wp_customize ); |
|
| 589 | - $menus = new WP_Customize_Nav_Menus( $this->wp_customize ); |
|
| 588 | + do_action('customize_register', $this->wp_customize); |
|
| 589 | + $menus = new WP_Customize_Nav_Menus($this->wp_customize); |
|
| 590 | 590 | |
| 591 | - $args = $menus->filter_wp_nav_menu_args( array( |
|
| 591 | + $args = $menus->filter_wp_nav_menu_args(array( |
|
| 592 | 592 | 'echo' => true, |
| 593 | - 'menu' => wp_create_nav_menu( 'Foo' ), |
|
| 593 | + 'menu' => wp_create_nav_menu('Foo'), |
|
| 594 | 594 | 'fallback_cb' => 'wp_page_menu', |
| 595 | 595 | 'walker' => '', |
| 596 | - ) ); |
|
| 596 | + )); |
|
| 597 | 597 | |
| 598 | 598 | ob_start(); |
| 599 | - wp_nav_menu( $args ); |
|
| 599 | + wp_nav_menu($args); |
|
| 600 | 600 | $nav_menu_content = ob_get_clean(); |
| 601 | 601 | |
| 602 | - $object_args = json_decode( json_encode( $args ), false ); |
|
| 603 | - $result = $menus->filter_wp_nav_menu( $nav_menu_content, $object_args ); |
|
| 602 | + $object_args = json_decode(json_encode($args), false); |
|
| 603 | + $result = $menus->filter_wp_nav_menu($nav_menu_content, $object_args); |
|
| 604 | 604 | $expected = sprintf( |
| 605 | 605 | '<div class="partial-refreshable-nav-menu partial-refreshable-nav-menu-%1$d menu">', |
| 606 | 606 | $args['instance_number'] |
| 607 | 607 | ); |
| 608 | - $this->assertStringStartsWith( $expected, $result ); |
|
| 608 | + $this->assertStringStartsWith($expected, $result); |
|
| 609 | 609 | } |
| 610 | 610 | |
| 611 | 611 | /** |
@@ -614,13 +614,13 @@ discard block |
||
| 614 | 614 | * @see WP_Customize_Nav_Menus::customize_preview_enqueue_deps() |
| 615 | 615 | */ |
| 616 | 616 | function test_customize_preview_enqueue_deps() { |
| 617 | - do_action( 'customize_register', $this->wp_customize ); |
|
| 618 | - $menus = new WP_Customize_Nav_Menus( $this->wp_customize ); |
|
| 617 | + do_action('customize_register', $this->wp_customize); |
|
| 618 | + $menus = new WP_Customize_Nav_Menus($this->wp_customize); |
|
| 619 | 619 | |
| 620 | 620 | $menus->customize_preview_enqueue_deps(); |
| 621 | 621 | |
| 622 | - $this->assertTrue( wp_script_is( 'customize-preview-nav-menus' ) ); |
|
| 623 | - $this->assertEquals( 10, has_action( 'wp_print_footer_scripts', array( $menus, 'export_preview_data' ) ) ); |
|
| 622 | + $this->assertTrue(wp_script_is('customize-preview-nav-menus')); |
|
| 623 | + $this->assertEquals(10, has_action('wp_print_footer_scripts', array($menus, 'export_preview_data'))); |
|
| 624 | 624 | } |
| 625 | 625 | |
| 626 | 626 | /** |
@@ -629,8 +629,8 @@ discard block |
||
| 629 | 629 | * @see WP_Customize_Nav_Menus::export_preview_data() |
| 630 | 630 | */ |
| 631 | 631 | function test_export_preview_data() { |
| 632 | - do_action( 'customize_register', $this->wp_customize ); |
|
| 633 | - $menus = new WP_Customize_Nav_Menus( $this->wp_customize ); |
|
| 632 | + do_action('customize_register', $this->wp_customize); |
|
| 633 | + $menus = new WP_Customize_Nav_Menus($this->wp_customize); |
|
| 634 | 634 | |
| 635 | 635 | $request_uri = $_SERVER['REQUEST_URI']; |
| 636 | 636 | |
@@ -641,15 +641,15 @@ discard block |
||
| 641 | 641 | |
| 642 | 642 | $_SERVER['REQUEST_URI'] = $request_uri; |
| 643 | 643 | |
| 644 | - $this->assertContains( '_wpCustomizePreviewNavMenusExports', $data ); |
|
| 645 | - $this->assertContains( 'renderQueryVar', $data ); |
|
| 646 | - $this->assertContains( 'renderNonceValue', $data ); |
|
| 647 | - $this->assertContains( 'renderNoncePostKey', $data ); |
|
| 648 | - $this->assertContains( 'requestUri', $data ); |
|
| 649 | - $this->assertContains( 'theme', $data ); |
|
| 650 | - $this->assertContains( 'previewCustomizeNonce', $data ); |
|
| 651 | - $this->assertContains( 'navMenuInstanceArgs', $data ); |
|
| 652 | - $this->assertContains( 'requestUri', $data ); |
|
| 644 | + $this->assertContains('_wpCustomizePreviewNavMenusExports', $data); |
|
| 645 | + $this->assertContains('renderQueryVar', $data); |
|
| 646 | + $this->assertContains('renderNonceValue', $data); |
|
| 647 | + $this->assertContains('renderNoncePostKey', $data); |
|
| 648 | + $this->assertContains('requestUri', $data); |
|
| 649 | + $this->assertContains('theme', $data); |
|
| 650 | + $this->assertContains('previewCustomizeNonce', $data); |
|
| 651 | + $this->assertContains('navMenuInstanceArgs', $data); |
|
| 652 | + $this->assertContains('requestUri', $data); |
|
| 653 | 653 | |
| 654 | 654 | } |
| 655 | 655 | |