예제 #1
0
 /**
  * test createFromCart method
  *
  * @group order
  */
 public function testCreateOrderFromCart()
 {
     $orderInitialState = $this->getParameter('elcodi.core.cart.order_initial_state');
     $this->assertInstanceOf('Elcodi\\Component\\Cart\\Entity\\Interfaces\\OrderInterface', $this->order);
     $this->assertSame($this->order->getCart(), $this->cart);
     $this->assertTrue($this->cart->isOrdered());
     $this->assertCount(2, $this->order->getOrderLines());
     $this->assertInstanceOf('Elcodi\\Component\\Cart\\Entity\\Interfaces\\OrderHistoryInterface', $this->order->getLastOrderHistory());
     $this->assertEquals($this->order->getLastOrderHistory()->getState(), $orderInitialState);
     $orderHistories = $this->order->getOrderHistories();
     /**
      * @var OrderHistoryInterface $orderHistory
      */
     foreach ($orderHistories as $orderHistory) {
         $this->assertInstanceOf('Elcodi\\Component\\Cart\\Entity\\Interfaces\\OrderHistoryInterface', $orderHistory);
         $this->assertEquals($orderHistory->getState(), $orderInitialState);
     }
     $this->getObjectManager('order')->clear();
     $this->assertCount(1, $this->findAll('order'));
 }