Changeset 52010 for trunk/tests/phpunit/tests/dependencies/scripts.php
- Timestamp:
- 11/04/2021 03:22:47 PM (3 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/tests/phpunit/tests/dependencies/scripts.php
r51968 r52010 15 15 protected $wp_scripts_print_translations_output; 16 16 17 function set_up() {17 public function set_up() { 18 18 parent::set_up(); 19 19 $this->old_wp_scripts = isset( $GLOBALS['wp_scripts'] ) ? $GLOBALS['wp_scripts'] : null; … … 35 35 } 36 36 37 function tear_down() {37 public function tear_down() { 38 38 $GLOBALS['wp_scripts'] = $this->old_wp_scripts; 39 39 add_action( 'wp_default_scripts', 'wp_default_scripts' ); … … 46 46 * @ticket 11315 47 47 */ 48 function test_wp_enqueue_script() {48 public function test_wp_enqueue_script() { 49 49 wp_enqueue_script( 'no-deps-no-version', 'example.com', array() ); 50 50 wp_enqueue_script( 'empty-deps-no-version', 'example.com' ); … … 67 67 * @ticket 42804 68 68 */ 69 function test_wp_enqueue_script_with_html5_support_does_not_contain_type_attribute() {69 public function test_wp_enqueue_script_with_html5_support_does_not_contain_type_attribute() { 70 70 add_theme_support( 'html5', array( 'script' ) ); 71 71 … … 153 153 * @ticket 16024 154 154 */ 155 function test_wp_script_add_data_with_data_key() {155 public function test_wp_script_add_data_with_data_key() { 156 156 // Enqueue and add data. 157 157 wp_enqueue_script( 'test-only-data', 'example.com', array(), null ); … … 172 172 * @ticket 16024 173 173 */ 174 function test_wp_script_add_data_with_conditional_key() {174 public function test_wp_script_add_data_with_conditional_key() { 175 175 // Enqueue and add conditional comments. 176 176 wp_enqueue_script( 'test-only-conditional', 'example.com', array(), null ); … … 190 190 * @ticket 16024 191 191 */ 192 function test_wp_script_add_data_with_data_and_conditional_keys() {192 public function test_wp_script_add_data_with_data_and_conditional_keys() { 193 193 // Enqueue and add data plus conditional comments for both. 194 194 wp_enqueue_script( 'test-conditional-with-data', 'example.com', array(), null ); … … 210 210 * @ticket 16024 211 211 */ 212 function test_wp_script_add_data_with_invalid_key() {212 public function test_wp_script_add_data_with_invalid_key() { 213 213 // Enqueue and add an invalid key. 214 214 wp_enqueue_script( 'test-invalid', 'example.com', array(), null ); … … 228 228 * @ticket 31126 229 229 */ 230 function test_wp_register_script() {230 public function test_wp_register_script() { 231 231 $this->assertTrue( wp_register_script( 'duplicate-handler', 'http://example.com' ) ); 232 232 $this->assertFalse( wp_register_script( 'duplicate-handler', 'http://example.com' ) ); … … 236 236 * @ticket 35229 237 237 */ 238 function test_wp_register_script_with_handle_without_source() {238 public function test_wp_register_script_with_handle_without_source() { 239 239 $expected = "<script type='text/javascript' src='http://example.com?ver=1' id='handle-one-js'></script>\n"; 240 240 $expected .= "<script type='text/javascript' src='http://example.com?ver=2' id='handle-two-js'></script>\n"; … … 252 252 * @ticket 35643 253 253 */ 254 function test_wp_enqueue_script_footer_alias() {254 public function test_wp_enqueue_script_footer_alias() { 255 255 wp_register_script( 'foo', false, array( 'bar', 'baz' ), '1.0', true ); 256 256 wp_register_script( 'bar', home_url( 'bar.js' ), array(), '1.0', true ); … … 320 320 * @ticket 35873 321 321 */ 322 function test_wp_register_script_with_dependencies_in_head_and_footer() {322 public function test_wp_register_script_with_dependencies_in_head_and_footer() { 323 323 wp_register_script( 'parent', '/parent.js', array( 'child-head' ), null, true ); // In footer. 324 324 wp_register_script( 'child-head', '/child-head.js', array( 'child-footer' ), null, false ); // In head. … … 341 341 * @ticket 35956 342 342 */ 343 function test_wp_register_script_with_dependencies_in_head_and_footer_in_reversed_order() {343 public function test_wp_register_script_with_dependencies_in_head_and_footer_in_reversed_order() { 344 344 wp_register_script( 'child-head', '/child-head.js', array(), null, false ); // In head. 345 345 wp_register_script( 'child-footer', '/child-footer.js', array(), null, true ); // In footer. … … 362 362 * @ticket 35956 363 363 */ 364 function test_wp_register_script_with_dependencies_in_head_and_footer_in_reversed_order_and_two_parent_scripts() {364 public function test_wp_register_script_with_dependencies_in_head_and_footer_in_reversed_order_and_two_parent_scripts() { 365 365 wp_register_script( 'grandchild-head', '/grandchild-head.js', array(), null, false ); // In head. 366 366 wp_register_script( 'child-head', '/child-head.js', array(), null, false ); // In head. … … 393 393 * @ticket 14853 394 394 */ 395 function test_wp_add_inline_script_returns_bool() {395 public function test_wp_add_inline_script_returns_bool() { 396 396 $this->assertFalse( wp_add_inline_script( 'test-example', 'console.log("before");', 'before' ) ); 397 397 wp_enqueue_script( 'test-example', 'example.com', array(), null ); … … 402 402 * @ticket 14853 403 403 */ 404 function test_wp_add_inline_script_unknown_handle() {404 public function test_wp_add_inline_script_unknown_handle() { 405 405 $this->assertFalse( wp_add_inline_script( 'test-invalid', 'console.log("before");', 'before' ) ); 406 406 $this->assertSame( '', get_echo( 'wp_print_scripts' ) ); … … 410 410 * @ticket 14853 411 411 */ 412 function test_wp_add_inline_script_before() {412 public function test_wp_add_inline_script_before() { 413 413 wp_enqueue_script( 'test-example', 'example.com', array(), null ); 414 414 wp_add_inline_script( 'test-example', 'console.log("before");', 'before' ); … … 423 423 * @ticket 14853 424 424 */ 425 function test_wp_add_inline_script_after() {425 public function test_wp_add_inline_script_after() { 426 426 wp_enqueue_script( 'test-example', 'example.com', array(), null ); 427 427 wp_add_inline_script( 'test-example', 'console.log("after");' ); … … 436 436 * @ticket 14853 437 437 */ 438 function test_wp_add_inline_script_before_and_after() {438 public function test_wp_add_inline_script_before_and_after() { 439 439 wp_enqueue_script( 'test-example', 'example.com', array(), null ); 440 440 wp_add_inline_script( 'test-example', 'console.log("before");', 'before' ); … … 451 451 * @ticket 44551 452 452 */ 453 function test_wp_add_inline_script_before_for_handle_without_source() {453 public function test_wp_add_inline_script_before_for_handle_without_source() { 454 454 wp_register_script( 'test-example', '' ); 455 455 wp_enqueue_script( 'test-example' ); … … 464 464 * @ticket 44551 465 465 */ 466 function test_wp_add_inline_script_after_for_handle_without_source() {466 public function test_wp_add_inline_script_after_for_handle_without_source() { 467 467 wp_register_script( 'test-example', '' ); 468 468 wp_enqueue_script( 'test-example' ); … … 477 477 * @ticket 44551 478 478 */ 479 function test_wp_add_inline_script_before_and_after_for_handle_without_source() {479 public function test_wp_add_inline_script_before_and_after_for_handle_without_source() { 480 480 wp_register_script( 'test-example', '' ); 481 481 wp_enqueue_script( 'test-example' ); … … 492 492 * @ticket 14853 493 493 */ 494 function test_wp_add_inline_script_multiple() {494 public function test_wp_add_inline_script_multiple() { 495 495 wp_enqueue_script( 'test-example', 'example.com', array(), null ); 496 496 wp_add_inline_script( 'test-example', 'console.log("before");', 'before' ); … … 509 509 * @ticket 14853 510 510 */ 511 function test_wp_add_inline_script_localized_data_is_added_first() {511 public function test_wp_add_inline_script_localized_data_is_added_first() { 512 512 wp_enqueue_script( 'test-example', 'example.com', array(), null ); 513 513 wp_localize_script( 'test-example', 'testExample', array( 'foo' => 'bar' ) );
Note: See TracChangeset
for help on using the changeset viewer.