/** * @param HookModel $hook * @depends testCreate * @expectedException \Propel\Runtime\Exception\PropelException */ public function testCreateDuplicate(HookModel $hook) { $event = new HookCreateEvent(); $event->setCode($hook->getCode())->setType(TemplateDefinition::FRONT_OFFICE)->setLocale($this->locale)->setActive(true)->setNative(true)->setTitle("Hook Test"); $this->action->create($event, null, $this->getMockEventDispatcher()); $createdHook = $event->getHook(); $this->assertNull($createdHook); $this->assertFalse($event->hasHook()); }
/** * Hydrate the update form for this object, before passing it to the update template * * @param \Thelia\Model\Hook $object * * @return \Thelia\Form\HookModificationForm */ protected function hydrateObjectForm($object) { $data = ['id' => $object->getId(), 'code' => $object->getCode(), 'type' => $object->getType(), 'native' => $object->getNative(), 'by_module' => $object->getByModule(), 'block' => $object->getBlock(), 'active' => $object->getActivate(), 'locale' => $object->getLocale(), 'title' => $object->getTitle(), 'chapo' => $object->getChapo(), 'description' => $object->getDescription()]; return new HookModificationForm($this->getRequest(), 'form', $data); }
/** * Hydrate the update form for this object, before passing it to the update template * * @param \Thelia\Model\Hook $object * * @return \Thelia\Form\HookModificationForm */ protected function hydrateObjectForm($object) { $data = ['id' => $object->getId(), 'code' => $object->getCode(), 'type' => $object->getType(), 'native' => $object->getNative(), 'by_module' => $object->getByModule(), 'block' => $object->getBlock(), 'active' => $object->getActivate(), 'locale' => $object->getLocale(), 'title' => $object->getTitle(), 'chapo' => $object->getChapo(), 'description' => $object->getDescription()]; return $this->createForm(AdminForm::HOOK_MODIFICATION, 'form', $data); }