/** * Update cart status * * @param Cart $existingEntity * @param CartStatus $status */ protected function updateCartStatus(Cart $existingEntity, CartStatus $status) { // allow to modify status only for "open" carts // because magento can only expire cart, so for different statuses this useless if ($existingEntity->getStatus()->getName() !== 'open') { $status = $existingEntity->getStatus(); } $status = $this->strategyHelper->getEntityManager(MagentoConnectorInterface::CART_STATUS_TYPE)->getReference(MagentoConnectorInterface::CART_STATUS_TYPE, $status->getName()); $existingEntity->setStatus($status); }
/** * Update cart status * * @param Cart $cart * * @return CartStrategy */ protected function updateCartStatus(Cart $cart) { // allow to modify status only for "open" carts // because magento can only expire cart, so for different statuses this useless if ($this->existingEntity->getStatus()->getName() !== CartStatus::STATUS_OPEN) { $status = $this->existingEntity->getStatus(); } else { $status = $cart->getStatus(); } $cart->setStatus($status); return $this; }
public function testConstruct() { $this->assertNotEmpty($this->entity->getStatus()); $this->assertEquals('open', $this->entity->getStatus()->getName()); }