function &get_cart_item() { $cart_item = new cart_item($this->get_node_id()); $cart_item->set_description($this->get_title()); $cart_item->set_attribute('image_id', $this->get_attribute('image_id')); return $cart_item; }
function test_shutdown() { $item1 = new cart_item(1); $item2 = new cart_item(2); $item1->set_amount(10); $item2->set_amount(20); $this->cart_handler->add_item($item1); $this->cart_handler->add_item($item2); $time = time(); $this->user->setReturnValue('get_id', 1000); $this->cart_handler->_db_cart_handler(); $this->db->sql_select('cart'); $arr = $this->db->get_array(); $this->assertEqual(sizeof($arr), 1); $record = reset($arr); $this->assertEqual($record['user_id'], 1000); $this->assertEqual($record['cart_id'], 10);//??? $this->assertTrue($record['last_activity_time'] >= $time); $this->assertEqual($record['cart_items'], serialize($this->cart_handler->get_items())); }