Changeset 299

Show
Ignore:
Timestamp:
02/26/07 17:30:07 (2 years ago)
Author:
mikey
Message:

added setPrefix($prefix) method

Files:

Legend:

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

    r142 r299  
    6060     
    6161    /** 
     62     * sets the prefix to another value 
     63     * 
     64     * @param  string  $prefix  the prefix to use 
     65     */ 
     66    public function setPrefix($prefix) 
     67    { 
     68        $this->prefix = $prefix; 
     69    } 
     70     
     71    /** 
    6272     * checks whether a request value is set or not 
    6373     * 
  • trunk/src/test/php/net/stubbles/ipo/request/stubRequestPrefixDecoratorTestCase.php

    r139 r299  
    5858        $mockFilter = new MockStubFilter(); 
    5959        $this->mockRequest->expect('getFilteredValue', array($mockFilter, 'test_foo', stubRequest::SOURCE_PARAM)); 
     60        $this->request->getFilteredValue($mockFilter, 'foo'); 
     61    } 
     62     
     63    /** 
     64     * test that values are prefixed as expected 
     65     */ 
     66    public function testChangedValue() 
     67    { 
     68        $this->request->setPrefix('bar'); 
     69        $this->mockRequest->expect('hasValue', array('bar_foo', stubRequest::SOURCE_PARAM)); 
     70        $this->request->hasValue('foo'); 
     71         
     72        $mockValidator = new MockStubValidator(); 
     73        $this->mockRequest->expect('validateValue', array($mockValidator, 'bar_foo', stubRequest::SOURCE_PARAM)); 
     74        $this->request->validateValue($mockValidator, 'foo'); 
     75         
     76        $this->mockRequest->expect('getValidatedValue', array($mockValidator, 'bar_foo', stubRequest::SOURCE_PARAM)); 
     77        $this->request->getValidatedValue($mockValidator, 'foo'); 
     78         
     79        $mockFilter = new MockStubFilter(); 
     80        $this->mockRequest->expect('getFilteredValue', array($mockFilter, 'bar_foo', stubRequest::SOURCE_PARAM)); 
    6081        $this->request->getFilteredValue($mockFilter, 'foo'); 
    6182    }