Changeset 1037
- Timestamp:
- 11/13/07 16:00:24 (1 year ago)
- Files:
-
- trunk/src/main/php/net/stubbles/ipo/request/filters/stubAbstractStringFilter.php (modified) (2 diffs)
- trunk/src/main/php/net/stubbles/ipo/request/filters/stubHTTPURLFilter.php (modified) (5 diffs)
- trunk/src/main/php/net/stubbles/ipo/request/filters/stubMailFilter.php (modified) (4 diffs)
- trunk/src/main/php/net/stubbles/ipo/request/filters/stubNumberFilter.php (modified) (4 diffs)
- trunk/src/main/php/net/stubbles/ipo/request/filters/stubPasswordFilter.php (modified) (5 diffs)
- trunk/src/main/php/net/stubbles/ipo/request/filters/stubStringFilter.php (modified) (3 diffs)
- trunk/src/main/php/net/stubbles/ipo/request/stubRequestValueErrorFactoryMappingDecorator.php (added)
- trunk/src/test/php/net/stubbles/ipo/IPOTestSuite.php (modified) (1 diff)
- trunk/src/test/php/net/stubbles/ipo/request/filters/stubFloatFilterTestCase.php (modified) (3 diffs)
- trunk/src/test/php/net/stubbles/ipo/request/filters/stubHTTPURLFilterTestCase.php (modified) (3 diffs)
- trunk/src/test/php/net/stubbles/ipo/request/filters/stubIntegerFilterTestCase.php (modified) (3 diffs)
- trunk/src/test/php/net/stubbles/ipo/request/filters/stubMailFilterTestCase.php (modified) (1 diff)
- trunk/src/test/php/net/stubbles/ipo/request/filters/stubPasswordFilterTestCase.php (modified) (4 diffs)
- trunk/src/test/php/net/stubbles/ipo/request/stubRequestValueErrorFactoryMappingDecoratorTestCase.php (added)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/src/main/php/net/stubbles/ipo/request/filters/stubAbstractStringFilter.php
r1033 r1037 47 47 */ 48 48 protected $encoderMode = stubStringEncoder::MODE_DECODE; 49 /**50 * default value for empty field51 *52 * @var string53 */54 protected $emptyErrorId = 'FIELD_EMPTY';55 49 56 /**57 * set a min length validator58 *59 * @param stubValidator $minLength60 */61 public function setEmptyErrorId($errorId)62 {63 $this->emptyErrorId = $errorId;64 }65 66 50 /** 67 51 * set a min length validator … … 149 133 // if input length is zero but input is required 150 134 if ((null == $value || strlen($value) == 0) && true == $this->isRequired) { 151 throw new stubFilterException($this->rveFactory->create( $this->emptyErrorId));135 throw new stubFilterException($this->rveFactory->create('FIELD_EMPTY')); 152 136 // if input is shorter than maximal allowed length 153 137 } elseif (null != $this->minLength && $this->minLength->validate($value) == false) { trunk/src/main/php/net/stubbles/ipo/request/filters/stubHTTPURLFilter.php
r1029 r1037 19 19 { 20 20 /** 21 * default error id if URL is not correct22 */23 const URL_INCORRECT = 'URL_INCORRECT';24 /**25 * default error id if URL is not available26 */27 const URL_NOT_AVAILABLE = 'URL_NOT_AVAILABLE';28 /**29 21 * switch whether DNS should be checked or not 30 22 * … … 32 24 */ 33 25 protected $checkDNS = false; 34 /**35 * list of error ids to be used by this filter36 *37 * @var array<string,string>38 */39 protected $errorIds = array(self::URL_INCORRECT => self::URL_INCORRECT,40 self::URL_NOT_AVAILABLE => self::URL_NOT_AVAILABLE41 );42 26 43 27 /** … … 72 56 73 57 /** 74 * sets the error id to be used in case the filter finds an error in the value75 *76 * @param string $type type of error, one of the stubHTTPURLFilter::URL_* constants77 * @param string $errorId the id of the error object to use78 */79 public function setErrorId($type, $errorId)80 {81 if (isset($this->errorIds[$type]) === false) {82 throw new stubIllegalArgumentException('Illegal type ' . $type . ' given. Allowed types are ' . join(', ', array_keys($this->errorIds)) . '.');83 }84 85 $this->errorIds[$type] = $errorId;86 }87 88 /**89 58 * check if value is a valid HTTP URL 90 59 * … … 98 67 $http = stubHTTPURL::fromString($value); 99 68 } catch (stubMalformedURLException $murle) { 100 throw new stubFilterException($this->rveFactory->create( $this->errorIds[self::URL_INCORRECT]));69 throw new stubFilterException($this->rveFactory->create('URL_INCORRECT')); 101 70 } 102 71 103 72 if (null === $http) { 104 73 if (true === $this->isRequired) { 105 throw new stubFilterException($this->rveFactory->create( $this->errorIds[self::URL_INCORRECT]));74 throw new stubFilterException($this->rveFactory->create('URL_INCORRECT')); 106 75 } 107 76 … … 110 79 111 80 if (true === $this->checkDNS && $http->checkDNS() == false) { 112 throw new stubFilterException($this->rveFactory->create( $this->errorIds[self::URL_NOT_AVAILABLE]));81 throw new stubFilterException($this->rveFactory->create('URL_NOT_AVAILABLE')); 113 82 } 114 83 trunk/src/main/php/net/stubbles/ipo/request/filters/stubMailFilter.php
r1030 r1037 18 18 { 19 19 /** 20 * error id for incorrect mail address21 */22 const MAILADDRESS_INCORRECT = 'MAILADDRESS_INCORRECT';23 /**24 20 * validator to use for checking the mail address 25 21 * … … 27 23 */ 28 24 protected $mailValidator; 29 /**30 * list of error ids to be used by this filter31 *32 * @var array<string,string>33 */34 protected $errorIds = array(self::MAILADDRESS_INCORRECT => self::MAILADDRESS_INCORRECT);35 25 36 26 /** … … 47 37 48 38 /** 49 * sets the error id to be used in case the filter finds an error in the value50 *51 * @param string $type type of error, one of the stubHTTPURLFilter::URL_* constants52 * @param string $errorId the id of the error object to use53 */54 public function setErrorId($type, $errorId)55 {56 if (isset($this->errorIds[$type]) === false) {57 throw new stubIllegalArgumentException('Illegal type ' . $type . ' given. Allowed types are ' . join(', ', array_keys($this->errorIds)) . '.');58 }59 60 $this->errorIds[$type] = $errorId;61 }62 63 /**64 39 * check if entered passwords fulfill password conditions 65 40 * … … 71 46 { 72 47 if ($this->mailValidator->validate($value) === false) { 73 throw new stubFilterException($this->rveFactory->create( $this->errorIds[self::MAILADDRESS_INCORRECT]));48 throw new stubFilterException($this->rveFactory->create('MAILADDRESS_INCORRECT')); 74 49 } 75 50 trunk/src/main/php/net/stubbles/ipo/request/filters/stubNumberFilter.php
r1031 r1037 24 24 { 25 25 /** 26 * default error id if field was empty27 */28 const FIELD_EMPTY = 'FIELD_EMPTY';29 /**30 * default error id if value is too small31 */32 const VALUE_TOO_SMALL = 'VALUE_TOO_SMALL';33 /**34 * default error id if value is too great35 */36 const VALUE_TOO_GREAT = 'VALUE_TOO_GREAT';37 /**38 26 * validator for minimum values 39 27 * … … 47 35 */ 48 36 protected $maxValidator = null; 49 /**50 * list of error ids to be used by this filter51 *52 * @var array<string,string>53 */54 protected $errorIds = array(self::FIELD_EMPTY => self::FIELD_EMPTY,55 self::VALUE_TOO_SMALL => self::VALUE_TOO_SMALL,56 self::VALUE_TOO_GREAT => self::VALUE_TOO_GREAT57 );58 37 59 38 /** … … 92 71 93 72 /** 94 * sets the error id to be used in case the filter finds an error in the value95 *96 * @param string $type type of error, one of the stubHTTPURLFilter::URL_* constants97 * @param string $errorId the id of the error object to use98 */99 public function setErrorId($type, $errorId)100 {101 if (isset($this->errorIds[$type]) === false) {102 throw new stubIllegalArgumentException('Illegal type ' . $type . ' given. Allowed types are ' . join(', ', array_keys($this->errorIds)) . '.');103 }104 105 $this->errorIds[$type] = $errorId;106 }107 108 /**109 73 * checks if given value exceeds borders 110 74 * … … 130 94 if ((null === $value || strlen($value) === 0) && true === $this->isRequired) { 131 95 // add error message if there is no input and input is needed 132 throw new stubFilterException($this->rveFactory->create( $this->errorIds[self::FIELD_EMPTY]));96 throw new stubFilterException($this->rveFactory->create('FIELD_EMPTY')); 133 97 } elseif (null !== $value && null !== $this->minValidator && $this->minValidator->validate($value) !== true) { 134 98 // add error message if input is smaller than minimum value 135 throw new stubFilterException($this->rveFactory->create( $this->errorIds[self::VALUE_TOO_SMALL])->setValues($this->minValidator->getCriteria()));99 throw new stubFilterException($this->rveFactory->create('VALUE_TOO_SMALL')->setValues($this->minValidator->getCriteria())); 136 100 } elseif (null !== $value && null !== $this->maxValidator && $this->maxValidator->validate($value) !== true) { 137 101 // add error message if input is greater than maximum value 138 throw new stubFilterException($this->rveFactory->create( $this->errorIds[self::VALUE_TOO_GREAT])->setValues($this->maxValidator->getCriteria()));102 throw new stubFilterException($this->rveFactory->create('VALUE_TOO_GREAT')->setValues($this->maxValidator->getCriteria())); 139 103 } 140 104 trunk/src/main/php/net/stubbles/ipo/request/filters/stubPasswordFilter.php
r1032 r1037 31 31 { 32 32 /** 33 * default error id if passwords are not equal34 */35 const PASSWORDS_NOT_EQUAL = 'PASSWORDS_NOT_EQUAL';36 /**37 * default error id if password is too short38 */39 const STRING_TOO_SHORT = 'STRING_TOO_SHORT';40 /**41 * default error id if password is invalid42 */43 const PASSWORD_INVALID = 'PASSWORD_INVALID';44 /**45 * default error id if password has too less different characters46 */47 const PASSWORD_TOO_LESS_DIFF_CHARS = 'PASSWORD_TOO_LESS_DIFF_CHARS';48 /**49 33 * validator to use for checking the minimum length of the password 50 34 * … … 70 54 */ 71 55 protected $encoder; 72 /**73 * list of error ids to be used by this filter74 *75 * @var array<string,string>76 */77 protected $errorIds = array(self::PASSWORDS_NOT_EQUAL => self::PASSWORDS_NOT_EQUAL,78 self::STRING_TOO_SHORT => self::STRING_TOO_SHORT,79 self::PASSWORD_INVALID => self::PASSWORD_INVALID,80 self::PASSWORD_TOO_LESS_DIFF_CHARS => self::PASSWORD_TOO_LESS_DIFF_CHARS81 );82 56 83 57 /** … … 156 130 157 131 /** 158 * sets the error id to be used in case the filter finds an error in the value159 *160 * @param string $type type of error, one of the stubHTTPURLFilter::URL_* constants161 * @param string $errorId the id of the error object to use162 */163 public function setErrorId($type, $errorId)164 {165 if (isset($this->errorIds[$type]) === false) {166 throw new stubIllegalArgumentException('Illegal type ' . $type . ' given. Allowed types are ' . join(', ', array_keys($this->errorIds)) . '.');167 }168 169 $this->errorIds[$type] = $errorId;170 }171 172 /**173 132 * check if entered passwords fulfill password conditions 174 133 * … … 181 140 if (is_array($value) === true) { 182 141 if ($value[0] !== $value[1]) { 183 throw new stubFilterException($this->rveFactory->create( $this->errorIds[self::PASSWORDS_NOT_EQUAL]));142 throw new stubFilterException($this->rveFactory->create('PASSWORDS_NOT_EQUAL')); 184 143 } 185 144 … … 192 151 193 152 if ($this->minLength->validate($value) === false) { 194 throw new stubFilterException($this->rveFactory->create( $this->errorIds[self::STRING_TOO_SHORT])->setValues($this->minLength->getCriteria()));153 throw new stubFilterException($this->rveFactory->create('STRING_TOO_SHORT')->setValues($this->minLength->getCriteria())); 195 154 } 196 155 197 156 if (in_array($value, $this->nonAllowedValues) === true) { 198 throw new stubFilterException($this->rveFactory->create( $this->errorIds[self::PASSWORD_INVALID]));157 throw new stubFilterException($this->rveFactory->create('PASSWORD_INVALID')); 199 158 } 200 159 201 160 if (null !== $this->minDiffChars) { 202 161 if (count(count_chars($value, 1)) < $this->minDiffChars) { 203 throw new stubFilterException($this->rveFactory->create( $this->errorIds[self::PASSWORD_TOO_LESS_DIFF_CHARS]));162 throw new stubFilterException($this->rveFactory->create('PASSWORD_TOO_LESS_DIFF_CHARS')); 204 163 } 205 164 } trunk/src/main/php/net/stubbles/ipo/request/filters/stubStringFilter.php
r1033 r1037 26 26 */ 27 27 protected $regex; 28 /**29 * wrong value error id30 *31 * @var stubValidator32 */33 protected $wrongValueErrorId;34 28 35 29 /** … … 39 33 * @param stubValidator $regex validator to use for checking the string 40 34 */ 41 public function __construct(stubRequestValueErrorFactory $rveFactory, stubValidator $regex , $wrongValueErrorId = 'FIELD_WRONG_VALUE')35 public function __construct(stubRequestValueErrorFactory $rveFactory, stubValidator $regex) 42 36 { 43 37 $this->rveFactory = $rveFactory; 44 38 $this->regex = $regex; 45 $this->wrongValueErrorId = $wrongValueErrorId;46 39 } 47 40 … … 71 64 72 65 if ($this->regex->validate($value) == false) { 73 throw new stubFilterException($this->rveFactory->create( $this->wrongValueErrorId));66 throw new stubFilterException($this->rveFactory->create('FIELD_WRONG_VALUE')); 74 67 } 75 68 } trunk/src/test/php/net/stubbles/ipo/IPOTestSuite.php
r1014 r1037 26 26 $this->addTestFile($dir . '/request/stubAbstractRequestTestCase.php'); 27 27 $this->addTestFile($dir . '/request/stubRequestPrefixDecoratorTestCase.php'); 28 $this->addTestFile($dir . '/request/stubRequestValueErrorFactoryMappingDecoratorTestCase.php'); 28 29 $this->addTestFile($dir . '/request/stubRequestValueErrorTestCase.php'); 29 30 trunk/src/test/php/net/stubbles/ipo/request/filters/stubFloatFilterTestCase.php
r1031 r1037 94 94 public function testWithUnsetEmptyStringWhenRequired() 95 95 { 96 $this->mockStubRequestValueErrorFactory->expect('create', array('FIELD_EMPTY _TEST'));96 $this->mockStubRequestValueErrorFactory->expect('create', array('FIELD_EMPTY')); 97 97 $floatFilter = new stubFloatFilter($this->mockStubRequestValueErrorFactory); 98 98 $floatFilter->setRequired(true); 99 $floatFilter->setErrorId(stubNumberFilter::FIELD_EMPTY, 'FIELD_EMPTY_TEST');100 99 $this->expectException('stubFilterException'); 101 100 $floatFilter->execute(''); … … 133 132 134 133 /** 135 * assure that an FilterException is thrown when value smaller then $min136 */137 public function testWithMinValidatorWithDifferentErrorId()138 {139 $this->mockStubValidatorMin->setReturnValue('validate', false);140 $this->mockStubValidatorMin->setReturnValue('getCriteria', array());141 $this->mockStubRequestValueErrorFactory->expect('create', array('VALUE_TOO_SMALL_TEST'));142 143 $floatFilter = new stubFloatFilter($this->mockStubRequestValueErrorFactory, $this->mockStubValidatorMin);144 $floatFilter->setErrorId(stubNumberFilter::VALUE_TOO_SMALL, 'VALUE_TOO_SMALL_TEST');145 $this->expectException('stubFilterException');146 $floatFilter->execute(-11);147 }148 149 /**150 134 * assure that an FilterException is thrown when value greater then $max 151 135 */ … … 164 148 165 149 /** 166 * assure that an FilterException is thrown when value greater then $max167 */168 public function testWithMaxValidatorWithDifferentErrorId()169 {170 $this->mockStubValidatorMax->setReturnValue('validate', false);171 $this->mockStubValidatorMax->setReturnValue('getCriteria', array());172 $this->mockStubRequestValueErrorFactory->expect('create', array('VALUE_TOO_GREAT_TEST'));173 174 $floatFilter = new stubFloatFilter($this->mockStubRequestValueErrorFactory, null, $this->mockStubValidatorMax);175 $floatFilter->setErrorId(stubNumberFilter::VALUE_TOO_GREAT, 'VALUE_TOO_GREAT_TEST');176 $this->expectException('stubFilterException');177 $floatFilter->execute(11);178 }179 180 /**181 150 * assure that the correct value depending on $decimal_places is returned 182 151 */ trunk/src/test/php/net/stubbles/ipo/request/filters/stubHTTPURLFilterTestCase.php
r1029 r1037 68 68 public function testNullValueWithDifferentErrorId() 69 69 { 70 $this->httpURLFilter->setErrorId(stubHTTPURLFilter::URL_INCORRECT, 'URL_INCORRECT_TEST');71 70 $this->httpURLFilter->setRequired(true); 72 $this->mockStubRequestValueErrorFactory->expect('create', array('URL_INCORRECT _TEST'));71 $this->mockStubRequestValueErrorFactory->expect('create', array('URL_INCORRECT')); 73 72 $this->expectException('stubFilterException'); 74 73 $this->httpURLFilter->execute(null); … … 86 85 $this->expectException('stubFilterException'); 87 86 $this->httpURLFilter->execute(''); 88 }89 90 /**91 * assure correct behaviour when a null value is passed92 */93 public function testEmptyValueWithDifferentErrorId()94 {95 $this->httpURLFilter->setErrorId(stubHTTPURLFilter::URL_INCORRECT, 'URL_INCORRECT_TEST');96 $this->httpURLFilter->setRequired(true);97 $this->mockStubRequestValueErrorFactory->expect('create', array('URL_INCORRECT_TEST'));98 $this->expectException('stubFilterException');99 $this->httpURLFilter->execute(null);100 87 } 101 88 … … 119 106 $this->httpURLFilter->execute('http://wrong example!'); 120 107 } 121 122 /**123 * assure that setting a wrong error type causes an exception124 */125 public function testSetErrorIdWithWrongType()126 {127 $this->expectException('stubIllegalArgumentException');128 $this->httpURLFilter->setErrorId('blub', 'dummy');129 }130 108 } 131 109 ?> trunk/src/test/php/net/stubbles/ipo/request/filters/stubIntegerFilterTestCase.php
r1031 r1037 79 79 public function testWithUnsetEmptyStringWhenRequired() 80 80 { 81 $this->mockStubRequestValueErrorFactory->expect('create', array('FIELD_EMPTY _TEST'));81 $this->mockStubRequestValueErrorFactory->expect('create', array('FIELD_EMPTY')); 82 82 $integerFilter = new stubIntegerFilter($this->mockStubRequestValueErrorFactory); 83 83 $integerFilter->setRequired(true); 84 $integerFilter->setErrorId(stubNumberFilter::FIELD_EMPTY, 'FIELD_EMPTY_TEST');85 84 $this->expectException('stubFilterException'); 86 85 $integerFilter->execute(''); … … 118 117 119 118 /** 120 * assure that an FilterException is thrown when value smaller then $min121 */122 public function testWithMinValidatorWithDifferentErrorId()123 {124 $this->mockStubValidatorMin->setReturnValue('validate', false);125 $this->mockStubValidatorMin->setReturnValue('getCriteria', array());126 $this->mockStubRequestValueErrorFactory->expect('create', array('VALUE_TOO_SMALL_TEST'));127 128 $integerFilter = new stubIntegerFilter($this->mockStubRequestValueErrorFactory, $this->mockStubValidatorMin);129 $integerFilter->setErrorId(stubNumberFilter::VALUE_TOO_SMALL, 'VALUE_TOO_SMALL_TEST');130 $this->expectException('stubFilterException');131 $integerFilter->execute(-11);132 }133 134 /**135 119 * assure that an FilterException is thrown when value greater then $max 136 120 */ … … 149 133 150 134 /** 151 * assure that an FilterException is thrown when value greater then $max152 */153 public function testWithMaxValidatorWithDifferentErrorId()154 {155 $this->mockStubValidatorMax->setReturnValue('validate', false);156 $this->mockStubValidatorMax->setReturnValue('getCriteria', array());157 $this->mockStubRequestValueErrorFactory->expect('create', array('VALUE_TOO_GREAT_TEST'));158 159 $integerFilter = new stubIntegerFilter($this->mockStubRequestValueErrorFactory, null, $this->mockStubValidatorMax);160 $integerFilter->setErrorId(stubNumberFilter::VALUE_TOO_GREAT, 'VALUE_TOO_GREAT_TEST');161 $this->expectException('stubFilterException');162 $integerFilter->execute(11);163 }164 165 /**166 135 * assure that a given double is returned as integer 167 136 */ trunk/src/test/php/net/stubbles/ipo/request/filters/stubMailFilterTestCase.php
r1030 r1037 68 68 $this->mailFilter->execute(null); 69 69 } 70 71 /**72 * assure that an exceptiom is thrown when a wrong value is passed73 */74 public function testWrongValueWithDifferentErrorId()75 {76 $this->mockStubMailValidator->setReturnValue('validate', false);77 $this->mailFilter->setErrorId(stubMailFilter::MAILADDRESS_INCORRECT, 'MAILADDRESS_INCORRECT_TEST');78 $this->mockStubRequestValueErrorFactory->expect('create', array('MAILADDRESS_INCORRECT_TEST'));79 $this->expectException('stubFilterException');80 $this->mailFilter->execute(null);81 }82 70 } 83 71 ?> trunk/src/test/php/net/stubbles/ipo/request/filters/stubPasswordFilterTestCase.php
r1032 r1037 70 70 * assure that values are returned the expected way 71 71 */ 72 public function testValueWithDifferentErrorId()73 {74 $this->mockStubRequestValueErrorFactory->expect('create', array('STRING_TOO_SHORT_TEST'));75 $this->mockMinLengthValidator->setReturnValue('validate', false);76 $this->mockMinLengthValidator->setReturnValue('getCriteria', array('minLength' => 'foo'));77 $this->passwordFilter->setErrorId(stubPasswordFilter::STRING_TOO_SHORT, 'STRING_TOO_SHORT_TEST');78 $this->expectException('stubFilterException');79 $this->passwordFilter->execute('anything');80 }81 82 /**83 * assure that values are returned the expected way84 */85 72 public function testValueWithoutRequired() 86 73 { … … 105 92 106 93 /** 107 * assure that array values are returned the expected way108 */109 public function testArrayValueWithDifferentErrorId()110 {111 $this->mockStubRequestValueErrorFactory->expect('create', array('PASSWORDS_NOT_EQUAL_TEST'));112 $this->passwordFilter->setErrorId(stubPasswordFilter::PASSWORDS_NOT_EQUAL, 'PASSWORDS_NOT_EQUAL_TEST');113 $this->expectException('stubFilterException');114 $this->passwordFilter->execute(array('foo', 'bar'));115 }116 117 /**118 94 * assure that an unexpected value throws a stubFilterException 119 95 */ … … 128 104 129 105 /** 130 * assure that an unexpected value throws a stubFilterException131 */132 public function testUnExpectedValueWithDifferentErrorId()133 {134 $this->mockStubRequestValueErrorFactory->expect('create', array('PASSWORD_INVALID_TEST'));135 $this->passwordFilter->setNonAllowedValues(array('bar'));136 $this->passwordFilter->setErrorId(stubPasswordFilter::PASSWORD_INVALID, 'PASSWORD_INVALID_TEST');137 $this->mockMinLengthValidator->setReturnValue('getCriteria', array('minLength' => 'foo'));138 $this->expectException('stubFilterException');139 $this->passwordFilter->execute('bar');140 }141 142 /**143 106 * test checking for minimum amount of different characters works 144 107 */ … … 147 110 $this->mockStubRequestValueErrorFactory->expect('create', array('PASSWORD_TOO_LESS_DIFF_CHARS')); 148 111 $this->passwordFilter->setMinDiffChars(5); 149 $this->mockMinLengthValidator->setReturnValue('validate', true);150 $this->assertEqual($this->passwordFilter->execute(array('abcde', 'abcde')), md5('abcde'));151 $this->expectException('stubFilterException');152 $this->passwordFilter->execute(array('abcdd', 'abcdd'));153 }154 155 /**156 * test checking for minimum amount of different characters works157 */158 public function testMinDiffCharsWithDifferentErrorId()159 {160 $this->mockStubRequestValueErrorFactory->expect('create', array('PASSWORD_TOO_LESS_DIFF_CHARS_TEST'));161 $this->passwordFilter->setMinDiffChars(5);162 $this->passwordFilter->setErrorId(stubPasswordFilter::PASSWORD_TOO_LESS_DIFF_CHARS, 'PASSWORD_TOO_LESS_DIFF_CHARS_TEST');163 112 $this->mockMinLengthValidator->setReturnValue('validate', true); 164 113 $this->assertEqual($this->passwordFilter->execute(array('abcde', 'abcde')), md5('abcde'));
