public function setUp() { parent::setUp(); // Reset all menus Menu::reset(); $this->refreshApplication(); // Precreate somme Dummy data static::$link = new Link('#', 'foo'); static::$raw = new Raw('foo'); static::$itemList = new ItemList(); static::$item = new Item(static::$itemList, static::$link); }
/** * Get last item added to cart * * @return \XLite\Model\OrderItem */ protected function getItem() { if (!isset(static::$item)) { if (\XLite\Core\Session::getInstance()->lastAddedCartItemId) { // Try to get item by itemId static::$item = $this->getCart()->getItemByItemId(\XLite\Core\Session::getInstance()->lastAddedCartItemId); } if (!isset(static::$item) && \XLite\Core\Session::getInstance()->lastAddedCartItemKey) { // Try to get item by item key static::$item = $this->getCart()->getItemByItemKey(\XLite\Core\Session::getInstance()->lastAddedCartItemKey); } if (!isset(static::$item)) { // Try to get last item in the cart $items = $this->getCart()->getItems(); if ($items) { static::$item = $items[count($items) - 1]; } } } if (!isset(static::$item)) { // This is an exceptional situation and should never occur. Just in case... static::$item = new \XLite\Model\OrderItem(); } return static::$item; }