当前位置: 首页>>代码示例>>PHP>>正文


PHP Select::getInputSpecification方法代码示例

本文整理汇总了PHP中Zend\Form\Element\Select::getInputSpecification方法的典型用法代码示例。如果您正苦于以下问题:PHP Select::getInputSpecification方法的具体用法?PHP Select::getInputSpecification怎么用?PHP Select::getInputSpecification使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Zend\Form\Element\Select的用法示例。


在下文中一共展示了Select::getInputSpecification方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: getInputSpecification

 public function getInputSpecification()
 {
     $spec = parent::getInputSpecification();
     $spec['allow_empty'] = true;
     $spec['filters'] = [new NullFilter(NullFilter::TYPE_STRING)];
     return $spec;
 }
开发者ID:DavidHavl,项目名称:Ajasta,代码行数:7,代码来源:UnitSelect.php

示例2: testInArrayValidationOfOptions

 /**
  * @dataProvider selectOptionsDataProvider
  */
 public function testInArrayValidationOfOptions($valueTests, $options)
 {
     $element = new SelectElement('my-select');
     $element->setAttributes(array('options' => $options));
     $inputSpec = $element->getInputSpecification();
     $this->assertArrayHasKey('validators', $inputSpec);
     $inArrayValidator = $inputSpec['validators'][0];
     $this->assertInstanceOf('Zend\\Validator\\InArray', $inArrayValidator);
     foreach ($valueTests as $valueToTest) {
         $this->assertTrue($inArrayValidator->isValid($valueToTest));
     }
 }
开发者ID:haoyanfei,项目名称:zf2,代码行数:15,代码来源:SelectTest.php

示例3: testProvidesInputSpecificationForMultipleSelect

 public function testProvidesInputSpecificationForMultipleSelect()
 {
     $element = new SelectElement();
     $element->setAttributes(array('multiple' => true, 'options' => array('Option 1' => 'option1', 'Option 2' => 'option2', 'Option 3' => 'option3')));
     $inputSpec = $element->getInputSpecification();
     $this->assertArrayHasKey('validators', $inputSpec);
     $this->assertInternalType('array', $inputSpec['validators']);
     $expectedClasses = array('Zend\\Validator\\Explode');
     foreach ($inputSpec['validators'] as $validator) {
         $class = get_class($validator);
         $this->assertTrue(in_array($class, $expectedClasses), $class);
         switch ($class) {
             case 'Zend\\Validator\\Explode':
                 $this->assertInstanceOf('Zend\\Validator\\InArray', $validator->getValidator());
                 break;
             default:
                 break;
         }
     }
 }
开发者ID:Rovak,项目名称:zf2,代码行数:20,代码来源:SelectTest.php

示例4: testProvidesInputSpecificationThatIncludesValidatorsBasedOnAttributes

 public function testProvidesInputSpecificationThatIncludesValidatorsBasedOnAttributes()
 {
     $element = new SelectElement();
     $element->setAttribute('options', array('Option 1' => 'option1', 'Option 2' => 'option2', 'Option 3' => 'option3'));
     $inputSpec = $element->getInputSpecification();
     $this->assertArrayHasKey('validators', $inputSpec);
     $this->assertInternalType('array', $inputSpec['validators']);
     $expectedClasses = array('Zend\\Validator\\InArray');
     foreach ($inputSpec['validators'] as $validator) {
         $class = get_class($validator);
         $this->assertTrue(in_array($class, $expectedClasses), $class);
         switch ($class) {
             case 'Zend\\Validator\\InArray':
                 $this->assertEquals($element->getAttribute('options'), $validator->getHaystack());
                 break;
             default:
                 break;
         }
     }
 }
开发者ID:ninahuanca,项目名称:zf2,代码行数:20,代码来源:SelectTest.php

示例5: testDisableInputSpecification

 public function testDisableInputSpecification()
 {
     $element = new SelectElement();
     $element->setValueOptions(array('Option 1' => 'option1', 'Option 2' => 'option2', 'Option 3' => 'option3'));
     $element->setDisableInArrayValidator(true);
     $inputSpec = $element->getInputSpecification();
     $this->assertArrayNotHasKey('validators', $inputSpec);
 }
开发者ID:rajanlamic,项目名称:IntTest,代码行数:8,代码来源:SelectTest.php

示例6: testInArrayValidatorHaystakIsUpdated

 /**
  * Testing that InArray Validator Haystack is Updated if the Options
  * are added after the validator is attached
  *
  * @dataProvider selectOptionsDataProvider
  */
 public function testInArrayValidatorHaystakIsUpdated($valueTests, $options)
 {
     $element = new SelectElement('my-select');
     $inputSpec = $element->getInputSpecification();
     $inArrayValidator = $inputSpec['validators'][0];
     $this->assertInstanceOf('Zend\\Validator\\InArray', $inArrayValidator);
     $element->setValueOptions($options);
     $haystack = $inArrayValidator->getHaystack();
     $this->assertCount(count($options), $haystack);
 }
开发者ID:nieldm,项目名称:zf2,代码行数:16,代码来源:SelectTest.php

示例7: testProvidesInputSpecificationForMultipleSelectWithUseHiddenElement

 public function testProvidesInputSpecificationForMultipleSelectWithUseHiddenElement()
 {
     $element = new SelectElement();
     $element->setUseHiddenElement(true)->setAttributes(array('multiple' => true));
     $inputSpec = $element->getInputSpecification();
     $this->assertArrayHasKey('allow_empty', $inputSpec);
     $this->assertTrue($inputSpec['allow_empty']);
     $this->assertArrayHasKey('continue_if_empty', $inputSpec);
     $this->assertTrue($inputSpec['continue_if_empty']);
 }
开发者ID:pnaq57,项目名称:zf2demo,代码行数:10,代码来源:SelectTest.php

示例8: getInputSpecification

 /**
  * {@inheritDoc}
  */
 public function getInputSpecification()
 {
     $inputSpec = parent::getInputSpecification();
     $defaultFilters = [['name' => 'StringTrim']];
     if (isset($inputSpec['filters'])) {
         array_unshift($inputSpec['filters'], $defaultFilters);
     } else {
         $inputSpec['filters'] = $defaultFilters;
     }
     return $inputSpec;
 }
开发者ID:coolms,项目名称:common,代码行数:14,代码来源:LocaleSelect.php


注:本文中的Zend\Form\Element\Select::getInputSpecification方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。