public function UcAddressesEntityCase::testNewUcOrderPropertyGet in Ubercart Addresses 7
Tests getting uc_addreses properties on a new uc_order.
@covers uc_addresses_uc_order_address_property_get()
File
- tests/
uc_addresses.entity.test, line 308 - Test cases address entity.
Class
- UcAddressesEntityCase
- Tests for Entity API integration.
Code
public function testNewUcOrderPropertyGet() {
$delivery_city = self::randomName();
$billing_city = self::randomName();
// Create a new order without saving.
$order = new UcOrder();
$order->delivery_city = $delivery_city;
$order->billing_city = $billing_city;
// Assert that properties can be get using the Entity API's metadata wrapper.
$order_wrapper = entity_metadata_wrapper('uc_order', $order);
$this
->assertEqual($delivery_city, $order_wrapper->uc_addresses_delivery_address->city
->raw());
$this
->assertEqual($billing_city, $order_wrapper->uc_addresses_billing_address->city
->raw());
$this
->assertTrue($order_wrapper->uc_addresses_delivery_address
->raw() instanceof UcAddressesAddress);
$this
->assertTrue($order_wrapper->uc_addresses_billing_address
->raw() instanceof UcAddressesAddress);
}