Make WordPress Core

Changeset 57583


Ignore:
Timestamp:
02/11/2024 05:02:46 PM (5 months ago)
Author:
SergeyBiryukov
Message:

Tests: Adjust the meta key time in wp_scheduled_delete() tests.

Occasionally, the tests verifying that old trashed posts or comments are not deleted if not old enough can take longer than expected, leading to false positives when comparing the timestamp in wp_scheduled_delete(), and resulting in subsequent test failures.

This commit aims to resolve the race condition.

Follow-up to [57224], [57237].

See #59938.

File:
1 edited

Legend:

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

    r57237 r57583  
    8888            )
    8989        );
    90         add_post_meta( self::$page_id, '_wp_trash_meta_time', time() - ( DAY_IN_SECONDS * EMPTY_TRASH_DAYS ) );
     90        add_post_meta( self::$page_id, '_wp_trash_meta_time', time() - ( DAY_IN_SECONDS * EMPTY_TRASH_DAYS - 1 ) );
    9191        add_post_meta( self::$page_id, '_wp_trash_meta_status', 'published' );
    9292
     
    158158            )
    159159        );
    160         add_comment_meta( self::$comment_id, '_wp_trash_meta_time', time() - ( DAY_IN_SECONDS * EMPTY_TRASH_DAYS ) );
     160        add_comment_meta( self::$comment_id, '_wp_trash_meta_time', time() - ( DAY_IN_SECONDS * EMPTY_TRASH_DAYS - 1 ) );
    161161        add_comment_meta( self::$comment_id, '_wp_trash_meta_status', 'published' );
    162162
Note: See TracChangeset for help on using the changeset viewer.