1
0
mirror of synced 2025-01-19 17:31:45 +03:00
woocommerce-module/tests/order/test-wc-retailcrm-order.php
2022-09-22 15:17:34 +03:00

49 lines
1.4 KiB
PHP

<?php
/**
* PHP version 5.6
*
* Class WC_Retailcrm_Order_Test - Testing WC_Retailcrm_Order.
*
* @category Integration
* @author RetailCRM <integration@retailcrm.ru>
* @license http://retailcrm.ru Proprietary
* @link http://retailcrm.ru
* @see http://help.retailcrm.ru
*/
class WC_Retailcrm_Order_Test extends WC_Retailcrm_Test_Case_Helper {
/** @var WC_Order */
protected $order;
public function setUp()
{
parent::setUp();
$this->order = WC_Helper_Order::create_order();
}
public function test_empty_shipping_data()
{
$buildOrder = new WC_Retailcrm_Order($this->getOptions());
$data = $buildOrder->build($this->order)->getData();
$this->assertNotEmpty($data);
$this->assertArrayHasKey('firstName', $data);
$this->assertArrayHasKey('lastName', $data);
$this->assertEquals($this->order->get_billing_first_name(), $data['firstName']);
$this->assertEquals($this->order->get_billing_last_name(), $data['lastName']);
}
public function test_empty_country_iso()
{
$buildOrder = new WC_Retailcrm_Order($this->getOptions());
$this->order->set_shipping_country('');
$data = $buildOrder->build($this->order)->getData();
$this->assertNotEmpty($data);
$this->assertArrayHasKey('countryIso', $data);
$this->assertNotEquals('', $data['countryIso']);
}
}