Merge pull request #1649 from woocommerce/PCP-1912-include-Item-URL-Image-URL-optional-UPC-in-create-order-call

Include `url` & `image_url` in create order call (1912)
This commit is contained in:
Emili Castells 2023-09-07 09:48:18 +02:00 committed by GitHub
commit b07e1bb18a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 96 additions and 4 deletions

View file

@ -66,7 +66,9 @@ class ItemTest extends TestCase
'description',
$tax,
'sku',
'PHYSICAL_GOODS'
'PHYSICAL_GOODS',
'url',
'image_url'
);
$expected = [
@ -76,6 +78,8 @@ class ItemTest extends TestCase
'description' => 'description',
'sku' => 'sku',
'category' => 'PHYSICAL_GOODS',
'url' => 'url',
'image_url' => 'image_url',
'tax' => [2],
];

View file

@ -52,6 +52,14 @@ class ItemFactoryTest extends TestCase
$woocommerce->session = $session;
$session->shouldReceive('get')->andReturn([]);
when('wp_get_attachment_image_src')->justReturn('image_url');
$product
->expects('get_image_id')
->andReturn(1);
$product
->expects('get_permalink')
->andReturn('url');
$result = $testee->from_wc_cart($cart);
$this->assertCount(1, $result);
@ -107,6 +115,13 @@ class ItemFactoryTest extends TestCase
$woocommerce->session = $session;
$session->shouldReceive('get')->andReturn([]);
when('wp_get_attachment_image_src')->justReturn('image_url');
$product
->expects('get_image_id')
->andReturn(1);
$product
->expects('get_permalink')
->andReturn('url');
$result = $testee->from_wc_cart($cart);
@ -132,6 +147,14 @@ class ItemFactoryTest extends TestCase
expect('wp_strip_all_tags')->andReturnFirstArg();
expect('strip_shortcodes')->andReturnFirstArg();
when('wp_get_attachment_image_src')->justReturn('image_url');
$product
->expects('get_image_id')
->andReturn(1);
$product
->expects('get_permalink')
->andReturn('url');
$item = Mockery::mock(\WC_Order_Item_Product::class);
$item
->expects('get_product')
@ -217,6 +240,14 @@ class ItemFactoryTest extends TestCase
->expects('get_fees')
->andReturn([]);
when('wp_get_attachment_image_src')->justReturn('image_url');
$product
->expects('get_image_id')
->andReturn(1);
$product
->expects('get_permalink')
->andReturn('url');
$result = $testee->from_wc_order($order);
$item = current($result);
/**
@ -271,6 +302,14 @@ class ItemFactoryTest extends TestCase
->expects('get_fees')
->andReturn([]);
when('wp_get_attachment_image_src')->justReturn('image_url');
$product
->expects('get_image_id')
->andReturn(1);
$product
->expects('get_permalink')
->andReturn('url');
$result = $testee->from_wc_order($order);
$item = current($result);
/**