public function remove($key)
{
parent::remove($key);
$this->applyDiscounts();
$this->saveState();
$this->eventManager->fire(CartEvents::CART_REMOVE_ITEM, new CartEvent(Yii::app()->getUser(), $this));
}
function testEventOnRemovePosition() { $this->setUp(); $cart = new EShoppingCart(); $this->testVar = false; $cart->attachEventHandler('onRemovePosition', array($this, 'testEventHandler')); $book = Book::model()->findByPk(1); $cart->put($book); $cart->remove($book->getId()); $this->assertTrue($cart->hasEvent('onRemovePosition')); $this->assertTrue($cart->hasEventHandler('onRemovePosition')); $this->assertTrue($this->testVar); }