public function testCreate() { $shippingAddress = $this->dummyData->getOrderAddress(); $billingAddress = clone $shippingAddress; $user = $this->dummyData->getUser(); $coupon = $this->dummyData->getCoupon(); $shipment = $this->dummyData->getShipment(); $cartTotal = $this->dummyData->getCartTotal(); $payment = $this->dummyData->getCashPayment(); $shipmentRate = $this->dummyData->getShipmentRate(); $taxRate = $this->dummyData->getTaxRate(); $order = new Order(); $order->setExternalId('CO1102-0016'); $order->setReferenceNumber('xxx-xxxxxxx-xxxxxxx'); $order->setIp4('10.0.0.1'); $order->setShippingAddress($shippingAddress); $order->setBillingAddress($billingAddress); $order->setUser($user); $order->addCoupon($coupon); $order->setTaxRate($taxRate); $order->setTotal($cartTotal); $order->addShipment($shipment); $order->setShipmentRate($shipmentRate); $order->addPayment($payment); $product = $this->dummyData->getProduct(); $orderItem = $this->dummyData->getOrderItem($order, $product); $orderItem->setQuantity(2); $this->assertEntityValid($order); $this->assertSame('CO1102-0016', $order->getExternalId()); $this->assertSame('xxx-xxxxxxx-xxxxxxx', $order->getReferenceNumber()); $this->assertSame('10.0.0.1', $order->getIp4()); $this->assertTrue($order->getStatus()->isShipped()); $this->assertSame(1, $order->totalItems()); $this->assertSame(2, $order->totalQuantity()); $this->assertSame($cartTotal, $order->getTotal()); $this->assertSame($shippingAddress, $order->getShippingAddress()); $this->assertSame($billingAddress, $order->getBillingAddress()); $this->assertSame($user, $order->getUser()); $this->assertSame($coupon, $order->getCoupons()[0]); $this->assertSame($orderItem, $order->getOrderItem(0)); $this->assertSame($orderItem, $order->getOrderItems()[0]); $this->assertSame($payment, $order->getPayments()[0]); $this->assertSame($shipmentRate, $order->getShipmentRate()); $this->assertSame($taxRate, $order->getTaxRate()); $this->assertSame($product, $order->getProducts()[0]); $this->assertSame($shipment, $order->getShipments()[0]); }