public function delete(CountryDeleteEvent $event) { if (null !== ($country = CountryQuery::create()->findPk($event->getCountryId()))) { $country->delete(); $event->setCountry($country); } }
/** * @param CountryModel $country * @depends testUpdate */ public function testDelete(CountryModel $country) { $event = new CountryDeleteEvent($country->getId()); $event->setDispatcher($this->dispatcher); $action = new Country(); $action->delete($event); $deletedCountry = $event->getCountry(); $this->assertInstanceOf('Thelia\\Model\\Country', $deletedCountry); $this->assertTrue($deletedCountry->isDeleted()); }