Changeset 140
- Timestamp:
- 01/23/07 16:51:25 (2 years ago)
- Files:
-
- trunk/src/main/php/net/stubbles/helper/Binford.php (modified) (1 diff)
- trunk/src/main/php/net/stubbles/helper/validators/stubAbstractCompositeValidator.php (modified) (4 diffs)
- trunk/src/main/php/net/stubbles/helper/validators/stubAndValidator.php (modified) (3 diffs)
- trunk/src/main/php/net/stubbles/helper/validators/stubCompositeValidator.php (modified) (2 diffs)
- trunk/src/main/php/net/stubbles/helper/validators/stubEqualValidator.php (modified) (4 diffs)
- trunk/src/main/php/net/stubbles/helper/validators/stubMaxLengthValidator.php (modified) (4 diffs)
- trunk/src/main/php/net/stubbles/helper/validators/stubMaxNumberValidator.php (modified) (4 diffs)
- trunk/src/main/php/net/stubbles/helper/validators/stubMinLengthValidator.php (modified) (4 diffs)
- trunk/src/main/php/net/stubbles/helper/validators/stubMinNumberValidator.php (modified) (5 diffs)
- trunk/src/main/php/net/stubbles/helper/validators/stubOrValidator.php (modified) (3 diffs)
- trunk/src/main/php/net/stubbles/helper/validators/stubPreSelectValidator.php (modified) (2 diffs)
- trunk/src/main/php/net/stubbles/helper/validators/stubRegexValidator.php (modified) (4 diffs)
- trunk/src/main/php/net/stubbles/helper/validators/stubValidator.php (modified) (3 diffs)
- trunk/src/main/php/net/stubbles/helper/validators/stubXorValidator.php (modified) (3 diffs)
- trunk/src/main/php/net/stubbles/ipo/request/filters/stubAbstractStringFilter.php (modified) (1 diff)
- trunk/src/main/php/net/stubbles/ipo/request/filters/stubNumberFilter.php (modified) (1 diff)
- trunk/src/main/php/net/stubbles/ipo/request/filters/stubPasswordFilter.php (modified) (1 diff)
- trunk/src/test/php/net/stubbles/helper/BinfordTestCase.php (modified) (2 diffs)
- trunk/src/test/php/net/stubbles/helper/validators/stubAndValidatorTestCase.php (modified) (1 diff)
- trunk/src/test/php/net/stubbles/helper/validators/stubEqualValidatorTestCase.php (modified) (1 diff)
- trunk/src/test/php/net/stubbles/helper/validators/stubMaxLengthValidatorTestCase.php (modified) (1 diff)
- trunk/src/test/php/net/stubbles/helper/validators/stubMaxNumberValidatorTestCase.php (modified) (1 diff)
- trunk/src/test/php/net/stubbles/helper/validators/stubMinLengthValidatorTestCase.php (modified) (1 diff)
- trunk/src/test/php/net/stubbles/helper/validators/stubMinNumberValidatorTestCase.php (modified) (1 diff)
- trunk/src/test/php/net/stubbles/helper/validators/stubOrValidatorTestCase.php (modified) (2 diffs)
- trunk/src/test/php/net/stubbles/helper/validators/stubPreSelectValidatorTestCase.php (modified) (1 diff)
- trunk/src/test/php/net/stubbles/helper/validators/stubRegexValidatorTestCase.php (modified) (1 diff)
- trunk/src/test/php/net/stubbles/helper/validators/stubXorValidatorTestCase.php (modified) (1 diff)
- trunk/src/test/php/net/stubbles/ipo/request/filters/stubFloatFilterTestCase.php (modified) (2 diffs)
- trunk/src/test/php/net/stubbles/ipo/request/filters/stubIntegerFilterTestCase.php (modified) (2 diffs)
- trunk/src/test/php/net/stubbles/ipo/request/filters/stubPasswordFilterTestCase.php (modified) (2 diffs)
- trunk/src/test/php/net/stubbles/ipo/request/filters/stubStringFilterTestCase.php (modified) (2 diffs)
- trunk/src/test/php/net/stubbles/ipo/request/filters/stubTextFilterTestCase.php (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/src/main/php/net/stubbles/helper/Binford.php
r97 r140 49 49 50 50 /** 51 * returns a list of criteria sfor the validator51 * returns a list of criteria for the validator 52 52 * 53 * @return array<string,mixed> key is criteria name, value is criteria value 53 * <code> 54 * array('allowedValues' => array(6100, 'Binford', 'Binford 6100'); 55 * </code> 56 * 57 * @return array<string,mixed> key is criterion name, value is criterion value 54 58 */ 55 public function getCriteria s()59 public function getCriteria() 56 60 { 57 return array( );61 return array('allowedValues' => array(self::POWER, 'Binford', 'Binford ' . self::POWER)); 58 62 } 59 63 trunk/src/main/php/net/stubbles/helper/validators/stubAbstractCompositeValidator.php
r97 r140 10 10 /** 11 11 * Base class for composite validators. 12 * 13 * A composite validator can be used to combine two or more validators 14 * into a single validator which then applies all those validators for the 15 * value to validate. 12 16 * 13 17 * @package stubbles … … 17 21 { 18 22 /** 19 * list of validators to co nnect23 * list of validators to combine 20 24 * 21 25 * @var array<stubValidator> … … 46 50 } 47 51 48 return $this-> validateReal($value);52 return $this->doValidate($value); 49 53 } 50 54 … … 55 59 * @return bool true if value is ok, else false 56 60 */ 57 protected abstract function validateReal($value);61 protected abstract function doValidate($value); 58 62 59 63 /** 60 * returns a list of criteria sfor the validator64 * returns a list of criteria for the validator 61 65 * 62 * @return array<string,mixed> key is criteri a name, value is criteriavalue66 * @return array<string,mixed> key is criterion name, value is criterion value 63 67 */ 64 public function getCriteria s()68 public function getCriteria() 65 69 { 66 70 $criterias = array(); 67 71 foreach ($this->validators as $validator) { 68 $criterias = array_merge($criterias, $validator->getCriteria s());72 $criterias = array_merge($criterias, $validator->getCriteria()); 69 73 } 70 74 trunk/src/main/php/net/stubbles/helper/validators/stubAndValidator.php
r97 r140 1 1 <?php 2 2 /** 3 * Class that co nnects differant validators that all have to be true in order3 * Class that combines differant validators that all have to be true in order 4 4 * that this validator also reports true. 5 5 * … … 10 10 stubClassLoader::load('net.stubbles.helper.validators.stubAbstractCompositeValidator'); 11 11 /** 12 * Class that co nnects differant validators that all have to be true in order12 * Class that combines differant validators that all have to be true in order 13 13 * that this validator also reports true. 14 * 15 * If any of the combined validators returns false the stubAndValidator 16 * will return false as well. 14 17 * 15 18 * @package stubbles … … 20 23 /** 21 24 * validate the given value 25 * 26 * If any of the validators returns false this will return false as well. 22 27 * 23 28 * @param mixed $value 24 29 * @return bool true if value is ok, else false 25 30 */ 26 protected function validateReal($value)31 protected function doValidate($value) 27 32 { 28 33 foreach ($this->validators as $validator) { trunk/src/main/php/net/stubbles/helper/validators/stubCompositeValidator.php
r97 r140 1 1 <?php 2 2 /** 3 * Base classfor composite validators.3 * Interface for composite validators. 4 4 * 5 5 * @author Frank Kleine <mikey@stubbles.net> … … 9 9 stubClassLoader::load('net.stubbles.helper.validators.stubValidator'); 10 10 /** 11 * Base class for composite validators. 11 * Interface for composite validators. 12 * 13 * Composite validators can be used to combine two or more validators 14 * into a single validator. 12 15 * 13 16 * @package stubbles trunk/src/main/php/net/stubbles/helper/validators/stubEqualValidator.php
r97 r140 10 10 /** 11 11 * Class for validating that something is equal. 12 * 13 * This class can compare any scalar value with an expected value. The 14 * value to validate has to be of the same type and should have the same 15 * content as the expected value. 12 16 * 13 17 * @package stubbles … … 26 30 * constructor 27 31 * 28 * @param mixed$expected29 * @throws ValidatorException32 * @param scalar|null $expected 33 * @throws stubValidatorException 30 34 */ 31 35 public function __construct($expected) … … 39 43 40 44 /** 41 * validate th e givenvalue45 * validate that the given value is eqal in content and type to the expected value 42 46 * 43 * @param mixed$value44 * @return bool true if value is equal to expected value, else false45 * @throws ValidatorException47 * @param scalar|null $value 48 * @return bool true if value is equal to expected value, else false 49 * @throws stubValidatorException 46 50 */ 47 51 public function validate($value) … … 59 63 60 64 /** 61 * returns a list of criterias for the validator 65 * returns a list of criteria for the validator 66 * 67 * <code> 68 * array('expected' => [expected_value]); 69 * </code> 62 70 * 63 * @return array<string, mixed> key is criteria name, value is criteriavalue71 * @return array<string,mixed> key is criterion name, value is criterion value 64 72 */ 65 public function getCriteria s()73 public function getCriteria() 66 74 { 67 75 return array('expected' => $this->expected); trunk/src/main/php/net/stubbles/helper/validators/stubMaxLengthValidator.php
r97 r140 1 1 <?php 2 2 /** 3 * Validator to ensure a valueis not longer than a given maximum length.3 * Validator to ensure that a string is not longer than a given maximum length. 4 4 * 5 5 * @author Frank Kleine <mikey@stubbles.net> … … 9 9 stubClassLoader::load('net.stubbles.helper.validators.stubValidator'); 10 10 /** 11 * Validator to ensure a valueis not longer than a given maximum length.11 * Validator to ensure that a string is not longer than a given maximum length. 12 12 * 13 13 * @package stubbles … … 34 34 35 35 /** 36 * validate th e given value36 * validate that the given value is not longer than the maximum length 37 37 * 38 * @param mixed$value39 * @return bool true if value is not longer than maximal length, else false38 * @param string $value 39 * @return bool true if value is not longer than maximal length, else false 40 40 */ 41 41 public function validate($value) … … 49 49 50 50 /** 51 * returns a list of criterias for the validator 51 * returns a list of criteria for the validator 52 * 53 * <code> 54 * array('maxLength' => [max_length_of_string]); 55 * </code> 52 56 * 53 * @return array<string, mixed> key is criteria name, value is criteriavalue57 * @return array<string,mixed> key is criterion name, value is criterion value 54 58 */ 55 public function getCriteria s()59 public function getCriteria() 56 60 { 57 61 return array('maxLength' => $this->maxLength); trunk/src/main/php/net/stubbles/helper/validators/stubMaxNumberValidator.php
r97 r140 1 1 <?php 2 2 /** 3 * Validator to ensure a value is not greater than a given maximum value.3 * Validator to ensure that a value is not greater than a given maximum value. 4 4 * 5 5 * @author Frank Kleine <mikey@stubbles.net> … … 9 9 stubClassLoader::load('net.stubbles.helper.validators.stubValidator'); 10 10 /** 11 * Validator to ensure a value is not greater than a given maximum value.11 * Validator to ensure that a value is not greater than a given maximum value. 12 12 * 13 13 * @package stubbles … … 21 21 * @var string 22 22 */ 23 protected $max ;23 protected $maxValue; 24 24 25 25 /** 26 26 * constructor 27 27 * 28 * @param int|double $max maximum value28 * @param int|double $maxValue maximum value 29 29 */ 30 public function __construct($max )30 public function __construct($maxValue) 31 31 { 32 $this->max = $max;32 $this->maxValue = $maxValue; 33 33 } 34 34 35 35 /** 36 * validate th e givenvalue36 * validate that the given value is smaller than or equal to the maximum value 37 37 * 38 * @param mixed$value39 * @return bool true if value is not greater thanmaximum value, else false38 * @param int|double $value 39 * @return bool true if value is smaller than or equal to maximum value, else false 40 40 */ 41 41 public function validate($value) 42 42 { 43 if ($value > $this->max ) {43 if ($value > $this->maxValue) { 44 44 return false; 45 45 } … … 49 49 50 50 /** 51 * returns a list of criterias for the validator 51 * returns a list of criteria for the validator 52 * 53 * <code> 54 * array('maxNumber' => [maximum_value]); 55 * </code> 52 56 * 53 * @return array<string, mixed> key is criteria name, value is criteriavalue57 * @return array<string,mixed> key is criterion name, value is criterion value 54 58 */ 55 public function getCriteria s()59 public function getCriteria() 56 60 { 57 return array('maxNumber' => $this->max );61 return array('maxNumber' => $this->maxValue); 58 62 } 59 63 } trunk/src/main/php/net/stubbles/helper/validators/stubMinLengthValidator.php
r97 r140 1 1 <?php 2 2 /** 3 * Validator to ensure a valueis not shorter than a given minimum length.3 * Validator to ensure that a string is not shorter than a given minimum length. 4 4 * 5 5 * @author Frank Kleine <mikey@stubbles.net> … … 9 9 stubClassLoader::load('net.stubbles.helper.validators.stubValidator'); 10 10 /** 11 * Validator to ensure a valueis not shorter than a given minimum length.11 * Validator to ensure that a string is not shorter than a given minimum length. 12 12 * 13 13 * @package stubbles … … 34 34 35 35 /** 36 * validate th e given value36 * validate that the given value is not shorter than the maximum length 37 37 * 38 * @param mixed$value39 * @return bool true if value is not shorter than minimum length, else false38 * @param string $value 39 * @return bool true if value is not shorter than minimum length, else false 40 40 */ 41 41 public function validate($value) … … 49 49 50 50 /** 51 * returns a list of criteria sfor the validator51 * returns a list of criteria for the validator 52 52 * 53 * @return array<string, mixed> key is criteria name, value is criteria value 53 * <code> 54 * array('minLength' => [min_length_of_string]); 55 * </code> 56 * 57 * @return array<string,mixed> key is criterion name, value is criterion value 54 58 */ 55 public function getCriteria s()59 public function getCriteria() 56 60 { 57 61 return array('minLength' => $this->minLength); trunk/src/main/php/net/stubbles/helper/validators/stubMinNumberValidator.php
r97 r140 1 1 <?php 2 2 /** 3 * Validator to ensure a value is not smaller than a given minimum value.3 * Validator to ensure that a value is not smaller than a given minimum value. 4 4 * 5 5 * @author Frank Kleine <mikey@stubbles.net> … … 9 9 stubClassLoader::load('net.stubbles.helper.validators.stubValidator'); 10 10 /** 11 * Validator to ensure a value is not smaller than a given minimum value.11 * Validator to ensure that a value is not smaller than a given minimum value. 12 12 * 13 13 * @package stubbles … … 21 21 * @var string 22 22 */ 23 protected $min ;23 protected $minValue; 24 24 25 25 /** … … 28 28 * @param int|double $min minimum value 29 29 */ 30 public function __construct($min )30 public function __construct($minValue) 31 31 { 32 $this->min = $min;32 $this->minValue = $minValue; 33 33 } 34 34 35 35 /** 36 * validate th e givenvalue36 * validate that the given value is greater than or equal to the maximum value 37 37 * 38 * @param mixed$value39 * @return bool true if value is not smaller thanminimum value, else false38 * @param int|double $value 39 * @return bool true if value is greater than or equal to minimum value, else false 40 40 */ 41 41 public function validate($value) 42 42 { 43 if ($value < $this->min ) {43 if ($value < $this->minValue) { 44 44 return false; 45 45 } … … 49 49 50 50 /** 51 * returns a list of criteria sfor the validator51 * returns a list of criteria for the validator 52 52 * 53 * @return array<string, mixed> key is criteria name, value is criteria value 53 * <code> 54 * array('minNumber' => [minimum_value]); 55 * </code> 56 * 57 * @return array<string,mixed> key is criterion name, value is criterion value 54 58 */ 55 public function getCriteria s()59 public function getCriteria() 56 60 { 57 return array('minNumber' => $this->min );61 return array('minNumber' => $this->minValue); 58 62 } 59 63 } trunk/src/main/php/net/stubbles/helper/validators/stubOrValidator.php
r97 r140 1 1 <?php 2 2 /** 3 * Class that co nnects differant validators where one has to be true.3 * Class that combines differant validators where one has to be true. 4 4 * 5 5 * @author Frank Kleine <mikey@stubbles.net> … … 9 9 stubClassLoader::load('net.stubbles.helper.validators.stubAbstractCompositeValidator'); 10 10 /** 11 * Class that connects differant validators where one has to be true. 11 * Class that combines differant validators where one has to be true. 12 * 13 * If any of the combined validators returns true the stubOrValidator 14 * will return true as well. 12 15 * 13 16 * @package stubbles … … 18 21 /** 19 22 * validate the given value 23 * 24 * If any of the validators returns true this will return true as well. 20 25 * 21 26 * @param mixed $value 22 27 * @return bool true if value is ok, else false 23 28 */ 24 protected function validateReal($value)29 protected function doValidate($value) 25 30 { 26 31 foreach ($this->validators as $validator) { trunk/src/main/php/net/stubbles/helper/validators/stubPreSelectValidator.php
r97 r140 34 34 35 35 /** 36 * validate th e given value36 * validate that the given value is within a list of allowed values 37 37 * 38 38 * @param mixed $value 39 39 * @return bool true if value is in list of allowed values, else false 40 * @todo fix arrays: if $value is an array consisting of several values 41 * each value has to be checked seperately if it is an allowed one 40 42 */ 41 43 public function validate($value) … … 45 47 46 48 /** 47 * returns a list of criteria sfor the validator49 * returns a list of criteria for the validator 48 50 * 49 * @return array<string, mixed> key is criteria name, value is criteria value 51 * <code> 52 * array('allowedValues' => [array_of_allowed_values]); 53 * </code> 54 * 55 * @return array<string,array> key is criterion name, value is criterion value 50 56 */ 51 public function getCriteria s()57 public function getCriteria() 52 58 { 53 59 return array('allowedValues' => $this->allowedValues); trunk/src/main/php/net/stubbles/helper/validators/stubRegexValidator.php
r97 r140 10 10 /** 11 11 * Validator to ensure a value complies to a given regular expression. 12 * 13 * The validator uses preg_match() and checks if the value occurs exactly 14 * one time. Please note that a delimiter is automatically applied. The used 15 * delimiter is /, therefore it must be escaped if this character is part of 16 * the regular expression. 12 17 * 13 18 * @package stubbles … … 25 30 /** 26 31 * constructor 32 * 33 * Please note that a delimiter is automatically applied. The used 34 * delimiter is /, therefore it must be escaped if this character 35 * is part of the regular expression. 27 36 * 28 37 * @param string $regex regular expression to use for validation … … 34 43 35 44 /** 36 * validate th e given value37 * 45 * validate that the given value complies with the regular expression 46 * 38 47 * @param mixed $value 39 * @return bool true if value is ok, else false48 * @return bool true if value complies with regular expression, else false 40 49 */ 41 50 public function validate($value) 42 51 { 43 // check if regular expression is fulfilled which means that at44 // least one occurrence must be found45 52 if (preg_match('/' . $this->regex . '/', $value) != 1) { 46 53 return false; … … 51 58 52 59 /** 53 * returns a list of criteria sfor the validator60 * returns a list of criteria for the validator 54 61 * 55 * @return array<string, mixed> key is criteria name, value is criteria value 62 * <code> 63 * array('regex' => [regular_expression]); 64 * </code> 65 * 66 * @return array<string,mixed> key is criterion name, value is criterion value 56 67 */ 57 public function getCriteria s()68 public function getCriteria() 58 69 { 59 70 return array('regex' => $this->regex); trunk/src/main/php/net/stubbles/helper/validators/stubValidator.php
r97 r140 10 10 /** 11 11 * Interface for validators. 12 * 13 * Validators allow simple checks whether a value fulfils a set of criteria. 12 14 * 13 15 * @package stubbles … … 18 20 /** 19 21 * validate the given value 22 * 23 * Returns true if the value does fulfils all of the criteria, else false. 20 24 * 21 25 * @param mixed $value … … 26 30 27 31 /** 28 * returns a list of criteria sfor the validator32 * returns a list of criteria for the validator 29 33 * 30 * @return array<string,mixed> key is criteri a name, value is criteriavalue34 * @return array<string,mixed> key is criterion name, value is criterion value 31 35 */ 32 public function getCriteria s();36 public function getCriteria(); 33 37 } 34 38 ?> trunk/src/main/php/net/stubbles/helper/validators/stubXorValidator.php
r97 r140 1 1 <?php 2 2 /** 3 * Class that co nnects differant validators where one has to be true.3 * Class that combines differant validators where one has to be true. 4 4 * 5 5 * @author Frank Kleine <mikey@stubbles.net> … … 9 9 stubClassLoader::load('net.stubbles.helper.validators.stubAbstractCompositeValidator'); 10 10 /** 11 * Class that connects differant validators where one has to be true. 11 * Class that combines differant validators where one has to be true. 12 * 13 * If no validator or more than one validator returns false the stubXorValidator 14 * will return false as well. It only returns true if one validator returns true 15 * and any other validator returns false. 12 16 * 13 17 * @package stubbles … … 18 22 /** 19 23 * validate the given value 24 * 25 * If no validator or more than one validator returns false it 26 * will return false as well. It only returns true if one 27 * validator returns true and any other validator returns false. 20 28 * 21 29 * @param mixed $value 22 30 * @return bool true if value is ok, else false 23 31 */ 24 protected function validateReal($value)32 protected function doValidate($value) 25 33 { 26 34 $trueCount = 0; 27 35 foreach ($this->validators as $validator) { 28 if ($validator->validate($value) == true) { 29 $trueCount++; 30 if (1 < $trueCount) { 31 return false; 32 } 36 if ($validator->validate($value) == false) { 37 continue; 38 } 39 40 $trueCount++; 41 if (1 < $trueCount) { 42 // more than one true received, 43 // can not return with true any more 44 return false; 33 45 } 34 46 } 35 47 36 if (0 == $trueCount) { 37 return false; 38 } 39 40 return true; 48 return (1 == $trueCount); 41 49 } 42 50 } trunk/src/main/php/net/stubbles/ipo/request/filters/stubAbstractStringFilter.php
r97 r140 65 65 // if input is shorter than maximal allowed length 66 66 } elseif (null != $this->minLength && $this->minLength->validate($value) == false) { 67 throw new stubFilterException($this->rveFactory->create('STRING_TOO_SHORT')->setValues($this->minLength->getCriteria s()));67 throw new stubFilterException($this->rveFactory->create('STRING_TOO_SHORT')->setValues($this->minLength->getCriteria())); 68 68 // if input is longer than maximal allowed length 69 69 } elseif (null != $this->maxLength && $this->maxLength->validate($value) == false) { 70 throw new stubFilterException($this->rveFactory->create('STRING_TOO_LONG')->setValues($this->maxLength->getCriteria s()));70 throw new stubFilterException($this->rveFactory->create('STRING_TOO_LONG')->setValues($this->maxLength->getCriteria())); 71 71 } 72 72 trunk/src/main/php/net/stubbles/ipo/request/filters/stubNumberFilter.php
r97 r140 73 73 } elseif (null !== $value && null != $this->minValidator && $this->minValidator->validate($value) != true) { 74 74 // add error message if input is smaller than minimum value 75 throw new stubFilterException($this->rveFactory->create('VALUE_TOO_SMALL')->setValues($this->minValidator->getCriteria s()));75 throw new stubFilterException($this->rveFactory->create('VALUE_TOO_SMALL')->setValues($this->minValidator->getCriteria())); 76 76 } elseif (null !== $value && null != $this->maxValidator && $this->maxValidator->validate($value) != true) { 77 77 // add error message if input is greater than maximum value 78 throw new stubFilterException($this->rveFactory->create('VALUE_TOO_GREAT')->setValues($this->maxValidator->getCriteria s()));78 throw new stubFilterException($this->rveFactory->create('VALUE_TOO_GREAT')->setValues($this->maxValidator->getCriteria())); 79 79 } 80 80 trunk/src/main/php/net/stubbles/ipo/request/filters/stubPasswordFilter.php
r97 r140 73 73 74 74 if ($this->minLength->validate($value) == false) { 75 throw new stubFilterException($this->rveFactory->create('STRING_TOO_SHORT')->setValues($this->minLength->getCriteria s()));75 throw new stubFilterException($this->rveFactory->create('STRING_TOO_SHORT')->setValues($this->minLength->getCriteria())); 76 76 } 77 77 trunk/src/test/php/net/stubbles/helper/BinfordTestCase.php
r98 r140 32 32 33 33 /** 34 * assure that values are returned as they are put into the registry34 * assure that values are returned as expected 35 35 */ 36 36 public function testValidate() … … 41 41 $this->assertFalse($this->binford->validate('Bob Vila')); 42 42 } 43 44 /** 45 * assure that values are returned as expected 46 */ 47 public function testGetCriteria() 48 { 49 $this->assertEqual($this->binford->getCriteria(), array('allowedValues' => array(Binford::POWER, 'Binford', 'Binford ' . Binford::POWER))); 50 } 43 51 44 52 /** 45 * assure that values are returned as they are put into the config registry53 * assure that values are returned as expected 46 54 */ 47 55 public function testFilter() trunk/src/test/php/net/stubbles/helper/validators/stubAndValidatorTestCase.php
r98 r140 62 62 { 63 63 $mockValidator1 = new MockstubValidator(); 64 $mockValidator1->setReturnValue('getCriteria s', array('foo' => 'bar'));64 $mockValidator1->setReturnValue('getCriteria', array('foo' => 'bar')); 65 65 $this->andValidator->addValidator($mockValidator1); 66 66 $mockValidator2 = new MockstubValidator(); 67 $mockValidator2->setReturnValue('getCriteria s', array('bar' => 'baz'));67 $mockValidator2->setReturnValue('getCriteria', array('bar' => 'baz')); 68 68 $this->andValidator->addValidator($mockValidator2); 69 $this->assertEqual($this->andValidator->getCriteria s(), array('foo' => 'bar', 'bar' => 'baz'));69 $this->assertEqual($this->andValidator->getCriteria(), array('foo' => 'bar', 'bar' => 'baz')); 70 70 } 71 71 } trunk/src/test/php/net/stubbles/helper/validators/stubEqualValidatorTestCase.php
r98 r140 86 86 { 87 87 $equalValidator = new stubEqualValidator(5); 88 $this->assertEqual($equalValidator->getCriteria s(), array('expected' => 5));88 $this->assertEqual($equalValidator->getCriteria(), array('expected' => 5)); 89 89 90 90 $equalValidator = new stubEqualValidator('foo'); 91 $this->assertEqual($equalValidator->getCriteria s(), array('expected' => 'foo'));91 $this->assertEqual($equalValidator->getCriteria(), array('expected' => 'foo')); 92 92 93 93 $equalValidator = new stubEqualValidator(true); 94 $this->assertEqual($equalValidator->getCriteria s(), array('expected' => true));94 $this->assertEqual($equalValidator->getCriteria(), array('expected' => true)); 95 95 96 96 $equalValidator = new stubEqualValidator(false); 97 $this->assertEqual($equalValidator->getCriteria s(), array('expected' => false));97 $this->assertEqual($equalValidator->getCriteria(), array('expected' => false)); 98 98 99 99 $equalValidator = new stubEqualValidator(null); 100 $this->assertEqual($equalValidator->getCriteria s(), array('expected' => null));100 $this->assertEqual($equalValidator->getCriteria(), array('expected' => null)); 101 101 } 102 102 } trunk/src/test/php/net/stubbles/helper/validators/stubMaxLengthValidatorTestCase.php
r98 r140 48 48 public function testGetCriteria() 49 49 { 50 $this->assertEqual($this->maxLengthValidator->getCriteria s(), array('maxLength' => 5));50 $this->assertEqual($this->maxLengthValidator->getCriteria(), array('maxLength' => 5)); 51 51 } 52 52 } trunk/src/test/php/net/stubbles/helper/validators/stubMaxNumberValidatorTestCase.php
r98 r140 50 50 public function testGetCriteria() 51 51 { 52 $this->assertEqual($this->maxNumberValidator->getCriteria s(), array('maxNumber' => 5));52 $this->assertEqual($this->maxNumberValidator->getCriteria(), array('maxNumber' => 5)); 53 53 } 54 54 } trunk/src/test/php/net/stubbles/helper/validators/stubMinLengthValidatorTestCase.php
r98 r140 48 48 public function testGetCriteria() 49 49 { 50 $this->assertEqual($this->minLengthValidator->getCriteria s(), array('minLength' => 5));50 $this->assertEqual($this->minLengthValidator->getCriteria(), array('minLength' => 5)); 51 51 } 52 52 } trunk/src/test/php/net/stubbles/helper/validators/stubMinNumberValidatorTestCase.php
r98 r140 50 50 public function testGetCriteria() 51 51 { 52 $this->assertEqual($this->minNumberValidator->getCriteria s(), array('minNumber' => 5));52 $this->assertEqual($this->minNumberValidator->getCriteria(), array('minNumber' => 5)); 53 53 } 54 54 }
