Make WordPress Core

Changeset 53464


Ignore:
Timestamp:
06/04/2022 01:39:17 PM (3 years ago)
Author:
SergeyBiryukov
Message:

Tests: Consistently pass the $force_delete parameter to wp_delete_attachment().

Convert some wp_delete_post() calls to wp_delete_attachment() to avoid an extra function call.

See #55652.

Location:
trunk/tests/phpunit/tests
Files:
3 edited

Legend:

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

    r53149 r53464  
    5353
    5454    public static function tear_down_after_class() {
    55         wp_delete_post( self::$large_id, true );
     55        wp_delete_attachment( self::$large_id, true );
    5656        parent::tear_down_after_class();
    5757    }
     
    13071307
    13081308        // Clean up.
    1309         wp_delete_attachment( $post_id );
     1309        wp_delete_attachment( $post_id, true );
    13101310
    13111311        $this->assertSame( 'This is a comment. / Это комментарий. / Βλέπετε ένα σχόλιο.', $post->post_excerpt );
     
    13461346
    13471347        // Clean up.
    1348         wp_delete_attachment( $post_id );
     1348        wp_delete_attachment( $post_id, true );
    13491349
    13501350        $this->assertSame( 'This is a test', $post->post_title );
     
    17251725
    17261726        // Remove the attachment.
    1727         wp_delete_attachment( $id );
     1727        wp_delete_attachment( $id, true );
    17281728        remove_filter( 'upload_dir', '_upload_dir_no_subdir' );
    17291729    }
     
    28202820
    28212821        // Clean up.
    2822         wp_delete_attachment( $post_id );
    2823         wp_delete_post( $parent_id );
     2822        wp_delete_attachment( $post_id, true );
     2823        wp_delete_post( $parent_id, true );
    28242824
    28252825        $this->assertSame( $expected, $url );
     
    28722872
    28732873        // Clean up.
    2874         wp_delete_attachment( $post_id );
    2875         wp_delete_post( $parent_id );
     2874        wp_delete_attachment( $post_id, true );
     2875        wp_delete_post( $parent_id, true );
    28762876
    28772877        $this->assertSame( $expected, $url );
  • trunk/tests/phpunit/tests/post/thumbnails.php

    r52010 r53464  
    2828
    2929    public static function tear_down_after_class() {
    30         wp_delete_post( self::$attachment_id, true );
     30        wp_delete_attachment( self::$attachment_id, true );
    3131        parent::tear_down_after_class();
    3232    }
  • trunk/tests/phpunit/tests/rest-api/rest-schema-setup.php

    r53152 r53464  
    521521        wp_delete_post( $page_id, true );
    522522        wp_delete_term( $tag_id, 'tags' );
    523         wp_delete_attachment( $media_id );
     523        wp_delete_attachment( $media_id, true );
    524524        wp_delete_comment( $comment_id );
    525525    }
Note: See TracChangeset for help on using the changeset viewer.