Changeset 15133

Show
Ignore:
Timestamp:
07/04/08 00:48:44 (3 months ago)
Author:
kumatch
Message:

Changed the return object after authenticate().

Location:
events/phpframework/piece_framework/trunk
Files:
2 modified

Legend:

Unmodified
Added
Removed
  • events/phpframework/piece_framework/trunk/libs/Phwittr/Service.php

    r14842 r15133  
    1313require_once 'Phwittr/Config.php'; 
    1414require_once 'Phwittr/Service/Exception.php'; 
     15require_once 'Phwittr/Self.php'; 
    1516require_once 'Piece/Right/Validator/Email.php'; 
    1617 
     
    164165     * @param string $user 
    165166     * @param string $password 
    166      * @return boolean 
     167     * @return object 
    167168     */ 
    168169    public function authenticate($name, $password) 
     
    185186        } 
    186187 
    187         return $user; 
     188        $self = new Phwittr_Self($user->id); 
     189 
     190        return $self; 
    188191    } 
    189192 
  • events/phpframework/piece_framework/trunk/specs/Phwittr/Authentication/NormalSpec.php

    r14659 r15133  
    5858    } 
    5959 
    60     public function it認証はユーザ名とパスワードで行い、成功するとユーザ情報が得られる() 
     60    public function it認証はユーザ名とパスワードで行い、成功するとphwittr_selfオブジェクトが得られる() 
    6161    { 
    6262 
    63         $user = Phwittr_Service::authenticate($this->_foo->userName, 
     63        $self = Phwittr_Service::authenticate($this->_foo->userName, 
    6464                                              $this->_foo->password 
    6565                                              ); 
    6666 
    67         $this->spec($user->userName)->should->be($this->_foo->userName); 
    68         $this->spec($user->email)->should->be($this->_foo->email); 
     67        $this->spec($self instanceof Phwittr_Self)->should->beTrue(); 
     68        $this->spec($self->userName)->should->be($this->_foo->userName); 
     69        $this->spec($self->email)->should->be($this->_foo->email); 
    6970    } 
    7071 
    71     public function it認証はメールアドレスとパスワードでも行え、成功するとユーザ情報が得られる() 
     72    public function it認証はメールアドレスとパスワードでも行え、成功するとphwittr_selfオブジェクトが得られる() 
    7273    { 
    73         $user = Phwittr_Service::authenticate($this->_foo->email, 
     74        $self = Phwittr_Service::authenticate($this->_foo->email, 
    7475                                              $this->_foo->password 
    7576                                              ); 
    7677 
    77         $this->spec($user->userName)->should->be($this->_foo->userName); 
    78         $this->spec($user->email)->should->be($this->_foo->email); 
     78        $this->spec($self instanceof Phwittr_Self)->should->beTrue(); 
     79        $this->spec($self->userName)->should->be($this->_foo->userName); 
     80        $this->spec($self->email)->should->be($this->_foo->email); 
    7981    } 
    8082