當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Form::hasValidated方法代碼示例

本文整理匯總了PHP中Zend\Form\Form::hasValidated方法的典型用法代碼示例。如果您正苦於以下問題:PHP Form::hasValidated方法的具體用法?PHP Form::hasValidated怎麽用?PHP Form::hasValidated使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Zend\Form\Form的用法示例。


在下文中一共展示了Form::hasValidated方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: it_should_have_a_form

 /**
  * @param \Zend\Form\Form $form
  */
 public function it_should_have_a_form($form)
 {
     $entity = new \StdClass();
     $form->hasValidated()->shouldBeCalled()->willreturn(false);
     $form->bind($entity)->shouldBeCalled()->willreturn($form);
     $form->bindOnValidate()->shouldBeCalled()->willreturn($form);
     $this->setForm($form)->getForm($entity)->shouldReturn($form);
 }
開發者ID:phpro,項目名稱:zf-smartcrud,代碼行數:11,代碼來源:AbstractSmartServiceSpec.php

示例2: getForm

 /**
  * @return \Zend\Form\Form
  */
 public function getForm($entity)
 {
     if ($this->form->hasValidated()) {
         return $this->form;
     }
     $this->form->bind($entity);
     $this->form->bindOnValidate();
     $this->getEventManager()->trigger($this->createEvent(CrudEvent::FORM_READY, $this->form));
     return $this->form;
 }
開發者ID:phpro,項目名稱:zf-smartcrud,代碼行數:13,代碼來源:AbstractSmartService.php

示例3: __invoke

 public function __invoke(Form $form)
 {
     $out = "";
     if ($form->hasValidated() && !$form->isValid()) {
         $out .= '<div class="alert alert-error">';
         $out .= '<strong>Validation problems:</strong> Please check your form input';
         $out .= '</div>';
     }
     return $out;
 }
開發者ID:0ida,項目名稱:fussi,代碼行數:10,代碼來源:TwitterBootstrapFormError.php

示例4: it_should_handle_valid_data

 /**
  * @param \Phpro\SmartCrud\Gateway\CrudGatewayInterface $gateway
  * @param \Zend\EventManager\EventManager               $eventManager
  * @param \Zend\Form\Form                               $form
  * @param \Phpro\SmartCrud\Service\SmartServiceResult   $result
  */
 public function it_should_handle_valid_data($gateway, $eventManager, $form, $result)
 {
     $entity = new \StdClass();
     $entity->id = 1;
     $postData = $this->getMockPostData();
     $gateway->loadEntity('entityKey', $entity->id)->shouldBecalled()->willReturn($entity);
     $gateway->update($entity, $postData)->shouldBecalled()->willReturn(true);
     $form->hasValidated()->shouldBeCalled()->willreturn(false);
     $form->bind(Argument::any())->shouldBeCalled();
     $form->bindOnValidate()->shouldBeCalled();
     $form->setData(Argument::exact($this->getMockPostData()))->shouldBeCalled()->willReturn($form);
     $form->isValid()->shouldBeCalled()->willreturn(true);
     $result->setSuccess(true)->shouldBeCalled();
     $result->setForm($form)->shouldBeCalled();
     $result->setEntity($entity)->shouldBeCalled();
     $this->setEntityKey('entityKey');
     $this->setGateway($gateway);
     $this->setForm($form);
     $this->setResult($result);
     $this->run($entity->id, $this->getMockPostData())->shouldReturn($result);
     $eventManager->trigger(Argument::which('getName', CrudEvent::BEFORE_DATA_HYDRATION))->shouldBeCalled();
     $eventManager->trigger(Argument::which('getName', CrudEvent::BEFORE_DATA_VALIDATION))->shouldBeCalled();
     $eventManager->trigger(Argument::which('getName', CrudEvent::INVALID_UPDATE))->shouldNotBeCalled();
     $eventManager->trigger(Argument::which('getName', CrudEvent::BEFORE_UPDATE))->shouldBeCalled();
     $eventManager->trigger(Argument::which('getName', CrudEvent::AFTER_UPDATE))->shouldBeCalled();
 }
開發者ID:phpro,項目名稱:zf-smartcrud,代碼行數:32,代碼來源:UpdateServiceSpec.php


注:本文中的Zend\Form\Form::hasValidated方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。