Skip to content

Commit

Permalink
(general cleanup) converted spacing to tabs, removed extra spaces and…
Browse files Browse the repository at this point in the history
… tabs at file ends
  • Loading branch information
thisismyurl committed Nov 28, 2016
1 parent 567d755 commit 9868144
Show file tree
Hide file tree
Showing 358 changed files with 38,318 additions and 38,318 deletions.
44 changes: 22 additions & 22 deletions tests/test-wpsc-country.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,23 +3,23 @@
class TestWPSCCountryClass extends WP_UnitTestCase {

// The main country used for tests, has no regions.
const COUNTRY_ID_WITHOUT_REGIONS = 223;
const COUNTRY_ISOCODE_WITHOUT_REGIONS = 'GB';
const COUNTRY_NAME_WITHOUT_REGIONS = 'United Kingdom';
const COUNTRY_NAME_WITHOUT_REGIONS_CURRENCY_CODE = 'GBP';
const COUNTRY_NAME_WITHOUT_REGIONS_CURRENCY_NAME = 'Pound Sterling';
const COUNTRY_NAME_WITHOUT_REGIONS_CURRENCY_SYMBOL = '£';
const COUNTRY_ID_WITHOUT_REGIONS = 223;
const COUNTRY_ISOCODE_WITHOUT_REGIONS = 'GB';
const COUNTRY_NAME_WITHOUT_REGIONS = 'United Kingdom';
const COUNTRY_NAME_WITHOUT_REGIONS_CURRENCY_CODE = 'GBP';
const COUNTRY_NAME_WITHOUT_REGIONS_CURRENCY_NAME = 'Pound Sterling';
const COUNTRY_NAME_WITHOUT_REGIONS_CURRENCY_SYMBOL = '£';
const COUNTRY_NAME_WITHOUT_REGIONS_CURRENCY_SYMBOL_HTML = '£';
const COUNTRY_WITHOUT_REGIONS_TAX_RATE = 17.5;
const COUNTRY_WITHOUT_REGIONS_CONTINENT = 'europe';
const COUNTRY_WITHOUT_REGIONS_TAX_RATE = 17.5;
const COUNTRY_WITHOUT_REGIONS_CONTINENT = 'europe';

// A country with regions used for tests that need a region.
const COUNTRY_ID_WITH_REGIONS = 136;
const REGION_ID = 50;
const NUM_REGIONS = 51;
const REGION_CODE = 'OR';
const REGION_NAME = 'Oregon';
const INVALID_REGION_NAME = 'Oregano';
const REGION_ID = 50;
const NUM_REGIONS = 51;
const REGION_CODE = 'OR';
const REGION_NAME = 'Oregon';
const INVALID_REGION_NAME = 'Oregano';

function setUp() {
wpsc_create_or_update_tables();
Expand Down Expand Up @@ -70,48 +70,48 @@ function test_get_currency() {
}

function test_get_currency_name() {
$country = new WPSC_Country( self::COUNTRY_ID_WITHOUT_REGIONS );
$country = new WPSC_Country( self::COUNTRY_ID_WITHOUT_REGIONS );
$currency_name = $country->get_currency_name();
$this->assertEquals( self::COUNTRY_NAME_WITHOUT_REGIONS_CURRENCY_NAME, $currency_name );
}

function test_get_currency_symbol() {
$country = new WPSC_Country( self::COUNTRY_ID_WITHOUT_REGIONS );
$country = new WPSC_Country( self::COUNTRY_ID_WITHOUT_REGIONS );
$currency_symbol = $country->get_currency_symbol();
$this->assertEquals( self::COUNTRY_NAME_WITHOUT_REGIONS_CURRENCY_SYMBOL, $currency_symbol );
}

function test_get_currency_symbol_html() {
$country = new WPSC_Country( self::COUNTRY_ID_WITHOUT_REGIONS );
$country = new WPSC_Country( self::COUNTRY_ID_WITHOUT_REGIONS );
$currency_symbol = $country->get_currency_symbol_html();
$this->assertEquals( self::COUNTRY_NAME_WITHOUT_REGIONS_CURRENCY_SYMBOL_HTML, $currency_symbol );
}

function test_get_currency_code() {
$country = new WPSC_Country( self::COUNTRY_ID_WITHOUT_REGIONS );
$country = new WPSC_Country( self::COUNTRY_ID_WITHOUT_REGIONS );
$currency_code = $country->get_currency_code();
$this->assertEquals( self::COUNTRY_NAME_WITHOUT_REGIONS_CURRENCY_CODE, $currency_code );
}

function test_has_regions() {
$country = new WPSC_Country( self::COUNTRY_ID_WITHOUT_REGIONS );
$country = new WPSC_Country( self::COUNTRY_ID_WITHOUT_REGIONS );
$has_regions = $country->has_regions();
$this->assertFalse( $has_regions );
$country = new WPSC_Country( self::COUNTRY_ID_WITH_REGIONS ); // USA
$country = new WPSC_Country( self::COUNTRY_ID_WITH_REGIONS ); // USA
$has_regions = $country->has_regions();
$this->assertTrue( $has_regions );
}

function test_has_region() {
// UK
$country = new WPSC_Country( self::COUNTRY_ID_WITHOUT_REGIONS );
$country = new WPSC_Country( self::COUNTRY_ID_WITHOUT_REGIONS );
$has_region = $country->has_region( self::REGION_ID );
$this->assertFalse( $has_region ); // Oregon is not in the UK
$has_region = $country->has_region( -1 );
$this->assertFalse( $has_region ); // Non-existent region is not in the UK

// USA
$country = new WPSC_Country( self::COUNTRY_ID_WITH_REGIONS );
$country = new WPSC_Country( self::COUNTRY_ID_WITH_REGIONS );
$has_region = $country->has_region( self::REGION_ID );
$this->assertTrue( $has_region ); // Oregon is in the USA
$has_region = $country->has_region( self::REGION_NAME );
Expand All @@ -124,7 +124,7 @@ function test_has_region() {

function test_get_tax() {
$country = new WPSC_Country( self::COUNTRY_ID_WITHOUT_REGIONS );
$tax = $country->get_tax();
$tax = $country->get_tax();
$this->assertEquals( self::COUNTRY_WITHOUT_REGIONS_TAX_RATE, $tax );
}

Expand Down
168 changes: 84 additions & 84 deletions tests/test-wpsc-coupon.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,22 +5,22 @@ class TestWPSCCouponClass extends WP_UnitTestCase {
const START_DATE = '2015-03-06';
const EXPIRY_DATE = '2015-04-16';

const PERCENTAGE_COUPON_ID = 1;
const PERCENTAGE_COUPON_CODE = 'TEST_PERCENTAGE';
const FIXED_COUPON_ID = 2;
const FIXED_COUPON_CODE = 'TEST_FIXED';
const PERCENTAGE_COUPON_ID = 1;
const PERCENTAGE_COUPON_CODE = 'TEST_PERCENTAGE';
const FIXED_COUPON_ID = 2;
const FIXED_COUPON_CODE = 'TEST_FIXED';
const FREE_SHIPPING_COUPON_ID = 3;
const FREE_SHIPPING_COUPON_CODE = 'TEST_FREE_SHIPPING';
const USE_ONCE_COUPON_ID = 4;
const USE_ONCE_COUPON_CODE = 'TEST_USE_ONCE';
const EXPIRY_COUPON_ID = 5;
const EXPIRY_COUPON_CODE = 'TEST_EXPIRY';
const DELETE_COUPON_ID = 6;
const DELETE_COUPON_CODE = 'TEST_DELETE';
const CONDITIONS_COUPON_ID = 7;
const CONDITIONS_COUPON_CODE = 'TEST_CONDITIONS';
const ACTIVE_COUPON_ID = 8;
const ACTIVE_COUPON_CODE = 'TEST_ACTIVE';
const USE_ONCE_COUPON_ID = 4;
const USE_ONCE_COUPON_CODE = 'TEST_USE_ONCE';
const EXPIRY_COUPON_ID = 5;
const EXPIRY_COUPON_CODE = 'TEST_EXPIRY';
const DELETE_COUPON_ID = 6;
const DELETE_COUPON_CODE = 'TEST_DELETE';
const CONDITIONS_COUPON_ID = 7;
const CONDITIONS_COUPON_CODE = 'TEST_CONDITIONS';
const ACTIVE_COUPON_ID = 8;
const ACTIVE_COUPON_CODE = 'TEST_ACTIVE';

function setUp() {
wpsc_create_or_update_tables();
Expand All @@ -39,115 +39,115 @@ function setup_test_data() {
$truncate = $wpdb->query( "TRUNCATE TABLE `" . WPSC_TABLE_COUPON_CODES . "`" );

$wpdb->insert( WPSC_TABLE_COUPON_CODES, array(
'id' => self::PERCENTAGE_COUPON_ID,
'id' => self::PERCENTAGE_COUPON_ID,
'coupon_code' => self::PERCENTAGE_COUPON_CODE,
'value' => '50',
'value' => '50',
'is-percentage' => 1,
'use-once' => 0,
'is-used' => 0,
'active' => 1,
'use-once' => 0,
'is-used' => 0,
'active' => 1,
'every_product' => 0,
'start' => '0000-00-00',
'expiry' => '0000-00-00',
'condition' => serialize( array() )
'start' => '0000-00-00',
'expiry' => '0000-00-00',
'condition' => serialize( array() )
), array( '%d', '%s', '%s', '%d', '%d', '%d', '%d', '%d', '%s', '%s', '%s' ) );

$wpdb->insert( WPSC_TABLE_COUPON_CODES, array(
'id' => self::FIXED_COUPON_ID,
'id' => self::FIXED_COUPON_ID,
'coupon_code' => self::FIXED_COUPON_CODE,
'value' => '5',
'value' => '5',
'is-percentage' => 0,
'use-once' => 0,
'is-used' => 0,
'active' => 1,
'use-once' => 0,
'is-used' => 0,
'active' => 1,
'every_product' => 0,
'start' => '0000-00-00',
'expiry' => '0000-00-00',
'condition' => serialize( array() )
'start' => '0000-00-00',
'expiry' => '0000-00-00',
'condition' => serialize( array() )
), array( '%d', '%s', '%s', '%d', '%d', '%d', '%d', '%d', '%s', '%s', '%s' ) );

$wpdb->insert( WPSC_TABLE_COUPON_CODES, array(
'id' => self::FREE_SHIPPING_COUPON_ID,
'id' => self::FREE_SHIPPING_COUPON_ID,
'coupon_code' => self::FREE_SHIPPING_COUPON_CODE,
'value' => '5',
'value' => '5',
'is-percentage' => 2,
'use-once' => 0,
'is-used' => 0,
'active' => 1,
'use-once' => 0,
'is-used' => 0,
'active' => 1,
'every_product' => 0,
'start' => '0000-00-00',
'expiry' => '0000-00-00',
'condition' => serialize( array() )
'start' => '0000-00-00',
'expiry' => '0000-00-00',
'condition' => serialize( array() )
), array( '%d', '%s', '%s', '%d', '%d', '%d', '%d', '%d', '%s', '%s', '%s' ) );

$wpdb->insert( WPSC_TABLE_COUPON_CODES, array(
'id' => self::USE_ONCE_COUPON_ID,
'id' => self::USE_ONCE_COUPON_ID,
'coupon_code' => self::USE_ONCE_COUPON_CODE,
'value' => '10',
'value' => '10',
'is-percentage' => 0,
'use-once' => 1,
'is-used' => 0,
'active' => 1,
'use-once' => 1,
'is-used' => 0,
'active' => 1,
'every_product' => 0,
'start' => '0000-00-00',
'expiry' => '0000-00-00',
'condition' => serialize( array() )
'start' => '0000-00-00',
'expiry' => '0000-00-00',
'condition' => serialize( array() )
), array( '%d', '%s', '%s', '%d', '%d', '%d', '%d', '%d', '%s', '%s', '%s' ) );

$wpdb->insert( WPSC_TABLE_COUPON_CODES, array(
'id' => self::EXPIRY_COUPON_ID,
'id' => self::EXPIRY_COUPON_ID,
'coupon_code' => self::EXPIRY_COUPON_CODE,
'value' => '10',
'value' => '10',
'is-percentage' => 0,
'use-once' => 1,
'is-used' => 0,
'active' => 1,
'use-once' => 1,
'is-used' => 0,
'active' => 1,
'every_product' => 0,
'start' => self::START_DATE,
'expiry' => self::EXPIRY_DATE,
'condition' => serialize( array() )
'start' => self::START_DATE,
'expiry' => self::EXPIRY_DATE,
'condition' => serialize( array() )
), array( '%d', '%s', '%s', '%d', '%d', '%d', '%d', '%d', '%s', '%s', '%s' ) );

$wpdb->insert( WPSC_TABLE_COUPON_CODES, array(
'id' => self::DELETE_COUPON_ID,
'id' => self::DELETE_COUPON_ID,
'coupon_code' => self::DELETE_COUPON_CODE,
'value' => '10',
'value' => '10',
'is-percentage' => 0,
'use-once' => 0,
'is-used' => 0,
'active' => 0,
'use-once' => 0,
'is-used' => 0,
'active' => 0,
'every_product' => 0,
'start' => self::START_DATE,
'expiry' => self::EXPIRY_DATE,
'condition' => serialize( array() )
'start' => self::START_DATE,
'expiry' => self::EXPIRY_DATE,
'condition' => serialize( array() )
), array( '%d', '%s', '%s', '%d', '%d', '%d', '%d', '%d', '%s', '%s', '%s' ) );

$wpdb->insert( WPSC_TABLE_COUPON_CODES, array(
'id' => self::CONDITIONS_COUPON_ID,
'id' => self::CONDITIONS_COUPON_ID,
'coupon_code' => self::CONDITIONS_COUPON_CODE,
'value' => '10',
'value' => '10',
'is-percentage' => 0,
'use-once' => 0,
'is-used' => 0,
'active' => 0,
'use-once' => 0,
'is-used' => 0,
'active' => 0,
'every_product' => 0,
'start' => '0000-00-00',
'expiry' => '0000-00-00',
'condition' => serialize( $this->get_test_conditions() )
'start' => '0000-00-00',
'expiry' => '0000-00-00',
'condition' => serialize( $this->get_test_conditions() )
), array( '%d', '%s', '%s', '%d', '%d', '%d', '%d', '%d', '%s', '%s', '%s' ) );

$wpdb->insert( WPSC_TABLE_COUPON_CODES, array(
'id' => self::ACTIVE_COUPON_ID,
'id' => self::ACTIVE_COUPON_ID,
'coupon_code' => self::ACTIVE_COUPON_CODE,
'value' => '10',
'value' => '10',
'is-percentage' => 0,
'use-once' => 0,
'is-used' => 0,
'active' => 1,
'use-once' => 0,
'is-used' => 0,
'active' => 1,
'every_product' => 0,
'start' => '0000-00-00',
'expiry' => '0000-00-00',
'condition' => serialize( array() )
'start' => '0000-00-00',
'expiry' => '0000-00-00',
'condition' => serialize( array() )
), array( '%d', '%s', '%s', '%d', '%d', '%d', '%d', '%d', '%s', '%s', '%s' ) );

}
Expand All @@ -159,15 +159,15 @@ function get_test_conditions() {
array(
'operator' => '',
'property' => 'item_name',
'logic' => 'equal',
'value' => 'Test Product'
'logic' => 'equal',
'value' => 'Test Product'
),

array(
'operator' => 'and',
'property' => 'item_quantity',
'logic' => 'greater',
'value' => '1'
'logic' => 'greater',
'value' => '1'
)

);
Expand Down Expand Up @@ -203,9 +203,9 @@ function test_insert_coupon() {

$coupon = new WPSC_Coupon( array(
'coupon_code' => self::PERCENTAGE_COUPON_CODE,
'value' => '50',
'value' => '50',
'is-percentage' => '1',
'active' => '1'
'active' => '1'
) );

$result = $coupon->save();
Expand Down
12 changes: 6 additions & 6 deletions tests/test-wpsc-region.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,13 @@
class TestWPSCRegionClass extends WP_UnitTestCase {

// Test country / regions
const COUNTRY_ID_WITH_REGIONS = 136;
const COUNTRY_ID_WITH_REGIONS = 136;
const COUNTRY_ISOCODE_WITH_REGIONS = 'US';
const REGION_ID = 50;
const REGION_CODE = 'OR';
const REGION_NAME = 'Oregon';
const INVALID_REGION_NAME = 'Oregano';
const REGION_TAX_RATE = 0.0;
const REGION_ID = 50;
const REGION_CODE = 'OR';
const REGION_NAME = 'Oregon';
const INVALID_REGION_NAME = 'Oregano';
const REGION_TAX_RATE = 0.0;

function setUp() {
wpsc_create_or_update_tables();
Expand Down
Loading

0 comments on commit 9868144

Please sign in to comment.