Changeset 1326

Show
Ignore:
Timestamp:
02/03/08 22:00:06 (7 months ago)
Author:
mikey
Message:

replaced stubRequestValueErrorException by more general exceptions

Files:

Legend:

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

    r1223 r1326  
    77 * @subpackage  ipo_request 
    88 */ 
    9 stubClassLoader::load('net::stubbles::ipo::request::stubRequestValueErrorException', 
    10                       'net::stubbles::lang::stubClonable
     9stubClassLoader::load('net::stubbles::lang::stubClonable', 
     10                      'net::stubbles::lang::exceptions::stubIllegalArgumentException
    1111); 
    1212/** 
     
    153153     * @param   array<string,mixed>  $values 
    154154     * @return  stubRequestValueError 
    155      * @throws  stubRequestValueErrorException 
     155     * @throws  stubIllegalArgumentException 
    156156     * @XMLIgnore 
    157157     */ 
     
    160160        foreach (array_keys($this->values) as $key) { 
    161161            if (isset($values[$key]) === false) { 
    162                 throw new stubRequestValueErrorException('Value for key ' . $key . ' is missing.'); 
     162                throw new stubIllegalArgumentException('Value for key ' . $key . ' is missing.'); 
    163163            } 
    164164 
  • trunk/src/main/php/net/stubbles/ipo/request/stubRequestValueErrorFactory.php

    r1223 r1326  
    2121     * @param   string                 $id      id of RequestValueError to create 
    2222     * @return  stubRequestValueError 
    23      * @throws  stubRequestValueErrorException 
    2423     */ 
    2524    public function create($id); 
  • trunk/src/main/php/net/stubbles/ipo/request/stubRequestValueErrorFactoryMappingDecorator.php

    r1223 r1326  
    6767     * @param   string                 $id      id of RequestValueError to create 
    6868     * @return  stubRequestValueError 
    69      * @throws  stubRequestValueErrorException 
    7069     */ 
    7170    public function create($id) 
  • trunk/src/main/php/net/stubbles/ipo/request/stubRequestValueErrorXJConfFactory.php

    r1312 r1326  
    88 */ 
    99stubClassLoader::load('net::stubbles::ipo::request::stubRequestValueErrorFactory', 
    10                       'net::stubbles::ipo::request::stubRequestValueErrorException', 
     10                      'net::stubbles::lang::exceptions::stubConfigurationException', 
     11                      'net::stubbles::lang::exceptions::stubIllegalArgumentException', 
    1112                      'net::stubbles::util::xjconf::xjconf' 
    1213); 
     
    3839     * constructor 
    3940     *  
    40      * @throws  stubRequestValueErrorException 
     41     * @throws  stubConfigurationException 
    4142     */ 
    4243    public function __construct() 
     
    5152            $xjconf->process(stubFactory::getResourceURIs('ipo/request.xml')); 
    5253        } catch (stubXJConfException $xjce) { 
    53             throw new stubRequestValueErrorException($xjce->getMessage()); 
     54            throw new stubConfigurationException($xjce->getMessage()); 
    5455        } 
    5556    } 
     
    102103     * @param   string                 $id      id of RequestValueError to create 
    103104     * @return  stubRequestValueError 
    104      * @throws  stubRequestValueErrorException 
     105     * @throws  stubIllegalArgumentException 
    105106     */ 
    106107    public function create($id) 
     
    110111        } 
    111112         
    112         throw new stubRequestValueErrorException('RequestValueError with id ' . $id . ' does not exist.'); 
     113        throw new stubIllegalArgumentException('RequestValueError with id ' . $id . ' does not exist.'); 
    113114    } 
    114115} 
  • trunk/src/test/php/net/stubbles/integration/stubRequestValueErrorXJConfFactoryTestCase.php

    r1312 r1326  
    4040        $this->URL_INCORRECT($rveFactory); 
    4141        $this->URL_NOT_AVAILABLE($rveFactory); 
     42        $this->invalidErrorId($rveFactory); 
    4243        stubRequestValueErrorXJConfFactory::refresh(); 
    4344        // cached 
     
    5960        $this->URL_INCORRECT($rveFactory); 
    6061        $this->URL_NOT_AVAILABLE($rveFactory); 
     62        $this->invalidErrorId($rveFactory); 
    6163    } 
    6264 
    6365    /** 
    6466     * test that the FIELD_EMPTY error is created 
     67     * 
     68     * @param  stubRequestValueErrorFactory  $rveFactory 
    6569     */ 
    6670    public function FIELD_EMPTY($rveFactory) 
     
    7781    /** 
    7882     * test that the FIELD_NO_SELECT error is created 
     83     * 
     84     * @param  stubRequestValueErrorFactory  $rveFactory 
    7985     */ 
    8086    public function FIELD_NO_SELECT($rveFactory) 
     
    9197    /** 
    9298     * test that the FIELD_WRONG_VALUE error is created 
     99     * 
     100     * @param  stubRequestValueErrorFactory  $rveFactory 
    93101     */ 
    94102    public function FIELD_WRONG_VALUE($rveFactory) 
     
    105113    /** 
    106114     * test that the VALUE_TOO_SMALL error is created 
     115     * 
     116     * @param  stubRequestValueErrorFactory  $rveFactory 
    107117     */ 
    108118    public function VALUE_TOO_SMALL($rveFactory) 
     
    119129    /** 
    120130     * test that the VALUE_TOO_GREAT error is created 
     131     * 
     132     * @param  stubRequestValueErrorFactory  $rveFactory 
    121133     */ 
    122134    public function VALUE_TOO_GREAT($rveFactory) 
     
    133145    /** 
    134146     * test that the PASSWORDS_NOT_EQUAL error is created 
     147     * 
     148     * @param  stubRequestValueErrorFactory  $rveFactory 
    135149     */ 
    136150    public function PASSWORDS_NOT_EQUAL($rveFactory) 
     
    147161    /** 
    148162     * test that the PASSWORD_INVALID error is created 
     163     * 
     164     * @param  stubRequestValueErrorFactory  $rveFactory 
    149165     */ 
    150166    public function PASSWORD_INVALID($rveFactory) 
     
    161177    /** 
    162178     * test that the PASSWORD_TOO_LESS_DIFF_CHARS error is created 
     179     * 
     180     * @param  stubRequestValueErrorFactory  $rveFactory 
    163181     */ 
    164182    public function PASSWORD_TOO_LESS_DIFF_CHARS($rveFactory) 
     
    175193    /** 
    176194     * test that the STRING_TOO_SHORT error is created 
     195     * 
     196     * @param  stubRequestValueErrorFactory  $rveFactory 
    177197     */ 
    178198    public function STRING_TOO_SHORT($rveFactory) 
     
    189209    /** 
    190210     * test that the STRING_TOO_LONG error is created 
     211     * 
     212     * @param  stubRequestValueErrorFactory  $rveFactory 
    191213     */ 
    192214    public function STRING_TOO_LONG($rveFactory) 
     
    203225    /** 
    204226     * test that the DATE_INVALID error is created 
     227     * 
     228     * @param  stubRequestValueErrorFactory  $rveFactory 
    205229     */ 
    206230    public function DATE_INVALID($rveFactory) 
     
    217241    /** 
    218242     * test that the DATE_TOO_EARLY error is created 
     243     * 
     244     * @param  stubRequestValueErrorFactory  $rveFactory 
    219245     */ 
    220246    public function DATE_TOO_EARLY($rveFactory) 
     
    231257    /** 
    232258     * test that the DATE_TOO_LATE error is created 
     259     * 
     260     * @param  stubRequestValueErrorFactory  $rveFactory 
    233261     */ 
    234262    public function DATE_TOO_LATE($rveFactory) 
     
    245273    /** 
    246274     * test that the MAILADDRESS_INCORRECT error is created 
     275     * 
     276     * @param  stubRequestValueErrorFactory  $rveFactory 
    247277     */ 
    248278    public function MAILADDRESS_INCORRECT($rveFactory) 
     
    259289    /** 
    260290     * test that the URL_INCORRECT error is created 
     291     * 
     292     * @param  stubRequestValueErrorFactory  $rveFactory 
    261293     */ 
    262294    public function URL_INCORRECT($rveFactory) 
     
    273305    /** 
    274306     * test that the URL_NOT_AVAILABLE error is created 
     307     * 
     308     * @param  stubRequestValueErrorFactory  $rveFactory 
    275309     */ 
    276310    public function URL_NOT_AVAILABLE($rveFactory) 
     
    283317        $requestError2 = $rveFactory->create('URL_NOT_AVAILABLE'); 
    284318        $this->assertNotSame($requestError, $requestError2); 
     319    } 
     320 
     321    /** 
     322     * test that trying to retrieve a non-existing error throws an exception 
     323     * 
     324     * @param  stubRequestValueErrorFactory  $rveFactory 
     325     */ 
     326    public function invalidErrorId($rveFactory) 
     327    { 
     328        try { 
     329            $rveFactory->create('invalid'); 
     330        } catch (stubIllegalArgumentException $iae) { 
     331            return; 
     332        } 
     333         
     334        $this->fail('Expected stubIllegalArgumentException, got none or another.'); 
    285335    } 
    286336} 
  • trunk/src/test/php/net/stubbles/ipo/request/stubRequestValueErrorTestCase.php

    r1273 r1326  
    129129     * 
    130130     * @test 
    131      * @expectedException  stubRequestValueErrorException 
     131     * @expectedException  stubIllegalArgumentException 
    132132     */ 
    133133    public function setValues()