Skip to content

Commit

Permalink
Merge pull request woocommerce#16001 from woocommerce/fix/format
Browse files Browse the repository at this point in the history
Fix code formatting
  • Loading branch information
claudiosanches authored Jul 6, 2017
2 parents 74d6c23 + 863193b commit fe9dd86
Show file tree
Hide file tree
Showing 7 changed files with 30 additions and 30 deletions.
4 changes: 2 additions & 2 deletions includes/admin/settings/class-wc-settings-checkout.php
Original file line number Diff line number Diff line change
Expand Up @@ -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() );
Expand Down
2 changes: 1 addition & 1 deletion tests/unit-tests/crud/query.php
Original file line number Diff line number Diff line change
Expand Up @@ -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 );

Expand Down
8 changes: 4 additions & 4 deletions tests/unit-tests/importer/product.php
Original file line number Diff line number Diff line change
Expand Up @@ -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 );
Expand Down Expand Up @@ -421,7 +421,7 @@ public function test_get_parsed_data() {
array(
'value' => array( 'M', 'L' ),
'name' => 'Size',
'default' => 'L'
'default' => 'L',
),
),
),
Expand Down Expand Up @@ -509,8 +509,8 @@ public function test_get_parsed_data() {
),
array(
'value' => array( 'L' ),
'name' => 'Size'
)
'name' => 'Size',
),
),
),
array(
Expand Down
4 changes: 2 additions & 2 deletions tests/unit-tests/order-items/order-item-meta.php
Original file line number Diff line number Diff line change
Expand Up @@ -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,
);
}

Expand Down
2 changes: 1 addition & 1 deletion tests/unit-tests/order/crud.php
Original file line number Diff line number Diff line change
Expand Up @@ -272,7 +272,7 @@ function test_get_items() {
$object->save();
$this->assertCount( 2, $object->get_items() );
}

/**
* Test: get_different_items
*/
Expand Down
4 changes: 2 additions & 2 deletions tests/unit-tests/order/functions.php
Original file line number Diff line number Diff line change
Expand Up @@ -588,15 +588,15 @@ 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();
$order2 = new WC_Order();
$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();
Expand Down
36 changes: 18 additions & 18 deletions tests/unit-tests/order/query.php
Original file line number Diff line number Diff line change
Expand Up @@ -81,30 +81,30 @@ 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 );
$this->assertEquals( 0, count( $query->get_orders() ) );

// 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 );
$this->assertEquals( 0, count( $query->get_orders() ) );

// 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 );
Expand All @@ -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 );
Expand All @@ -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 );
Expand All @@ -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 );
Expand Down Expand Up @@ -162,40 +162,40 @@ 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 );
$this->assertEquals( 0, count( $query->get_orders() ) );

// 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 );
$this->assertEquals( 0, count( $query->get_orders() ) );

// 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 );
Expand All @@ -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 );
Expand All @@ -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 );
Expand All @@ -232,15 +232,15 @@ 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();
$order->set_customer_id( $user_id );
$order->save();

$query = new WC_Order_Query( array(
'customer_id' => $user_id
'customer_id' => $user_id,
) );
$results = $query->get_orders();

Expand Down

0 comments on commit fe9dd86

Please sign in to comment.