PHPCS fixes

This commit is contained in:
Rodrigo Primo 2018-04-20 14:53:06 -03:00
parent c115832c4a
commit c7c82a2335
5 changed files with 153 additions and 124 deletions

View File

@ -69,12 +69,24 @@ class WC_Tests_Product_CSV_Exporter extends WC_Unit_Test_Case {
$expected = 'cat1, cat2, cat3'; $expected = 'cat1, cat2, cat3';
$this->assertEquals( $expected, $exporter->format_term_ids( array( $term1, $term2, $term3 ), 'category' ) ); $this->assertEquals( $expected, $exporter->format_term_ids( array( $term1, $term2, $term3 ), 'category' ) );
wp_insert_category( array( 'cat_ID' => $term2, 'cat_name' => 'cat2', 'category_parent' => $term1 ) ); wp_insert_category(
array(
'cat_ID' => $term2,
'cat_name' => 'cat2',
'category_parent' => $term1,
)
);
$expected = 'cat1, cat1 > cat2, cat3'; $expected = 'cat1, cat1 > cat2, cat3';
$this->assertEquals( $expected, $exporter->format_term_ids( array( $term1, $term2, $term3 ), 'category' ) ); $this->assertEquals( $expected, $exporter->format_term_ids( array( $term1, $term2, $term3 ), 'category' ) );
wp_insert_category( array( 'cat_ID' => $term3, 'cat_name' => 'cat3', 'category_parent' => $term2 ) ); wp_insert_category(
array(
'cat_ID' => $term3,
'cat_name' => 'cat3',
'category_parent' => $term2,
)
);
$expected = 'cat1, cat1 > cat2, cat1 > cat2 > cat3'; $expected = 'cat1, cat1 > cat2, cat1 > cat2 > cat3';
$this->assertEquals( $expected, $exporter->format_term_ids( array( $term1, $term2, $term3 ), 'category' ) ); $this->assertEquals( $expected, $exporter->format_term_ids( array( $term1, $term2, $term3 ), 'category' ) );
} }

View File

@ -135,7 +135,13 @@ class WC_Tests_Product_CSV_Importer extends WC_Unit_Test_Case {
* @since 3.1.0 * @since 3.1.0
*/ */
public function test_get_raw_data() { public function test_get_raw_data() {
$importer = new WC_Product_CSV_Importer( $this->csv_file, array( 'parse' => false, 'lines' => 2 ) ); $importer = new WC_Product_CSV_Importer(
$this->csv_file,
array(
'parse' => false,
'lines' => 2,
)
);
$items = array( $items = array(
array( array(
'simple', 'simple',
@ -571,11 +577,13 @@ class WC_Tests_Product_CSV_Importer extends WC_Unit_Test_Case {
$this->assertEquals( $items, $parsed_data ); $this->assertEquals( $items, $parsed_data );
// Remove temporary products. // Remove temporary products.
$temp_products = get_posts( array( $temp_products = get_posts(
array(
'post_status' => 'importing', 'post_status' => 'importing',
'post_type' => 'product', 'post_type' => 'product',
'fields' => 'ids', 'fields' => 'ids',
) ); )
);
foreach ( $temp_products as $id ) { foreach ( $temp_products as $id ) {
wp_delete_post( $id, true ); wp_delete_post( $id, true );
} }

View File

@ -60,7 +60,10 @@ class WC_Tests_Order_Item_Meta extends WC_Unit_Test_Case {
$meta = new WC_Order_Item_Meta( $item ); $meta = new WC_Order_Item_Meta( $item );
$expected = array( 'regularkey' => '1', 'category' => 'Testing Categories' ); $expected = array(
'regularkey' => '1',
'category' => 'Testing Categories',
);
$actual = wp_list_pluck( $meta->get_formatted(), 'value', 'key' ); $actual = wp_list_pluck( $meta->get_formatted(), 'value', 'key' );
$this->assertEquals( $expected, $actual ); $this->assertEquals( $expected, $actual );

View File

@ -74,7 +74,8 @@ class WC_Test_Privacy_Export extends WC_Unit_Test_Case {
// Do a test export and check response. // Do a test export and check response.
$response = WC_Privacy::customer_data_exporter( 'test1@test.com', 1 ); $response = WC_Privacy::customer_data_exporter( 'test1@test.com', 1 );
$this->assertTrue( $response['done'] ); $this->assertTrue( $response['done'] );
$this->assertEquals( array( $this->assertEquals(
array(
array( array(
'group_id' => 'woocommerce_customer', 'group_id' => 'woocommerce_customer',
'group_label' => 'Customer Data', 'group_label' => 'Customer Data',
@ -134,7 +135,9 @@ class WC_Test_Privacy_Export extends WC_Unit_Test_Case {
), ),
), ),
), ),
), $response['data'] ); ),
$response['data']
);
} }
/** /**

View File

@ -67,7 +67,7 @@ class WC_Tests_Totals extends WC_Unit_Test_Case {
WC_Helper_Shipping::create_simple_flat_rate(); WC_Helper_Shipping::create_simple_flat_rate();
WC()->session->set( 'chosen_shipping_methods', array( 'flat_rate' ) ); WC()->session->set( 'chosen_shipping_methods', array( 'flat_rate' ) );
$coupon = new WC_Coupon; $coupon = new WC_Coupon();
$coupon->set_code( 'test-coupon-10' ); $coupon->set_code( 'test-coupon-10' );
$coupon->set_amount( 10 ); $coupon->set_amount( 10 );
$coupon->set_discount_type( 'percent' ); $coupon->set_discount_type( 'percent' );
@ -131,7 +131,8 @@ class WC_Tests_Totals extends WC_Unit_Test_Case {
* Test get and set items. * Test get and set items.
*/ */
public function test_get_totals() { public function test_get_totals() {
$this->assertEquals( array( $this->assertEquals(
array(
'fees_total' => 40.00, 'fees_total' => 40.00,
'fees_total_tax' => 6.00, 'fees_total_tax' => 6.00,
'items_subtotal' => 40.00, 'items_subtotal' => 40.00,
@ -143,7 +144,9 @@ class WC_Tests_Totals extends WC_Unit_Test_Case {
'shipping_tax_total' => 2, 'shipping_tax_total' => 2,
'discounts_total' => 4.00, 'discounts_total' => 4.00,
'discounts_tax_total' => 0.80, 'discounts_tax_total' => 0.80,
), $this->totals->get_totals() ); ),
$this->totals->get_totals()
);
} }
/** /**