Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Copy image, because otherwise it will be deleted. #1005

Merged
merged 1 commit into from
Nov 20, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions tests/class-test-activitypub-post.php
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,17 @@ public function test_block_attachments_with_fallback() {
* @return int|WP_Error The attachment ID on success. The value 0 or WP_Error on failure.
*/
public function create_upload_object( $file, $parent_id = 0 ) {
if ( ! class_exists( 'WP_Filesystem_Direct' ) ) {
require ABSPATH . 'wp-admin/includes/class-wp-filesystem-base.php';
require ABSPATH . 'wp-admin/includes/class-wp-filesystem-direct.php';
}

$dest = dirname( $file ) . DIRECTORY_SEPARATOR . 'test-temp.jpg';
$fs = new \WP_Filesystem_Direct( array() );
$fs->copy( $file, $dest );

$file = $dest;

$file_array = array(
'name' => wp_basename( $file ),
'tmp_name' => $file,
Expand Down
Loading