| 202 | |
| 203 | /** |
| 204 | * @ticket 35873 |
| 205 | */ |
| 206 | function test_wp_register_script_with_dependencies_in_head_and_footer() { |
| 207 | wp_register_script( 'parent', home_url( 'parent.js' ), array( 'child' ), '1', true ); // in footer |
| 208 | wp_register_script( 'child', home_url( 'child.js' ), array( 'grandchild' ), '1', false ); // in head |
| 209 | wp_register_script( 'grandchild', home_url( 'grandchild.js' ), array(), '1', true ); // in footer |
| 210 | |
| 211 | wp_enqueue_script( 'parent' ); |
| 212 | |
| 213 | $header = get_echo( 'wp_print_head_scripts' ); |
| 214 | $footer = get_echo( 'wp_print_footer_scripts' ); |
| 215 | |
| 216 | $expected = "<script type='text/javascript' src='http://example.org/grandchild.js?ver=1'></script>\n"; |
| 217 | $expected .= "<script type='text/javascript' src='http://example.org/child.js?ver=1'></script>\n"; |
| 218 | $expected .= "<script type='text/javascript' src='http://example.org/parent.js?ver=1'></script>\n"; |
| 219 | |
| 220 | $this->assertEquals( $expected, $header ); |
| 221 | $this->assertEmpty( $footer ); |
| 222 | } |