예제 #1
0
 /**
  * initialise
  *
  * @throws  \LogicException
  * @return  void
  */
 public function initialise()
 {
     // Prepare Resolvers
     RecordResolver::addNamespace(__NAMESPACE__ . '\\Record');
     DataMapperResolver::addNamespace(__NAMESPACE__ . '\\DataMapper');
     FieldHelper::addNamespace(__NAMESPACE__ . '\\Field');
     ValidatorHelper::addNamespace(__NAMESPACE__ . 'Validator');
     FieldDefinitionResolver::addNamespace(__NAMESPACE__ . '\\Form');
     parent::initialise();
 }
예제 #2
0
 /**
  * Method to test addValidatorNamespace().
  *
  * @return void
  *
  * @covers Windwalker\Form\Form::addValidatorNamespace
  */
 public function testAddValidatorNamespace()
 {
     ValidatorHelper::reset();
     $form = new Form();
     $form->addValidatorNamespace('TestNS');
     $ns = ValidatorHelper::getNamespaces();
     $ns = iterator_to_array($ns);
     $this->assertEquals('TestNS', $ns[0]);
 }
예제 #3
0
 /**
  * Method to set property fieldNamespaces
  *
  * @param string $ns
  * @param int    $priority
  *
  * @return  static  Return self to support chaining.
  */
 public function addValidatorNamespace($ns, $priority = 256)
 {
     ValidatorHelper::addNamespace($ns, $priority);
     return $this;
 }
예제 #4
0
 /**
  * Method to get property Rule
  *
  * @return  ValidatorInterface
  */
 public function getValidator()
 {
     if (!$this->validator instanceof ValidatorInterface) {
         $this->validator = ValidatorHelper::create($this->validator);
     }
     return $this->validator;
 }
예제 #5
0
 /**
  * testCreateByClassName
  *
  * @return  void
  */
 public function testCreateByClassName()
 {
     $filter = ValidatorHelper::create('Windwalker\\Form\\Test\\Stub\\StubValidator');
     $this->assertInstanceOf('Windwalker\\Form\\Test\\Stub\\StubValidator', $filter);
 }