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

49 lines
1.4 KiB
PHP
Raw Normal View History

2021-12-20 11:41:41 +03:00
<?php
/**
2022-01-10 12:53:00 +03:00
* PHP version 5.6
*
* Class WC_Retailcrm_Order_Test - Testing WC_Retailcrm_Order.
2021-12-20 11:41:41 +03:00
*
* @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());
2022-09-22 15:17:34 +03:00
$data = $buildOrder->build($this->order)->getData();
2021-12-20 11:41:41 +03:00
$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('');
2022-09-22 15:17:34 +03:00
$data = $buildOrder->build($this->order)->getData();
2021-12-20 11:41:41 +03:00
$this->assertNotEmpty($data);
$this->assertArrayHasKey('countryIso', $data);
$this->assertNotEquals('', $data['countryIso']);
}
}