get_taxable_address() public method

Get taxable address.
public get_taxable_address ( ) : array
return array
コード例 #1
0
ファイル: crud.php プロジェクト: woocommerce/woocommerce
 /**
  * Test getting a customer's taxable address.
  * @since 2.7.0
  */
 public function test_customer_get_taxable_address()
 {
     $customer = WC_Helper_Customer::create_customer();
     $customer_id = $customer->get_id();
     $customer->set_shipping_postcode('11111');
     $customer->set_shipping_city('Test');
     $customer->save();
     $customer = new WC_Customer($customer_id);
     update_option('woocommerce_tax_based_on', 'shipping');
     $taxable = $customer->get_taxable_address();
     $this->assertEquals('US', $taxable[0]);
     $this->assertEquals('PA', $taxable[1]);
     $this->assertEquals('11111', $taxable[2]);
     $this->assertEquals('Test', $taxable[3]);
     update_option('woocommerce_tax_based_on', 'billing');
     $taxable = $customer->get_taxable_address();
     $this->assertEquals('US', $taxable[0]);
     $this->assertEquals('PA', $taxable[1]);
     $this->assertEquals('19123', $taxable[2]);
     $this->assertEquals('Philadelphia', $taxable[3]);
     update_option('woocommerce_tax_based_on', 'base');
     $taxable = $customer->get_taxable_address();
     $this->assertEquals(WC()->countries->get_base_country(), $taxable[0]);
     $this->assertEquals(WC()->countries->get_base_state(), $taxable[1]);
     $this->assertEquals(WC()->countries->get_base_postcode(), $taxable[2]);
     $this->assertEquals(WC()->countries->get_base_city(), $taxable[3]);
 }