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


PHP Zend_Filter_Input::process方法代碼示例

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


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

示例1: testPluginLoaderWithFilterValidateNamespaceWithSameNameFilterAndValidatorWorksPerfectly

 /**
  * @group ZF-3100
  */
 public function testPluginLoaderWithFilterValidateNamespaceWithSameNameFilterAndValidatorWorksPerfectly()
 {
     // Array
     $filters = array('date1' => array('Date'));
     $validators = array('date1' => array('Date'));
     $data = array('date1' => '1990-01-01');
     $options = array('filterNamespace' => array('MyZend_Filter'), 'validatorNamespace' => array('MyZend_Validate'));
     $filter = new Zend_Filter_Input($filters, $validators, $data, $options);
     try {
         $filter->process();
         $this->assertEquals("2000-01-01", $filter->date1);
     } catch (Zend_Filter_Exception $e) {
         $this->fail();
     }
     // String notation
     $options = array('filterNamespace' => 'MyZend_Filter', 'validatorNamespace' => 'MyZend_Validate');
     $filter = new Zend_Filter_Input($filters, $validators, $data, $options);
     try {
         $filter->process();
         $this->assertEquals("2000-01-01", $filter->date1);
     } catch (Zend_Filter_Exception $e) {
         $this->fail();
     }
 }
開發者ID:ThorstenSuckow,項目名稱:conjoon,代碼行數:27,代碼來源:InputTest.php

示例2: testProcessMissingThrowsException

 public function testProcessMissingThrowsException()
 {
     $data = array('field1' => 'ab&c');
     $filters = array('*' => 'StringTrim', 'field2' => 'digits');
     $validators = array('field1' => array(Zend_Filter_Input::PRESENCE => Zend_Filter_Input::PRESENCE_OPTIONAL), 'field2' => array('digits', Zend_Filter_Input::PRESENCE => Zend_Filter_Input::PRESENCE_REQUIRED));
     $input = new Zend_Filter_Input($filters, $validators, $data);
     try {
         $input->process();
         $this->fail('Expected to catch Zend_Filter_Exception');
     } catch (Zend_Exception $e) {
         $this->assertType('Zend_Filter_Exception', $e, 'Expected object of type Zend_Filter_Exception, got ' . get_class($e));
         $this->assertEquals("Input has missing fields", $e->getMessage());
         $this->assertTrue($input->hasMissing(), 'Expected hasMissing() to return true');
         $this->assertFalse($input->hasInvalid(), 'Expected hasInvalid() to return false');
         $this->assertFalse($input->hasUnknown(), 'Expected hasUnknown() to return false');
         $this->assertTrue($input->hasValid(), 'Expected hasValid() to return true');
     }
 }
開發者ID:jorgenils,項目名稱:zend-framework,代碼行數:18,代碼來源:InputTest.php

示例3: process

 /**
  * Overrides parent implementation by adding a call to _preProcess
  * before the data gets processed.
  *
  * @return Zend_Filter_Input
  * @throws Zend_Filter_Exception
  */
 public function process()
 {
     if ($this->_processed === true) {
         return;
     }
     $this->_preProcess();
     return parent::process();
 }
開發者ID:ThorstenSuckow,項目名稱:conjoon,代碼行數:15,代碼來源:Input.php


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