[wp-trac] [WordPress Trac] #63532: Unit Testing: Checking if images already exists before starting tests
WordPress Trac
noreply at wordpress.org
Fri Jun 6 09:09:22 UTC 2025
#63532: Unit Testing: Checking if images already exists before starting tests
-------------------------------------------------+-------------------------
Reporter: SirLouen | Owner: (none)
Type: defect (bug) | Status: reopened
Priority: normal | Milestone: 6.9
Component: Media | Version:
Severity: normal | Resolution:
Keywords: has-test-info has-patch has-unit- | Focuses: tests
tests |
-------------------------------------------------+-------------------------
Comment (by SergeyBiryukov):
Replying to [comment:8 SirLouen]:
> @SergeyBiryukov do you think that the failover I've already implemented
is a good idea?
To clarify [comment:6 my previous comment] (deleting the pre-existing
file), I was thinking of something like this:
{{{
if ( file_exists( $file_path ) ) {
unlink( $file_path );
}
$upload = wp_upload_bits( $file_basename, null, $contents );
}}}
--
Ticket URL: <https://core.trac.wordpress.org/ticket/63532#comment:11>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list