mirror of
https://github.com/woocommerce/woocommerce-paypal-payments.git
synced 2025-09-05 08:59:14 +08:00
Add url
& image_url
to Item
This commit is contained in:
parent
2571d31ad8
commit
f869f98ac1
4 changed files with 96 additions and 4 deletions
|
@ -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],
|
||||
];
|
||||
|
||||
|
|
|
@ -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);
|
||||
/**
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue