Changeset 1542

Show
Ignore:
Timestamp:
04/12/08 20:37:05 (1 month ago)
Author:
mikey
Message:

removed events dependency

Files:

Legend:

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

    r1323 r1542  
    77 * @subpackage  ipo_request 
    88 */ 
    9 stubClassLoader::load('net::stubbles::ipo::request::stubRequest', 
    10                       'net::stubbles::events::stubNonCancelableEvent' 
    11 ); 
     9stubClassLoader::load('net::stubbles::ipo::request::stubRequest'); 
    1210/** 
    1311 * Class for access to request data. 
     
    240238    /** 
    241239     * cancels the request, e.g. if it was detected that it is invalid 
    242      *  
    243      * @param  stubEventDispatcher  $dispatcher  optional  dispatcher to use for signalling 
    244      *                                                     the event, if none given the 
    245      *                                                     default one will be used 
    246      */ 
    247     public function cancel(stubEventDispatcher $dispatcher = null) 
    248     { 
    249         if (true === $this->isCancelled) { 
    250             return; 
    251         } 
    252          
     240     */ 
     241    public function cancel() 
     242    { 
    253243        $this->isCancelled = true; 
    254          
    255         if (null === $dispatcher) { 
    256             $dispatcher = stubEventDispatcher::getInstance(); 
    257         } 
    258          
    259         $event = new stubNonCancelableEvent(stubRequest::EVENT_CANCELLED, $this); 
    260         $dispatcher->triggerEvent($event, true); 
    261244    } 
    262245 
  • trunk/src/main/php/net/stubbles/ipo/request/stubRequest.php

    r1323 r1542  
    77 * @subpackage  ipo_request 
    88 */ 
    9 stubClassLoader::load('net::stubbles::events::stubEventDispatcher', 
    10                       'net::stubbles::util::validators::stubValidator', 
     9stubClassLoader::load('net::stubbles::ipo::request::stubRequestValueError', 
    1110                      'net::stubbles::ipo::request::filters::stubFilter', 
    12                       'net::stubbles::ipo::request::stubRequestValueError' 
     11                      'net::stubbles::util::validators::stubValidator' 
    1312); 
    1413/** 
     
    3029    const CLASS_REGISTRY_KEY = 'net.stubbles.ipo.request.class'; 
    3130    /** 
    32      * name of event that will be triggered in case the request is cancelled 
    33      */ 
    34     const EVENT_CANCELLED    = 'onRequestCancelled'; 
    35     /** 
    3631     * request source: cookies 
    3732     */ 
     
    127122    /** 
    128123     * cancels the request, e.g. if it was detected that it is invalid 
    129      *  
    130      * @param  stubEventDispatcher  $dispatcher  optional  dispatcher to use for signalling 
    131      *                                                     the event, if none given the 
    132      *                                                     default one will be used 
    133      */ 
    134     public function cancel(stubEventDispatcher $dispatcher = null); 
     124     */ 
     125    public function cancel(); 
    135126 
    136127    /** 
  • trunk/src/test/php/net/stubbles/ipo/request/stubAbstractRequestTestCase.php

    r1323 r1542  
    228228     * @test 
    229229     */ 
    230     public function cancelWithGivenEventDispatcher() 
     230    public function cancelRequest() 
    231231    { 
    232232        $this->assertFalse($this->request->isCancelled()); 
    233         $mockEventListener = $this->getMock('stubEventListener'); 
    234         $mockEventListener->expects($this->once())->method('handleEvent'); 
    235         $mockEventListener->expects($this->once())->method('autoremove')->will($this->returnValue(false)); 
    236         $eventDispatcher = stubEventDispatcher::getInstance('__test'); 
    237         $eventDispatcher->register($mockEventListener, stubRequest::EVENT_CANCELLED); 
    238         $this->request->cancel($eventDispatcher); 
    239         $this->assertTrue($this->request->isCancelled()); 
    240         $this->request->cancel($eventDispatcher); 
    241         $this->assertTrue($this->request->isCancelled()); 
    242         stubEventDispatcher::destroyInstance('__test'); 
    243     } 
    244  
    245     /** 
    246      * assure that cancelling the request works as expected 
    247      * 
    248      * @test 
    249      */ 
    250     public function cancelWithoutEventDispatcher() 
    251     { 
    252         $this->assertFalse($this->request->isCancelled()); 
    253         $mockEventListener = $this->getMock('stubEventListener'); 
    254         $mockEventListener->expects($this->once())->method('handleEvent'); 
    255         $mockEventListener->expects($this->once())->method('autoremove')->will($this->returnValue(false)); 
    256         $eventDispatcher = stubEventDispatcher::getInstance(); 
    257         $eventDispatcher->register($mockEventListener, stubRequest::EVENT_CANCELLED); 
    258233        $this->request->cancel(); 
    259234        $this->assertTrue($this->request->isCancelled()); 
    260         $this->request->cancel(); 
    261         $this->assertTrue($this->request->isCancelled()); 
    262         $name = $eventDispatcher->getName(); 
    263         stubEventDispatcher::destroyInstance($name); 
    264235    } 
    265236