public function delete(StateDeleteEvent $event) { if (null !== ($state = StateQuery::create()->findPk($event->getStateId()))) { $state->delete(); $event->setState($state); } }
/** * @param StateModel $state * @depends testUpdate */ public function testDelete(StateModel $state) { $event = new StateDeleteEvent($state->getId()); $event->setDispatcher($this->dispatcher); $action = new State(); $action->delete($event); $deletedState = $event->getState(); $this->assertInstanceOf('Thelia\\Model\\State', $deletedState); $this->assertTrue($deletedState->isDeleted()); }