Changeset 1037

Show
Ignore:
Timestamp:
11/13/07 16:00:24 (1 year ago)
Author:
mikey
Message:

added net::stubbles::ipo::request::stubRequestValueErrorFactoryMappingDecorator, implements enhancement #96
reverted all previous implementations for enhancement #96

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/src/main/php/net/stubbles/ipo/request/filters/stubAbstractStringFilter.php

    r1033 r1037  
    4747     */ 
    4848    protected $encoderMode = stubStringEncoder::MODE_DECODE; 
    49     /** 
    50      * default value for empty field  
    51      * 
    52      * @var  string 
    53      */ 
    54     protected $emptyErrorId = 'FIELD_EMPTY'; 
    5549 
    56     /** 
    57      * set a min length validator 
    58      * 
    59      * @param  stubValidator  $minLength 
    60      */ 
    61     public function setEmptyErrorId($errorId) 
    62     { 
    63         $this->emptyErrorId = $errorId; 
    64     } 
    65      
    6650    /** 
    6751     * set a min length validator 
     
    149133        // if input length is zero but input is required 
    150134        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')); 
    152136        // if input is shorter than maximal allowed length 
    153137        } elseif (null != $this->minLength && $this->minLength->validate($value) == false) { 
  • trunk/src/main/php/net/stubbles/ipo/request/filters/stubHTTPURLFilter.php

    r1029 r1037  
    1919{ 
    2020    /** 
    21      * default error id if URL is not correct 
    22      */ 
    23     const URL_INCORRECT     = 'URL_INCORRECT'; 
    24     /** 
    25      * default error id if URL is not available 
    26      */ 
    27     const URL_NOT_AVAILABLE = 'URL_NOT_AVAILABLE'; 
    28     /** 
    2921     * switch whether DNS should be checked or not 
    3022     * 
     
    3224     */ 
    3325    protected $checkDNS     = false; 
    34     /** 
    35      * list of error ids to be used by this filter 
    36      * 
    37      * @var  array<string,string> 
    38      */ 
    39     protected $errorIds     = array(self::URL_INCORRECT     => self::URL_INCORRECT, 
    40                                     self::URL_NOT_AVAILABLE => self::URL_NOT_AVAILABLE 
    41                               ); 
    4226 
    4327    /** 
     
    7256 
    7357    /** 
    74      * sets the error id to be used in case the filter finds an error in the value 
    75      * 
    76      * @param  string  $type     type of error, one of the stubHTTPURLFilter::URL_* constants 
    77      * @param  string  $errorId  the id of the error object to use 
    78      */ 
    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     /** 
    8958     * check if value is a valid HTTP URL 
    9059     * 
     
    9867            $http = stubHTTPURL::fromString($value); 
    9968        } catch (stubMalformedURLException $murle) { 
    100             throw new stubFilterException($this->rveFactory->create($this->errorIds[self::URL_INCORRECT])); 
     69            throw new stubFilterException($this->rveFactory->create('URL_INCORRECT')); 
    10170        } 
    10271         
    10372        if (null === $http) { 
    10473            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')); 
    10675            } 
    10776             
     
    11079         
    11180        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')); 
    11382        } 
    11483     
  • trunk/src/main/php/net/stubbles/ipo/request/filters/stubMailFilter.php

    r1030 r1037  
    1818{ 
    1919    /** 
    20      * error id for incorrect mail address 
    21      */ 
    22     const MAILADDRESS_INCORRECT = 'MAILADDRESS_INCORRECT'; 
    23     /** 
    2420     * validator to use for checking the mail address 
    2521     * 
     
    2723     */ 
    2824    protected $mailValidator; 
    29     /** 
    30      * list of error ids to be used by this filter 
    31      * 
    32      * @var  array<string,string> 
    33      */ 
    34     protected $errorIds         = array(self::MAILADDRESS_INCORRECT => self::MAILADDRESS_INCORRECT); 
    3525 
    3626    /** 
     
    4737 
    4838    /** 
    49      * sets the error id to be used in case the filter finds an error in the value 
    50      * 
    51      * @param  string  $type     type of error, one of the stubHTTPURLFilter::URL_* constants 
    52      * @param  string  $errorId  the id of the error object to use 
    53      */ 
    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     /** 
    6439     * check if entered passwords fulfill password conditions 
    6540     * 
     
    7146    { 
    7247        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')); 
    7449        } 
    7550 
  • trunk/src/main/php/net/stubbles/ipo/request/filters/stubNumberFilter.php

    r1031 r1037  
    2424{ 
    2525    /** 
    26      * default error id if field was empty 
    27      */ 
    28     const FIELD_EMPTY       = 'FIELD_EMPTY'; 
    29     /** 
    30      * default error id if value is too small 
    31      */ 
    32     const VALUE_TOO_SMALL   = 'VALUE_TOO_SMALL'; 
    33     /** 
    34      * default error id if value is too great 
    35      */ 
    36     const VALUE_TOO_GREAT   = 'VALUE_TOO_GREAT'; 
    37     /** 
    3826     * validator for minimum values 
    3927     * 
     
    4735     */ 
    4836    protected $maxValidator = null; 
    49     /** 
    50      * list of error ids to be used by this filter 
    51      * 
    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_GREAT 
    57                               ); 
    5837 
    5938    /** 
     
    9271 
    9372    /** 
    94      * sets the error id to be used in case the filter finds an error in the value 
    95      * 
    96      * @param  string  $type     type of error, one of the stubHTTPURLFilter::URL_* constants 
    97      * @param  string  $errorId  the id of the error object to use 
    98      */ 
    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     /** 
    10973     * checks if given value exceeds borders 
    11074     * 
     
    13094        if ((null === $value || strlen($value) === 0) && true === $this->isRequired) { 
    13195            // 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')); 
    13397        } elseif (null !== $value && null !== $this->minValidator && $this->minValidator->validate($value) !== true) { 
    13498             // 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())); 
    136100        } elseif (null !== $value && null !== $this->maxValidator && $this->maxValidator->validate($value) !== true) { 
    137101            // 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())); 
    139103        } 
    140104 
  • trunk/src/main/php/net/stubbles/ipo/request/filters/stubPasswordFilter.php

    r1032 r1037  
    3131{ 
    3232    /** 
    33      * default error id if passwords are not equal 
    34      */ 
    35     const PASSWORDS_NOT_EQUAL          = 'PASSWORDS_NOT_EQUAL'; 
    36     /** 
    37      * default error id if password is too short 
    38      */ 
    39     const STRING_TOO_SHORT             = 'STRING_TOO_SHORT'; 
    40     /** 
    41      * default error id if password is invalid 
    42      */ 
    43     const PASSWORD_INVALID             = 'PASSWORD_INVALID'; 
    44     /** 
    45      * default error id if password has too less different characters 
    46      */ 
    47     const PASSWORD_TOO_LESS_DIFF_CHARS = 'PASSWORD_TOO_LESS_DIFF_CHARS'; 
    48     /** 
    4933     * validator to use for checking the minimum length of the password 
    5034     * 
     
    7054     */ 
    7155    protected $encoder; 
    72     /** 
    73      * list of error ids to be used by this filter 
    74      * 
    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_CHARS 
    81                                   ); 
    8256 
    8357    /** 
     
    156130 
    157131    /** 
    158      * sets the error id to be used in case the filter finds an error in the value 
    159      * 
    160      * @param  string  $type     type of error, one of the stubHTTPURLFilter::URL_* constants 
    161      * @param  string  $errorId  the id of the error object to use 
    162      */ 
    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     /** 
    173132     * check if entered passwords fulfill password conditions 
    174133     * 
     
    181140        if (is_array($value) === true) { 
    182141            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')); 
    184143            } 
    185144 
     
    192151 
    193152        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())); 
    195154        } 
    196155 
    197156        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')); 
    199158        } 
    200159         
    201160        if (null !== $this->minDiffChars) { 
    202161            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')); 
    204163            } 
    205164        } 
  • trunk/src/main/php/net/stubbles/ipo/request/filters/stubStringFilter.php

    r1033 r1037  
    2626     */ 
    2727    protected $regex; 
    28     /** 
    29      * wrong value error id 
    30      * 
    31      * @var  stubValidator 
    32      */ 
    33     protected $wrongValueErrorId; 
    3428 
    3529    /** 
     
    3933     * @param  stubValidator                 $regex       validator to use for checking the string 
    4034     */ 
    41     public function __construct(stubRequestValueErrorFactory $rveFactory, stubValidator $regex, $wrongValueErrorId = 'FIELD_WRONG_VALUE'
     35    public function __construct(stubRequestValueErrorFactory $rveFactory, stubValidator $regex
    4236    { 
    4337        $this->rveFactory         = $rveFactory; 
    4438        $this->regex              = $regex; 
    45         $this->wrongValueErrorId  = $wrongValueErrorId;  
    4639    } 
    4740 
     
    7164 
    7265            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')); 
    7467            } 
    7568        } 
  • trunk/src/test/php/net/stubbles/ipo/IPOTestSuite.php

    r1014 r1037  
    2626        $this->addTestFile($dir . '/request/stubAbstractRequestTestCase.php'); 
    2727        $this->addTestFile($dir . '/request/stubRequestPrefixDecoratorTestCase.php'); 
     28        $this->addTestFile($dir . '/request/stubRequestValueErrorFactoryMappingDecoratorTestCase.php'); 
    2829        $this->addTestFile($dir . '/request/stubRequestValueErrorTestCase.php'); 
    2930 
  • trunk/src/test/php/net/stubbles/ipo/request/filters/stubFloatFilterTestCase.php

    r1031 r1037  
    9494    public function testWithUnsetEmptyStringWhenRequired() 
    9595    { 
    96         $this->mockStubRequestValueErrorFactory->expect('create', array('FIELD_EMPTY_TEST')); 
     96        $this->mockStubRequestValueErrorFactory->expect('create', array('FIELD_EMPTY')); 
    9797        $floatFilter = new stubFloatFilter($this->mockStubRequestValueErrorFactory); 
    9898        $floatFilter->setRequired(true); 
    99         $floatFilter->setErrorId(stubNumberFilter::FIELD_EMPTY, 'FIELD_EMPTY_TEST'); 
    10099        $this->expectException('stubFilterException'); 
    101100        $floatFilter->execute(''); 
     
    133132 
    134133    /** 
    135      * assure that an FilterException is thrown when value smaller then $min 
    136      */ 
    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     /** 
    150134     * assure that an FilterException is thrown when value greater then $max 
    151135     */ 
     
    164148 
    165149    /** 
    166      * assure that an FilterException is thrown when value greater then $max 
    167      */ 
    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     /** 
    181150     * assure that the correct value depending on $decimal_places is returned 
    182151     */ 
  • trunk/src/test/php/net/stubbles/ipo/request/filters/stubHTTPURLFilterTestCase.php

    r1029 r1037  
    6868    public function testNullValueWithDifferentErrorId() 
    6969    { 
    70         $this->httpURLFilter->setErrorId(stubHTTPURLFilter::URL_INCORRECT, 'URL_INCORRECT_TEST'); 
    7170        $this->httpURLFilter->setRequired(true); 
    72         $this->mockStubRequestValueErrorFactory->expect('create', array('URL_INCORRECT_TEST')); 
     71        $this->mockStubRequestValueErrorFactory->expect('create', array('URL_INCORRECT')); 
    7372        $this->expectException('stubFilterException'); 
    7473        $this->httpURLFilter->execute(null); 
     
    8685        $this->expectException('stubFilterException'); 
    8786        $this->httpURLFilter->execute(''); 
    88     } 
    89  
    90     /** 
    91      * assure correct behaviour when a null value is passed 
    92      */ 
    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); 
    10087    } 
    10188 
     
    119106        $this->httpURLFilter->execute('http://wrong example!'); 
    120107    } 
    121  
    122     /** 
    123      * assure that setting a wrong error type causes an exception 
    124      */ 
    125     public function testSetErrorIdWithWrongType() 
    126     { 
    127         $this->expectException('stubIllegalArgumentException'); 
    128         $this->httpURLFilter->setErrorId('blub', 'dummy'); 
    129     } 
    130108} 
    131109?> 
  • trunk/src/test/php/net/stubbles/ipo/request/filters/stubIntegerFilterTestCase.php

    r1031 r1037  
    7979    public function testWithUnsetEmptyStringWhenRequired() 
    8080    { 
    81         $this->mockStubRequestValueErrorFactory->expect('create', array('FIELD_EMPTY_TEST')); 
     81        $this->mockStubRequestValueErrorFactory->expect('create', array('FIELD_EMPTY')); 
    8282        $integerFilter = new stubIntegerFilter($this->mockStubRequestValueErrorFactory); 
    8383        $integerFilter->setRequired(true); 
    84         $integerFilter->setErrorId(stubNumberFilter::FIELD_EMPTY, 'FIELD_EMPTY_TEST'); 
    8584        $this->expectException('stubFilterException'); 
    8685        $integerFilter->execute(''); 
     
    118117 
    119118    /** 
    120      * assure that an FilterException is thrown when value smaller then $min 
    121      */ 
    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     /** 
    135119     * assure that an FilterException is thrown when value greater then $max 
    136120     */ 
     
    149133 
    150134    /** 
    151      * assure that an FilterException is thrown when value greater then $max 
    152      */ 
    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     /** 
    166135     * assure that a given double is returned as integer 
    167136     */ 
  • trunk/src/test/php/net/stubbles/ipo/request/filters/stubMailFilterTestCase.php

    r1030 r1037  
    6868        $this->mailFilter->execute(null); 
    6969    } 
    70  
    71     /** 
    72      * assure that an exceptiom is thrown when a wrong value is passed 
    73      */ 
    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     } 
    8270} 
    8371?> 
  • trunk/src/test/php/net/stubbles/ipo/request/filters/stubPasswordFilterTestCase.php

    r1032 r1037  
    7070     * assure that values are returned the expected way 
    7171     */ 
    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 way 
    84      */ 
    8572    public function testValueWithoutRequired() 
    8673    { 
     
    10592 
    10693    /** 
    107      * assure that array values are returned the expected way 
    108      */ 
    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     /** 
    11894     * assure that an unexpected value throws a stubFilterException 
    11995     */ 
     
    128104 
    129105    /** 
    130      * assure that an unexpected value throws a stubFilterException 
    131      */ 
    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     /** 
    143106     * test checking for minimum amount of different characters works 
    144107     */ 
     
    147110        $this->mockStubRequestValueErrorFactory->expect('create', array('PASSWORD_TOO_LESS_DIFF_CHARS')); 
    148111        $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 works 
    157      */ 
    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'); 
    163112        $this->mockMinLengthValidator->setReturnValue('validate', true); 
    164113        $this->assertEqual($this->passwordFilter->execute(array('abcde', 'abcde')), md5('abcde'));