public function testProcessUnsupportedRequest() { $this->requestChannelProvider->expects($this->once())->method('setDataChannel')->with($this->entity); $this->form->expects($this->once())->method('setData')->with($this->entity); $this->form->expects($this->never())->method('submit'); $this->assertFalse($this->handler->process($this->entity)); }
/** * Process form * * @param Lead $entity * * @return bool True on successful processing, false otherwise */ public function process(Lead $entity) { $this->requestChannelProvider->setDataChannel($entity); $this->form->setData($entity); if (in_array($this->request->getMethod(), array('POST', 'PUT'))) { $this->form->submit($this->request); if ($this->form->isValid()) { $this->onSuccess($entity); return true; } } return false; }