Make WordPress Core


Ignore:
Timestamp:
02/26/2021 02:07:53 PM (4 years ago)
Author:
johnbillion
Message:

Build/Test Tools: Switch back to running the PHPUnit test suite against the src directory instead of build.

Some PHPUnit tests were concerned with the state of files in the build directory. In order to allow the tests to run without requiring a build to be run first, these have been moved into assertions that run after the build step (and therefore cause it to fail if they do not pass), or into QUnit tests as necessary.

Various other PHPUnit tests implictly depend on built JavaScript files being present. These files are now touched during the test setup to avoid PHP warnings if the build files are not present.

The wp-tests-config-sample.php file and the GitHub Actions configuration have also been changed so ABSPATH uses src instead of build, therefore allowing the PHPUnit tests to be run without a build having to be run first. This means all new local installations of WordPress will use src for PHPUnit testing. If you would like to switch your existing installation over then change the location of ABSPATH in wp-tests-config.php to point to src instead of build.

Props peterwilsoncc, iandunn, gziolo, desroj, johnbillion

Fixes #51734
See #45863

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/tests/phpunit/tests/formatting/Emoji.php

    r49239 r50441  
    1414     */
    1515    public function test_unfiltered_emoji_cdns() {
     16        // `_print_emoji_detection_script()` assumes `wp-includes/js/wp-emoji-loader.js` is present:
     17        self::touch( ABSPATH . WPINC . '/js/wp-emoji-loader.js' );
    1618        $output = get_echo( '_print_emoji_detection_script' );
    1719
     
    3234        add_filter( 'emoji_svg_url', array( $this, '_filtered_emoji_svn_cdn' ) );
    3335
     36        // `_print_emoji_detection_script()` assumes `wp-includes/js/wp-emoji-loader.js` is present:
     37        self::touch( ABSPATH . WPINC . '/js/wp-emoji-loader.js' );
    3438        $output = get_echo( '_print_emoji_detection_script' );
    3539
     
    5357        add_filter( 'emoji_url', array( $this, '_filtered_emoji_png_cdn' ) );
    5458
     59        // `_print_emoji_detection_script()` assumes `wp-includes/js/wp-emoji-loader.js` is present:
     60        self::touch( ABSPATH . WPINC . '/js/wp-emoji-loader.js' );
    5561        $output = get_echo( '_print_emoji_detection_script' );
    5662
Note: See TracChangeset for help on using the changeset viewer.