Changeset 1339

Show
Ignore:
Timestamp:
02/11/08 21:16:43 (7 months ago)
Author:
mikey
Message:

added forFilter() method to allow method chaining for already existing filter instances

Files:

Legend:

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

    r1338 r1339  
    101101 
    102102    /** 
     103     * convenience method to allow method chaining for already existing filters 
     104     * 
     105     * @param   stubFilter  $filter 
     106     * @return  stubFilterFactory 
     107     */ 
     108    public static function forFilter(stubFilter $filter) 
     109    { 
     110        return new self($filter); 
     111    } 
     112 
     113    /** 
    103114     * sets the request error value factory to be used by the filter 
    104115     * 
  • trunk/src/test/php/net/stubbles/ipo/request/filters/stubFilterFactoryTestCase.php

    r1338 r1339  
    363363 
    364364    /** 
    365      * test that mail filter is created 
     365     * test that user defined filter is created 
    366366     * 
    367367     * @test 
     
    387387 
    388388    /** 
     389     * test that method chaining is possible with forFilter() is created 
     390     * 
     391     * @test 
     392     */ 
     393    public function forFilterMethodChaining() 
     394    { 
     395        $mockFilter         = $this->getMock('stubFilter'); 
     396        $filter = stubFilterFactory::forFilter($mockFilter); 
     397        $this->assertType('stubFilterFactory', $filter); 
     398        $this->assertSame($mockFilter, $filter->getDecoratedFilter()); 
     399    } 
     400 
     401    /** 
    389402     * test rve factory behaviour 
    390403     *