Make WordPress Core

Changeset 55565


Ignore:
Timestamp:
03/20/2023 04:16:22 PM (13 months ago)
Author:
hellofromTonya
Message:

Tests: Add test class for wp_script_is().

Changes:

  • Adds a test class for wp_script_is().
  • Moves WP_Dependencies_jQuery::test_wp_script_is_dep_enqueued() into this test class and splits it into 2 separate tests, happy and unhappy paths.
  • Adds WP_Scripts::query @covers, as wp_script_is() is helper function for it.
  • Relocates the global resetting from the test method to the clean_up_global_scope() method.

Follow-up to [52010], [29252].

Props hellofromTonya, antonvlasenko.
See #57841, #57958.

Location:
trunk/tests/phpunit/tests/dependencies
Files:
1 added
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/tests/phpunit/tests/dependencies/jquery.php

    r54891 r55565  
    8686
    8787    /**
    88      * @ticket 28404
    89      *
    90      * @covers ::wp_script_is
    91      */
    92     public function test_wp_script_is_dep_enqueued() {
    93         wp_enqueue_script( 'jquery-ui-accordion' );
    94 
    95         $this->assertTrue( wp_script_is( 'jquery', 'enqueued' ) );
    96         $this->assertFalse( wp_script_is( 'underscore', 'enqueued' ) );
    97 
    98         unset( $GLOBALS['wp_scripts'] );
    99     }
    100 
    101     /**
    10288     * Test placing of jQuery in footer.
    10389     *
Note: See TracChangeset for help on using the changeset viewer.