/** * Delete a product attribute entry * * @param AttributeAvDeleteEvent $event */ public function delete(AttributeAvDeleteEvent $event) { if (null !== ($attribute = AttributeAvQuery::create()->findPk($event->getAttributeAvId()))) { $attribute->setDispatcher($event->getDispatcher())->delete(); $event->setAttributeAv($attribute); } }
/** * @depends testUpdate */ public function testDelete(AttributeAvModel $attributeAv) { $event = new AttributeAvDeleteEvent($attributeAv->getId()); $event->setDispatcher($this->getMock("Symfony\\Component\\EventDispatcher\\EventDispatcherInterface")); $action = new AttributeAv(); $action->delete($event); $deletedAttributeAv = $event->getAttributeAv(); $this->assertInstanceOf('Thelia\\Model\\AttributeAv', $deletedAttributeAv); $this->assertTrue($deletedAttributeAv->isDeleted()); }