/** * 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(); }
/** * 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]); }
/** * 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; }
/** * Method to get property Rule * * @return ValidatorInterface */ public function getValidator() { if (!$this->validator instanceof ValidatorInterface) { $this->validator = ValidatorHelper::create($this->validator); } return $this->validator; }
/** * testCreateByClassName * * @return void */ public function testCreateByClassName() { $filter = ValidatorHelper::create('Windwalker\\Form\\Test\\Stub\\StubValidator'); $this->assertInstanceOf('Windwalker\\Form\\Test\\Stub\\StubValidator', $filter); }