Make WordPress Core


Ignore:
Timestamp:
11/22/2022 03:02:26 PM (19 months ago)
Author:
SergeyBiryukov
Message:

Tests: Move wp_filesize() tests to their own file.

This aims to make the tests more discoverable and easier to expand.

Includes splitting the wp_filesize and pre_wp_filesize filter tests into a separate test case.

Follow-up to [52837], [52932], [54402].

Props pbearne, spacedmonkey, SergeyBiryukov.
See #57171.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/tests/phpunit/tests/functions.php

    r54724 r54861  
    20672067
    20682068    /**
    2069      * @ticket 49412
    2070      * @covers ::wp_filesize
    2071      */
    2072     function test_wp_filesize_with_nonexistent_file() {
    2073         $file = 'nonexistent/file.jpg';
    2074         $this->assertSame( 0, wp_filesize( $file ) );
    2075     }
    2076 
    2077     /**
    2078      * @ticket 49412
    2079      * @covers ::wp_filesize
    2080      */
    2081     function test_wp_filesize() {
    2082         $file = DIR_TESTDATA . '/images/test-image-upside-down.jpg';
    2083 
    2084         $this->assertSame( filesize( $file ), wp_filesize( $file ) );
    2085 
    2086         $filter = function() {
    2087             return 999;
    2088         };
    2089 
    2090         add_filter( 'wp_filesize', $filter );
    2091 
    2092         $this->assertSame( 999, wp_filesize( $file ) );
    2093 
    2094         $pre_filter = function() {
    2095             return 111;
    2096         };
    2097 
    2098         add_filter( 'pre_wp_filesize', $pre_filter );
    2099 
    2100         $this->assertSame( 111, wp_filesize( $file ) );
    2101     }
    2102 
    2103     /**
    21042069     * @ticket 55505
    21052070     * @covers ::wp_recursive_ksort
Note: See TracChangeset for help on using the changeset viewer.