コード例 #1
0
 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));
 }
コード例 #2
0
ファイル: LeadHandler.php プロジェクト: antrampa/crm
 /**
  * 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;
 }