Skip to content

Commit 11e20b7

Browse files
committed
fix tests
1 parent ac3cd32 commit 11e20b7

File tree

1 file changed

+27
-30
lines changed

1 file changed

+27
-30
lines changed

tests/includes/API/Test_Order_Taxes.php

Lines changed: 27 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@
22

33
namespace WCPOS\WooCommercePOS\Tests\API;
44

5+
use WC_Admin_Settings;
56
use WCPOS\WooCommercePOS\API\Orders_Controller;
67
use WCPOS\WooCommercePOS\Tests\Helpers\TaxHelper;
7-
use WC_Admin_Settings;
88

99
/**
1010
* @internal
@@ -21,26 +21,26 @@ public function setup(): void {
2121
// Set default address
2222
// update_option( 'woocommerce_default_country', 'GB' );
2323

24-
/**
24+
/*
2525
* Init Taxes
2626
*
2727
* use WooCommerce Tax Dummy Data
2828
*/
2929
TaxHelper::create_tax_rate(
3030
array(
31-
'country' => 'GB',
32-
'rate' => '20.000',
33-
'name' => 'VAT',
31+
'country' => 'GB',
32+
'rate' => '20.000',
33+
'name' => 'VAT',
3434
'priority' => 1,
3535
'compound' => true,
3636
'shipping' => true,
3737
)
3838
);
3939
TaxHelper::create_tax_rate(
4040
array(
41-
'country' => 'GB',
42-
'rate' => '5.000',
43-
'name' => 'VAT',
41+
'country' => 'GB',
42+
'rate' => '5.000',
43+
'name' => 'VAT',
4444
'priority' => 1,
4545
'compound' => true,
4646
'shipping' => true,
@@ -49,9 +49,9 @@ public function setup(): void {
4949
);
5050
TaxHelper::create_tax_rate(
5151
array(
52-
'country' => 'GB',
53-
'rate' => '0.000',
54-
'name' => 'VAT',
52+
'country' => 'GB',
53+
'rate' => '0.000',
54+
'name' => 'VAT',
5555
'priority' => 1,
5656
'compound' => true,
5757
'shipping' => true,
@@ -60,21 +60,21 @@ public function setup(): void {
6060
);
6161
TaxHelper::create_tax_rate(
6262
array(
63-
'country' => 'US',
64-
'rate' => '10.000',
65-
'name' => 'US',
63+
'country' => 'US',
64+
'rate' => '10.000',
65+
'name' => 'US',
6666
'priority' => 1,
6767
'compound' => true,
6868
'shipping' => true,
6969
)
7070
);
7171
TaxHelper::create_tax_rate(
7272
array(
73-
'country' => 'US',
74-
'state' => 'AL',
73+
'country' => 'US',
74+
'state' => 'AL',
7575
'postcode' => '12345; 123456',
76-
'rate' => '2.000',
77-
'name' => 'US AL',
76+
'rate' => '2.000',
77+
'name' => 'US AL',
7878
'priority' => 2,
7979
'compound' => true,
8080
'shipping' => true,
@@ -127,7 +127,7 @@ public function test_create_order_with_tax(): void {
127127
// line item taxes
128128
$this->assertEquals( 1, \count( $data['line_items'] ) );
129129
$this->assertEquals( 1, \count( $data['line_items'][0]['taxes'] ) );
130-
$this->assertEquals( '1', $data['line_items'][0]['taxes'][0]['total'] );
130+
$this->assertEquals( '1.000000', $data['line_items'][0]['taxes'][0]['total'] );
131131

132132
// order taxes
133133
$this->assertEquals( 1, \count( $data['tax_lines'] ) );
@@ -184,7 +184,7 @@ public function test_create_order_with_customer_billing_address_as_tax_location(
184184
$this->assertEquals( 201, $response->get_status() );
185185

186186
// check meta data
187-
$count = 0;
187+
$count = 0;
188188
$tax_based_on = '';
189189

190190
// Look for the _woocommerce_pos_uuid key in meta_data
@@ -201,7 +201,7 @@ public function test_create_order_with_customer_billing_address_as_tax_location(
201201
// line item taxes
202202
$this->assertEquals( 1, \count( $data['line_items'] ) );
203203
$this->assertEquals( 1, \count( $data['line_items'][0]['taxes'] ) );
204-
$this->assertEquals( '2', $data['line_items'][0]['taxes'][0]['total'] );
204+
$this->assertEquals( '2.000000', $data['line_items'][0]['taxes'][0]['total'] );
205205

206206
// order taxes
207207
$this->assertEquals( 1, \count( $data['tax_lines'] ) );
@@ -251,7 +251,7 @@ public function test_create_order_with_customer_shipping_address_as_tax_location
251251
$this->assertEquals( 201, $response->get_status() );
252252

253253
// check meta data
254-
$count = 0;
254+
$count = 0;
255255
$tax_based_on = '';
256256

257257
// Look for the _woocommerce_pos_uuid key in meta_data
@@ -268,8 +268,8 @@ public function test_create_order_with_customer_shipping_address_as_tax_location
268268
// line item taxes
269269
$this->assertEquals( 1, \count( $data['line_items'] ) );
270270
$this->assertEquals( 2, \count( $data['line_items'][0]['taxes'] ) );
271-
$this->assertEquals( '1', $data['line_items'][0]['taxes'][0]['total'] );
272-
$this->assertEquals( '0.22', $data['line_items'][0]['taxes'][1]['total'] );
271+
$this->assertEquals( '1.000000', $data['line_items'][0]['taxes'][0]['total'] );
272+
$this->assertEquals( '0.220000', $data['line_items'][0]['taxes'][1]['total'] );
273273

274274
// order taxes
275275
$this->assertEquals( 2, \count( $data['tax_lines'] ) );
@@ -286,10 +286,7 @@ public function test_create_order_with_customer_shipping_address_as_tax_location
286286
$this->assertEquals( '1.220000', $data['total_tax'] );
287287
}
288288

289-
/**
290-
*
291-
*/
292-
public function test_fee_lines_should_respect_tax_status_when_negative() {
289+
public function test_fee_lines_should_respect_tax_status_when_negative(): void {
293290
$this->assertEquals( 'base', WC_Admin_Settings::get_option( 'woocommerce_tax_based_on' ) );
294291
$this->assertEquals( 'US:CA', WC_Admin_Settings::get_option( 'woocommerce_default_country' ) );
295292

@@ -306,8 +303,8 @@ public function test_fee_lines_should_respect_tax_status_when_negative() {
306303
),
307304
'fee_lines' => array(
308305
array(
309-
'name' => 'Fee',
310-
'total' => '-10',
306+
'name' => 'Fee',
307+
'total' => '-10',
311308
'tax_status' => 'none',
312309
),
313310
),

0 commit comments

Comments
 (0)