| 523 | /** |
| 524 | * @ticket 36392 |
| 525 | */ |
| 526 | public function test_wp_add_inline_script_concat_with_core_dependency() { |
| 527 | global $wp_scripts; |
| 528 | |
| 529 | wp_default_scripts( $wp_scripts ); |
| 530 | |
| 531 | $wp_scripts->base_url = ''; |
| 532 | $wp_scripts->do_concat = true; |
| 533 | |
| 534 | $ver = get_bloginfo( 'version' ); |
| 535 | $expected = "<script type='text/javascript' src='/wp-admin/load-scripts.php?c=0&load%5B%5D=jquery-core,jquery-migrate&ver={$ver}'></script>\n"; |
| 536 | $expected .= "<script type='text/javascript' src='http://example.com'></script>\n"; |
| 537 | $expected .= "<script type='text/javascript'>\nconsole.log(\"after\");\n</script>\n"; |
| 538 | |
| 539 | wp_enqueue_script( 'test-example', 'http://example.com', array( 'jquery' ), null ); |
| 540 | wp_add_inline_script( 'test-example', 'console.log("after");' ); |
| 541 | |
| 542 | wp_print_scripts(); |
| 543 | $print_scripts = get_echo( '_print_scripts' ); |
| 544 | |
| 545 | $this->assertEquals( $expected, $print_scripts ); |
| 546 | } |