Changeset 1116

Show
Ignore:
Timestamp:
12/05/07 18:59:15 (1 year ago)
Author:
mikey
Message:

replace rarely used specific stubValidatorException by stubIllegalArgumentException and stubRuntimeException, both fit better

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/src/main/php/net/stubbles/util/validators/stubAbstractCompositeValidator.php

    r151 r1116  
    77 * @subpackage  util_validators 
    88 */ 
    9 stubClassLoader::load('net.stubbles.util.validators.stubCompositeValidator'); 
     9stubClassLoader::load('net.stubbles.lang.exceptions.stubRuntimeException', 
     10                      'net.stubbles.util.validators.stubCompositeValidator' 
     11); 
    1012/** 
    1113 * Base class for composite validators. 
     
    4244     * @param   mixed  $value 
    4345     * @return  bool   true if value is ok, else false 
    44      * @throws  stubValidatorException 
    4546     */ 
    4647    public function validate($value) 
    4748    { 
    4849        if (count($this->validators) == 0) { 
    49             throw new stubValidatorException('No validators set for composite ' . __CLASS__); 
     50            throw new stubRuntimeException('No validators set for composite ' . __CLASS__); 
    5051        } 
    5152         
  • trunk/src/main/php/net/stubbles/util/validators/stubContainsValidator.php

    r1103 r1116  
    77 * @subpackage  util_validators 
    88 */ 
    9 stubClassLoader::load('net.stubbles.util.validators.stubValidator'); 
     9stubClassLoader::load('net.stubbles.lang.exceptions.stubIllegalArgumentException', 
     10                      'net.stubbles.util.validators.stubValidator' 
     11); 
    1012/** 
    1113 * Class for validating that something is equal. 
     
    3133     *  
    3234     * @param   scalar|null  $contained 
    33      * @throws  stubValidatorException 
    3435     */ 
    3536    public function __construct($contained) 
    3637    { 
    3738        if (is_scalar($contained) == false) { 
    38             throw new stubValidatorException('Can only check scalar values.'); 
     39            throw new stubIllegalArgumentException('Can only check scalar values.'); 
    3940        } 
    4041         
  • trunk/src/main/php/net/stubbles/util/validators/stubEqualValidator.php

    r370 r1116  
    77 * @subpackage  util_validators 
    88 */ 
    9 stubClassLoader::load('net.stubbles.util.validators.stubValidator'); 
     9stubClassLoader::load('net.stubbles.lang.exceptions.stubIllegalArgumentException', 
     10                      'net.stubbles.util.validators.stubValidator' 
     11); 
    1012/** 
    1113 * Class for validating that something is equal. 
     
    3133     *  
    3234     * @param   scalar|null  $expected 
    33      * @throws  stubValidatorException 
    3435     */ 
    3536    public function __construct($expected) 
    3637    { 
    3738        if (is_scalar($expected) == false && null != $expected) { 
    38             throw new stubValidatorException('Can only compare scalar values and null.'); 
     39            throw new stubIllegalArgumentException('Can only compare scalar values and null.'); 
    3940        } 
    4041         
  • trunk/src/main/php/net/stubbles/util/validators/stubValidator.php

    r151 r1116  
    77 * @subpackage  util_validators 
    88 */ 
    9 stubClassLoader::load('net.stubbles.util.validators.stubValidatorException'); 
    109/** 
    1110 * Interface for validators. 
     
    2524     * @param   mixed  $value 
    2625     * @return  bool   true if value is ok, else false 
    27      * @throws  stubValidatorException 
    2826     */ 
    2927    public function validate($value); 
  • trunk/src/test/php/net/stubbles/util/validators/stubAndValidatorTestCase.php

    r696 r1116  
    5252    public function testValidationException() 
    5353    { 
    54         $this->expectException('stubValidatorException'); 
     54        $this->expectException('stubRuntimeException'); 
    5555        $this->andValidator->validate('foo'); 
    5656    } 
  • trunk/src/test/php/net/stubbles/util/validators/stubContainsValidatorTestCase.php

    r1103 r1116  
    2626        $containsValidator = new stubContainsValidator(false); 
    2727         
    28         $this->expectException('stubValidatorException'); 
     28        $this->expectException('stubIllegalArgumentException'); 
    2929        $containsValidator = new stubContainsValidator(new stdClass()); 
    3030    } 
     
    3535    public function testConstructionWithNull() 
    3636    { 
    37         $this->expectException('stubValidatorException'); 
     37        $this->expectException('stubIllegalArgumentException'); 
    3838        $containsValidator = new stubContainsValidator(null); 
    3939    } 
  • trunk/src/test/php/net/stubbles/util/validators/stubEqualValidatorTestCase.php

    r371 r1116  
    2727        $equalValidator = new stubEqualValidator(null); 
    2828         
    29         $this->expectException('stubValidatorException'); 
     29        $this->expectException('stubIllegalArgumentException'); 
    3030        $this->equalValidator = new stubEqualValidator(new stdClass()); 
    3131    } 
  • trunk/src/test/php/net/stubbles/util/validators/stubOrValidatorTestCase.php

    r696 r1116  
    5353    public function testValidationException() 
    5454    { 
    55         $this->expectException('stubValidatorException'); 
     55        $this->expectException('stubRuntimeException'); 
    5656        $this->orValidator->validate('foo'); 
    5757    } 
  • trunk/src/test/php/net/stubbles/util/validators/stubXorValidatorTestCase.php

    r696 r1116  
    6363    public function testValidationException() 
    6464    { 
    65         $this->expectException('stubValidatorException'); 
     65        $this->expectException('stubRuntimeException'); 
    6666        $this->xorValidator->validate('foo'); 
    6767    }