diff --git a/includes/admin/settings/class-wc-settings-checkout.php b/includes/admin/settings/class-wc-settings-checkout.php index 8b00c2ef1af6c..85c5cd9b1c4fa 100644 --- a/includes/admin/settings/class-wc-settings-checkout.php +++ b/includes/admin/settings/class-wc-settings-checkout.php @@ -362,8 +362,8 @@ public function save() { if ( ! $current_section ) { // Prevent the T&Cs and checkout page from being set to the same page. - if ( isset( $_POST[ 'woocommerce_terms_page_id' ], $_POST[ 'woocommerce_checkout_page_id' ] ) && $_POST[ 'woocommerce_terms_page_id' ] === $_POST[ 'woocommerce_checkout_page_id' ] ) { - $_POST[ 'woocommerce_terms_page_id' ] = ''; + if ( isset( $_POST['woocommerce_terms_page_id'], $_POST['woocommerce_checkout_page_id'] ) && $_POST['woocommerce_terms_page_id'] === $_POST['woocommerce_checkout_page_id'] ) { + $_POST['woocommerce_terms_page_id'] = ''; } WC_Admin_Settings::save_fields( $this->get_settings() ); diff --git a/tests/unit-tests/crud/query.php b/tests/unit-tests/crud/query.php index 37c2cfcf65c93..2950bc90206c7 100644 --- a/tests/unit-tests/crud/query.php +++ b/tests/unit-tests/crud/query.php @@ -27,7 +27,7 @@ function test_default_query() { */ function test_query_with_args() { $args = array( - 'limit' => 15 + 'limit' => 15, ); $query = new WC_Mock_WC_Object_Query( $args ); diff --git a/tests/unit-tests/importer/product.php b/tests/unit-tests/importer/product.php index 0270ce9788405..3f793a4cd3c20 100644 --- a/tests/unit-tests/importer/product.php +++ b/tests/unit-tests/importer/product.php @@ -240,7 +240,7 @@ public function test_get_raw_data() { public function test_get_parsed_data() { $args = array( 'mapping' => $this->get_csv_mapped_items(), - 'parse' => true + 'parse' => true, ); $importer = new WC_Product_CSV_Importer( $this->csv_file, $args ); @@ -421,7 +421,7 @@ public function test_get_parsed_data() { array( 'value' => array( 'M', 'L' ), 'name' => 'Size', - 'default' => 'L' + 'default' => 'L', ), ), ), @@ -509,8 +509,8 @@ public function test_get_parsed_data() { ), array( 'value' => array( 'L' ), - 'name' => 'Size' - ) + 'name' => 'Size', + ), ), ), array( diff --git a/tests/unit-tests/order-items/order-item-meta.php b/tests/unit-tests/order-items/order-item-meta.php index 5ade47662bb5a..f0992a2a6af6b 100644 --- a/tests/unit-tests/order-items/order-item-meta.php +++ b/tests/unit-tests/order-items/order-item-meta.php @@ -27,11 +27,11 @@ public function test_multiple_meta_values() { $meta = new WC_Order_Item_Meta( $item ); $expected = array(); - foreach( $item->get_meta_data() as $metadata ) { + foreach ( $item->get_meta_data() as $metadata ) { $expected[ $metadata->id ] = array( 'key' => $metadata->key, 'label' => wc_attribute_label( $metadata->key, null ), - 'value' => $metadata->value + 'value' => $metadata->value, ); } diff --git a/tests/unit-tests/order/crud.php b/tests/unit-tests/order/crud.php index a9be18146ddb7..204824240a266 100644 --- a/tests/unit-tests/order/crud.php +++ b/tests/unit-tests/order/crud.php @@ -272,7 +272,7 @@ function test_get_items() { $object->save(); $this->assertCount( 2, $object->get_items() ); } - + /** * Test: get_different_items */ diff --git a/tests/unit-tests/order/functions.php b/tests/unit-tests/order/functions.php index 31d41d71d076b..c1145fa0a299e 100644 --- a/tests/unit-tests/order/functions.php +++ b/tests/unit-tests/order/functions.php @@ -588,7 +588,7 @@ public function test_wc_get_order_price_price_params() { $order1->set_discount_total( 5.50 ); $order1->set_discount_tax( 0.50 ); $order1->set_shipping_total( 3.99 ); - $order1->set_shipping_tax( 0.25); + $order1->set_shipping_tax( 0.25 ); $order1->set_cart_tax( 0.10 ); $order1->set_total( 10.34 ); $order1->save(); @@ -596,7 +596,7 @@ public function test_wc_get_order_price_price_params() { $order2->set_discount_total( 2.50 ); $order2->set_discount_tax( 0.20 ); $order2->set_shipping_total( 2.99 ); - $order2->set_shipping_tax( 0.15); + $order2->set_shipping_tax( 0.15 ); $order2->set_cart_tax( 0.05 ); $order2->set_total( 5.89 ); $order2->save(); diff --git a/tests/unit-tests/order/query.php b/tests/unit-tests/order/query.php index c010ab52d17d2..3da8cfc40c497 100644 --- a/tests/unit-tests/order/query.php +++ b/tests/unit-tests/order/query.php @@ -81,14 +81,14 @@ public function test_order_query_date_queries() { // Check WC_DateTime support. $query = new WC_Order_Query( array( - 'date_created' => $order->get_date_created() + 'date_created' => $order->get_date_created(), ) ); $orders = $query->get_orders(); $this->assertEquals( 1, count( $orders ) ); // Check date support. $query = new WC_Order_Query( array( - 'date_created' => $now_date + 'date_created' => $now_date, ) ); $this->assertEquals( 1, count( $query->get_orders() ) ); $query->set( 'date_created', $past ); @@ -96,7 +96,7 @@ public function test_order_query_date_queries() { // Check timestamp support. $query = new WC_Order_Query( array( - 'date_created' => $order->get_date_created()->getTimestamp() + 'date_created' => $order->get_date_created()->getTimestamp(), ) ); $this->assertEquals( 1, count( $query->get_orders() ) ); $query->set( 'date_created', $future_stamp ); @@ -104,7 +104,7 @@ public function test_order_query_date_queries() { // Check comparison support. $query = new WC_Order_Query( array( - 'date_created' => '>' . $past + 'date_created' => '>' . $past, ) ); $this->assertEquals( 1, count( $query->get_orders() ) ); $query->set( 'date_created', '<' . $past ); @@ -114,7 +114,7 @@ public function test_order_query_date_queries() { // Check timestamp comparison support. $query = new WC_Order_Query( array( - 'date_created' => '<' . $future_stamp + 'date_created' => '<' . $future_stamp, ) ); $this->assertEquals( 1, count( $query->get_orders() ) ); $query->set( 'date_created', '<' . $past_stamp ); @@ -123,7 +123,7 @@ public function test_order_query_date_queries() { // Check date range support. $query = new WC_Order_Query( array( - 'date_created' => $past . '...' . $future + 'date_created' => $past . '...' . $future, ) ); $this->assertEquals( 1, count( $query->get_orders() ) ); $query->set( 'date_created', $past . '...' . $now_date ); @@ -133,7 +133,7 @@ public function test_order_query_date_queries() { // Check timestamp range support. $query = new WC_Order_Query( array( - 'date_created' => $past_stamp . '...' . $future_stamp + 'date_created' => $past_stamp . '...' . $future_stamp, ) ); $this->assertEquals( 1, count( $query->get_orders() ) ); $query->set( 'date_created', $now_stamp . '...' . $future_stamp ); @@ -162,14 +162,14 @@ public function test_order_query_meta_date_queries() { // Check WC_DateTime support. $query = new WC_Order_Query( array( - 'date_completed' => $order->get_date_completed() + 'date_completed' => $order->get_date_completed(), ) ); $orders = $query->get_orders(); $this->assertEquals( 1, count( $orders ) ); // Check date support. $query = new WC_Order_Query( array( - 'date_completed' => $now_date + 'date_completed' => $now_date, ) ); $this->assertEquals( 1, count( $query->get_orders() ) ); $query->set( 'date_completed', $past ); @@ -177,7 +177,7 @@ public function test_order_query_meta_date_queries() { // Check timestamp support. $query = new WC_Order_Query( array( - 'date_completed' => $order->get_date_completed()->getTimestamp() + 'date_completed' => $order->get_date_completed()->getTimestamp(), ) ); $this->assertEquals( 1, count( $query->get_orders() ) ); $query->set( 'date_completed', $future_stamp ); @@ -185,17 +185,17 @@ public function test_order_query_meta_date_queries() { // Check comparison support. $query = new WC_Order_Query( array( - 'date_completed' => '>' . $past + 'date_completed' => '>' . $past, ) ); - //$this->assertEquals( 1, count( $query->get_orders() ) ); + $this->assertEquals( 1, count( $query->get_orders() ) ); $query->set( 'date_completed', '<' . $past ); - //$this->assertEquals( 0, count( $query->get_orders() ) ); + $this->assertEquals( 0, count( $query->get_orders() ) ); $query->set( 'date_completed', '>=' . $now_date ); $this->assertEquals( 1, count( $query->get_orders() ) ); // Check timestamp comparison support. $query = new WC_Order_Query( array( - 'date_completed' => '<' . $future_stamp + 'date_completed' => '<' . $future_stamp, ) ); $this->assertEquals( 1, count( $query->get_orders() ) ); $query->set( 'date_completed', '<' . $past_stamp ); @@ -204,7 +204,7 @@ public function test_order_query_meta_date_queries() { // Check date range support. $query = new WC_Order_Query( array( - 'date_completed' => $past . '...' . $future + 'date_completed' => $past . '...' . $future, ) ); $this->assertEquals( 1, count( $query->get_orders() ) ); $query->set( 'date_completed', $now_date . '...' . $future ); @@ -214,7 +214,7 @@ public function test_order_query_meta_date_queries() { // Check timestamp range support. $query = new WC_Order_Query( array( - 'date_completed' => $past_stamp . '...' . $future_stamp + 'date_completed' => $past_stamp . '...' . $future_stamp, ) ); $this->assertEquals( 1, count( $query->get_orders() ) ); $query->set( 'date_completed', $now_stamp . '...' . $future_stamp ); @@ -232,7 +232,7 @@ public function test_order_query_key_mapping() { $user_id = wp_insert_user( array( 'user_login' => 'testname', 'user_pass' => 'testpass', - 'user_email' => 'email@testmail.com' + 'user_email' => 'email@testmail.com', ) ); $order = new WC_Order(); @@ -240,7 +240,7 @@ public function test_order_query_key_mapping() { $order->save(); $query = new WC_Order_Query( array( - 'customer_id' => $user_id + 'customer_id' => $user_id, ) ); $results = $query->get_orders();