<?php /** * User: Ionov George * Date: 17.03.2016 * Time: 9:06 */ return ['renderer' => ['templates' => ['default' => ['form' => '{result}{errors}{label}<div>{start}{children}{handlers}{end}</div>{scripts}', 'block' => '{label}<div>{children}</div>', 'field' => '<div><label {forField}>{title}</label>{field}</div>{errors}', 'handler' => '<div>{handler}</div>', 'errors' => ['default' => '<span>{errorsStr}</span>', 'form' => '<div>{errorsStr}</div>'], 'label' => ['default' => '<span>{title}</span>', 'form' => '<div>{title}</div>'], 'result' => '<div class="{className}">{message}</div>', 'checkSet' => '{label}<div>{options}</div>{errors}', 'checkSetOption' => '<span><label>{optionTitle}{option}</label></span>', 'repeatFiled' => '<div {blockSelector}>{field}{actions}{errors}</div>', 'repeatBlock' => '<div {blockSelector}>{children}{actions}</div>', 'repeatContainer' => '<div {containerSelector}>{label}{children}</div>{repeatScript}', 'repeatActionsBlock' => '<div {actionsBlockSelector}="{name}">{deleteButton}{addButton}</div>', 'deleteButton' => '<span {deleteActionSelector}>-</span>', 'addButton' => '<span {addActionSelector}>+</span>', 'attribute' => '{name}="{value}"', 'shortAttribute' => '{name}']], 'repeat' => ['block' => 'data-repeat-block', 'container' => 'data-repeat-container', 'actionsBlock' => 'data-repeat-actions', 'deleteAction' => 'data-delete', 'addAction' => 'data-add'], 'errors' => ['delimiter' => '<br>'], 'alias' => [\NewInventor\Form\Form::getClass() => 'form', \NewInventor\Form\Block::getClass() => 'block', \NewInventor\Form\Field\AbstractField::getClass() => 'field', \NewInventor\Form\Handler::getClass() => 'handler']], 'validator' => ['email' => \NewInventor\Form\Validator\Validators\EmailValidator::getClass(), 'integer' => \NewInventor\Form\Validator\Validators\IntegerValidator::getClass(), 'string' => \NewInventor\Form\Validator\Validators\StringValidator::getClass(), 'required' => \NewInventor\Form\Validator\Validators\RequiredValidator::getClass()]];
public function testMinMax() { $validator = new IntegerValidator(); $validator->setMin(0); $validator->setMax(100); $this->assertFalse($validator->isValid('dfsdfsdf')); $this->assertFalse($validator->isValid(null)); $this->assertFalse($validator->isValid([])); $this->assertFalse($validator->isValid('12312.231')); $this->assertFalse($validator->isValid(12312.231)); $this->assertFalse($validator->isValid(12312.231)); $this->assertFalse($validator->isValid(1432)); $this->assertFalse($validator->isValid('101')); $this->assertFalse($validator->isValid('-1')); $this->assertTrue($validator->isValid('')); $this->assertTrue($validator->isValid(1)); $this->assertTrue($validator->isValid('100')); }