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

Fix attachment unit tests in WordPress 5.7 #8473 #8502

Merged
merged 2 commits into from
Mar 22, 2021
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
14 changes: 7 additions & 7 deletions tests/tests-query-filters.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ public function test_edd_block_attachments_no_attachment_bail() {
public function test_edd_block_attachments_no_parent_bail() {

// Prepare test
$filename = '../assets/images/loading.gif';
$filename = EDD_PLUGIN_DIR . 'assets/images/loading.gif';
$filetype = wp_check_filetype( basename( $filename ), null );
$wp_upload_dir = wp_upload_dir();

Expand All @@ -48,7 +48,7 @@ public function test_edd_block_attachments_no_parent_bail() {
'post_content' => '',
'post_status' => 'inherit'
);
$attach_id = wp_insert_attachment( $attachment, $filename, 0 );
$attach_id = wp_insert_attachment( $attachment, basename( $filename ), 0 );
require_once( ABSPATH . 'wp-admin/includes/image.php' );
$attach_data = wp_generate_attachment_metadata( $attach_id, $filename );
wp_update_attachment_metadata( $attach_id, $attach_data );
Expand Down Expand Up @@ -78,7 +78,7 @@ public function test_edd_block_attachments_no_download_bail() {
'post_status' => 'publish'
) );

$filename = '../assets/images/loading.gif';
$filename = EDD_PLUGIN_DIR . 'assets/images/loading.gif';
$parent_post_id = $parent_post_id;
$filetype = wp_check_filetype( basename( $filename ), null );
$wp_upload_dir = wp_upload_dir();
Expand All @@ -90,7 +90,7 @@ public function test_edd_block_attachments_no_download_bail() {
'post_content' => '',
'post_status' => 'inherit'
);
$attach_id = wp_insert_attachment( $attachment, $filename, $parent_post_id );
$attach_id = wp_insert_attachment( $attachment, basename( $filename ), $parent_post_id );
require_once( ABSPATH . 'wp-admin/includes/image.php' );
$attach_data = wp_generate_attachment_metadata( $attach_id, $filename );
wp_update_attachment_metadata( $attach_id, $attach_data );
Expand Down Expand Up @@ -140,7 +140,7 @@ public function test_edd_block_attachments_not_restricted_bail() {
update_post_meta( $parent_post_id, $key, $value );
}

$filename = '../assets/images/loading.gif';
$filename = EDD_PLUGIN_DIR . 'assets/images/loading.gif';
$parent_post_id = $parent_post_id;
$filetype = wp_check_filetype( basename( $filename ), null );
$wp_upload_dir = wp_upload_dir();
Expand Down Expand Up @@ -202,7 +202,7 @@ public function test_edd_block_attachments_die() {
update_post_meta( $parent_post_id, $key, $value );
}

$filename = '../assets/images/loading.gif';
$filename = EDD_PLUGIN_DIR . 'assets/images/loading.gif';
$parent_post_id = $parent_post_id;
$filetype = wp_check_filetype( basename( $filename ), null );
$wp_upload_dir = wp_upload_dir();
Expand All @@ -214,7 +214,7 @@ public function test_edd_block_attachments_die() {
'post_content' => '',
'post_status' => 'inherit'
);
$attach_id = wp_insert_attachment( $attachment, $filename, $parent_post_id );
$attach_id = wp_insert_attachment( $attachment, basename( $filename ), $parent_post_id );
require_once( ABSPATH . 'wp-admin/includes/image.php' );
$attach_data = wp_generate_attachment_metadata( $attach_id, $filename );
wp_update_attachment_metadata( $attach_id, $attach_data );
Expand Down