public function infoAction() { $view = $this->View(); $view->sBasketQuantity = isset($this->session->sBasketQuantity) ? $this->session->sBasketQuantity : 0; $view->sBasketAmount = isset($this->session->sBasketAmount) ? $this->session->sBasketAmount : 0; $view->sNotesQuantity = isset($this->session->sNotesQuantity) ? $this->session->sNotesQuantity : $this->module->sCountNotes(); $view->sUserLoggedIn = !empty(Shopware()->Session()->sUserId); }
/** * @covers sBasket::sDeleteNote * @depends testsCountNotes */ public function testsDeleteNote($input) { list($randomArticles, $cookieId) = $input; $_COOKIE["sUniqueID"] = $cookieId; // Null argument, return null $this->assertFalse($this->module->sDeleteNote(null)); // Get random article that's not in the basket $randomNotPresentArticleId = $this->db->fetchOne('SELECT detail.id FROM s_articles_details detail INNER JOIN s_articles article ON article.id = detail.articleID WHERE detail.active = 1 AND detail.id NOT IN (?) ORDER BY RAND() LIMIT 1', array(array_column($randomArticles, 'id'))); // Check that we currently have 2 articles $this->assertEquals(2, $this->module->sCountNotes()); // Get true even if article is not in the wishlist $this->assertTrue($this->module->sDeleteNote($randomNotPresentArticleId)); // Check that we still have 2 articles $this->assertEquals(2, $this->module->sCountNotes()); $noteIds = $this->db->fetchCol('SELECT id FROM s_order_notes detail WHERE sUniqueID = ?', array($this->module->sSYSTEM->_COOKIE["sUniqueID"])); // Get true even if article is not in the wishlist $this->assertTrue($this->module->sDeleteNote($noteIds[0])); // Check that we now have 1 article $this->assertEquals(1, $this->module->sCountNotes()); // Get true even if article is not in the wishlist $this->assertTrue($this->module->sDeleteNote($noteIds[1])); // Check that we now have an empty wishlist $this->assertEquals(0, $this->module->sCountNotes()); }