mirror of
https://github.com/woocommerce/woocommerce-paypal-payments.git
synced 2025-09-05 08:59:14 +08:00
Fix phpunit
This commit is contained in:
parent
e9cf818799
commit
372884ce16
2 changed files with 33 additions and 1 deletions
|
@ -31,6 +31,9 @@ class ItemFactoryTest extends TestCase
|
|||
$product
|
||||
->expects('is_virtual')
|
||||
->andReturn(false);
|
||||
$product
|
||||
->expects('get_tax_class')
|
||||
->andReturn('');
|
||||
$items = [
|
||||
[
|
||||
'data' => $product,
|
||||
|
@ -58,6 +61,9 @@ class ItemFactoryTest extends TestCase
|
|||
$woocommerce->session = $session;
|
||||
$session->shouldReceive('get')->andReturn([]);
|
||||
|
||||
$tax = Mockery::mock('alias:WC_Tax');
|
||||
$tax->expects('get_rates')->andReturn([]);
|
||||
|
||||
$result = $testee->from_wc_cart($cart);
|
||||
|
||||
$this->assertCount(1, $result);
|
||||
|
@ -92,6 +98,10 @@ class ItemFactoryTest extends TestCase
|
|||
$product
|
||||
->expects('is_virtual')
|
||||
->andReturn(true);
|
||||
$product
|
||||
->expects('get_tax_class')
|
||||
->andReturn('');
|
||||
|
||||
$items = [
|
||||
[
|
||||
'data' => $product,
|
||||
|
@ -119,6 +129,9 @@ class ItemFactoryTest extends TestCase
|
|||
$woocommerce->session = $session;
|
||||
$session->shouldReceive('get')->andReturn([]);
|
||||
|
||||
$tax = Mockery::mock('alias:WC_Tax');
|
||||
$tax->expects('get_rates')->andReturn([]);
|
||||
|
||||
$result = $testee->from_wc_cart($cart);
|
||||
|
||||
$item = current($result);
|
||||
|
@ -139,6 +152,9 @@ class ItemFactoryTest extends TestCase
|
|||
$product
|
||||
->expects('get_sku')
|
||||
->andReturn('sku');
|
||||
$product
|
||||
->expects('get_tax_class')
|
||||
->andReturn('foo');
|
||||
$product
|
||||
->expects('is_virtual')
|
||||
->andReturn(false);
|
||||
|
@ -173,6 +189,9 @@ class ItemFactoryTest extends TestCase
|
|||
->expects('get_fees')
|
||||
->andReturn([]);
|
||||
|
||||
$tax = Mockery::mock('alias:WC_Tax');
|
||||
$tax->expects('get_rates')->andReturn([]);
|
||||
|
||||
$result = $testee->from_wc_order($order);
|
||||
$this->assertCount(1, $result);
|
||||
$item = current($result);
|
||||
|
@ -205,6 +224,10 @@ class ItemFactoryTest extends TestCase
|
|||
$product
|
||||
->expects('is_virtual')
|
||||
->andReturn(true);
|
||||
$product
|
||||
->expects('get_tax_class')
|
||||
->andReturn('foo');
|
||||
|
||||
expect('wp_strip_all_tags')
|
||||
->with('description')
|
||||
->andReturn('description');
|
||||
|
@ -236,6 +259,9 @@ class ItemFactoryTest extends TestCase
|
|||
->expects('get_fees')
|
||||
->andReturn([]);
|
||||
|
||||
$tax = Mockery::mock('alias:WC_Tax');
|
||||
$tax->expects('get_rates')->andReturn([]);
|
||||
|
||||
$result = $testee->from_wc_order($order);
|
||||
$item = current($result);
|
||||
/**
|
||||
|
@ -263,6 +289,10 @@ class ItemFactoryTest extends TestCase
|
|||
$product
|
||||
->expects('is_virtual')
|
||||
->andReturn(true);
|
||||
$product
|
||||
->expects('get_tax_class')
|
||||
->andReturn('foo');
|
||||
|
||||
expect('wp_strip_all_tags')
|
||||
->with($description)
|
||||
->andReturn(mb_substr( $description, 0, 127 ));
|
||||
|
@ -294,6 +324,9 @@ class ItemFactoryTest extends TestCase
|
|||
->expects('get_fees')
|
||||
->andReturn([]);
|
||||
|
||||
$tax = Mockery::mock('alias:WC_Tax');
|
||||
$tax->expects('get_rates')->andReturn([]);
|
||||
|
||||
$result = $testee->from_wc_order($order);
|
||||
$item = current($result);
|
||||
/**
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue