Changeset 1363

Show
Ignore:
Timestamp:
02/24/08 20:58:29 (4 months ago)
Author:
mikey
Message:

clone is forbidden and should throw a runtime exception

Files:

Legend:

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

    r1344 r1363  
    88 */ 
    99stubClassLoader::load('net::stubbles::ipo::session::stubSession', 
    10                       'net::stubbles::ipo::request::stubRequest' 
     10                      'net::stubbles::ipo::request::stubRequest', 
     11                      'net::stubbles::lang::exceptions::stubRuntimeException' 
    1112); 
    1213/** 
     
    117118     * cloning is forbidden 
    118119     *  
    119      * @throws  stubSessionException 
    120      */ 
    121     protected final function __clone() 
    122     { 
    123         throw new stubSessionException('Cloning the session is somewhat... useless.'); 
     120     * @throws  stubRuntimeException 
     121     */ 
     122    public final function __clone() 
     123    { 
     124        throw new stubRuntimeException('Cloning the session is somewhat... useless.'); 
    124125    } 
    125126 
  • trunk/src/test/php/net/stubbles/ipo/session/stubAbstractSessionTestCase.php

    r1272 r1363  
    251251        $this->assertSame($second, $third); 
    252252    } 
     253 
     254    /** 
     255     * you should not clone a session 
     256     * 
     257     * @test 
     258     * @expectedException  stubRuntimeException 
     259     */ 
     260    public function cloneSessionThrowsRuntimeException() 
     261    { 
     262        $session = clone $this->session; 
     263    } 
    253264} 
    254265?>