diff --git a/tests/PHPUnit/ApiClient/Factory/AmountFactoryTest.php b/tests/PHPUnit/ApiClient/Factory/AmountFactoryTest.php index 8e96ce26d..d06561293 100644 --- a/tests/PHPUnit/ApiClient/Factory/AmountFactoryTest.php +++ b/tests/PHPUnit/ApiClient/Factory/AmountFactoryTest.php @@ -68,11 +68,11 @@ class AmountFactoryTest extends TestCase $this->assertEquals((float) 1, $result->value()); $this->assertEquals((float) 10, $result->breakdown()->discount()->value()); $this->assertEquals($this->currency, $result->breakdown()->discount()->currency_code()); - $this->assertEquals((float) 9, $result->breakdown()->shipping()->value()); + $this->assertEquals((float) 4, $result->breakdown()->shipping()->value()); $this->assertEquals($this->currency, $result->breakdown()->shipping()->currency_code()); $this->assertEquals((float) 5, $result->breakdown()->item_total()->value()); $this->assertEquals($this->currency, $result->breakdown()->item_total()->currency_code()); - $this->assertEquals((float) 8, $result->breakdown()->tax_total()->value()); + $this->assertEquals((float) 13, $result->breakdown()->tax_total()->value()); $this->assertEquals($this->currency, $result->breakdown()->tax_total()->currency_code()); } @@ -161,7 +161,7 @@ class AmountFactoryTest extends TestCase $result = $this->testee->from_wc_order($order); $this->assertEquals((float) 3, $result->breakdown()->discount()->value()); $this->assertEquals((float) 6, $result->breakdown()->item_total()->value()); - $this->assertEquals((float) 1.5, $result->breakdown()->shipping()->value()); + $this->assertEquals((float) 1, $result->breakdown()->shipping()->value()); $this->assertEquals((float) 100, $result->value()); $this->assertEquals((float) 2, $result->breakdown()->tax_total()->value()); $this->assertEquals($this->currency, $result->breakdown()->discount()->currency_code()); diff --git a/tests/PHPUnit/ApiClient/Factory/ItemFactoryTest.php b/tests/PHPUnit/ApiClient/Factory/ItemFactoryTest.php index ee89d6f5c..9fd8a0aa7 100644 --- a/tests/PHPUnit/ApiClient/Factory/ItemFactoryTest.php +++ b/tests/PHPUnit/ApiClient/Factory/ItemFactoryTest.php @@ -41,6 +41,7 @@ class ItemFactoryTest extends TestCase $cart ->expects('get_cart_contents') ->andReturn($items); + $cart->expects('get_shipping_tax')->andReturn(1); expect('wc_get_price_including_tax') ->with($product) @@ -72,7 +73,7 @@ class ItemFactoryTest extends TestCase $this->assertEquals('name', $item->name()); $this->assertEquals('sku', $item->sku()); $this->assertEquals(1, $item->unit_amount()->value()); - $this->assertEquals(2, $item->tax()->value()); + $this->assertEquals(3, $item->tax()->value()); } public function testFromCartDigitalGood() @@ -102,6 +103,7 @@ class ItemFactoryTest extends TestCase $cart ->expects('get_cart_contents') ->andReturn($items); + $cart->expects('get_shipping_tax')->andReturn(1); expect('wc_get_price_including_tax') ->with($product) @@ -172,6 +174,7 @@ class ItemFactoryTest extends TestCase $order ->expects('get_fees') ->andReturn([]); + $order->expects('get_shipping_tax')->andReturn(1); $result = $testee->from_wc_order($order); $this->assertCount(1, $result); @@ -185,7 +188,7 @@ class ItemFactoryTest extends TestCase $this->assertEquals(1, $item->quantity()); $this->assertEquals(Item::PHYSICAL_GOODS, $item->category()); $this->assertEquals(1, $item->unit_amount()->value()); - $this->assertEquals(2, $item->tax()->value()); + $this->assertEquals(3, $item->tax()->value()); } public function testFromWcOrderDigitalGood() @@ -235,6 +238,7 @@ class ItemFactoryTest extends TestCase $order ->expects('get_fees') ->andReturn([]); + $order->expects('get_shipping_tax')->andReturn(1); $result = $testee->from_wc_order($order); $item = current($result); @@ -293,6 +297,7 @@ class ItemFactoryTest extends TestCase $order ->expects('get_fees') ->andReturn([]); + $order->expects('get_shipping_tax')->andReturn(1); $result = $testee->from_wc_order($order); $item = current($result);