From f4ecafcc8ebe5caee3fcb6394e064145b9bcc462 Mon Sep 17 00:00:00 2001 From: vendidero Date: Mon, 23 Sep 2024 17:49:34 +0200 Subject: [PATCH] tests --- .../framework/helpers/class-wc-gzd-helper-product.php | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/tests/framework/helpers/class-wc-gzd-helper-product.php b/tests/framework/helpers/class-wc-gzd-helper-product.php index f98df349..98fbb2ef 100644 --- a/tests/framework/helpers/class-wc-gzd-helper-product.php +++ b/tests/framework/helpers/class-wc-gzd-helper-product.php @@ -69,8 +69,8 @@ public static function create_allergen() { return $term; } - public static function create_attachment( $name = 'woocommerce-placeholder' ) { - $attachment = get_page_by_path( $name, 'OBJECT', 'attachment' ); + public static function create_attachment() { + $attachment = get_page_by_path( 'woocommerce-placeholder', 'OBJECT', 'attachment' ); if ( ! is_a( $attachment, 'WP_Post' ) ) { $upload_dir = wp_upload_dir(); @@ -84,9 +84,8 @@ public static function create_attachment( $name = 'woocommerce-placeholder' ) { $filetype = wp_check_filetype( basename( $filename ), null ); $attachment = array( 'guid' => $upload_dir['url'] . '/' . basename( $filename ), - 'post_mime_type' => $filetype, + 'post_mime_type' => $filetype['type'], 'post_title' => preg_replace( '/\.[^.]+$/', '', basename( $filename ) ), - 'post_name' => $name, 'post_content' => '', 'post_status' => 'inherit', ); @@ -159,6 +158,9 @@ public static function create_simple_product() { 'ref_value' => 22.1, ), ), + '_safety_attachment_ids' => array( + $attachment + ), '_allergen_ids' => array( $allergen->term_id, ),