Show
Ignore:
Timestamp:
06/15/08 23:40:32 (5 years ago)
Author:
kumatch
Message:

Added the updator for user picture.

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • events/phpframework/piece_framework/trunk/specs/Phwittr/AccountSpec.php

    r13523 r14099  
    5252     */ 
    5353 
     54    public function beforeAll() 
     55    { 
     56        parent::beforeAll(); 
     57 
     58        $this->_sampleImage = 'example.png'; 
     59        $this->_sampleDirectory = dirname(__FILE__) . '/AccountSpec'; 
     60 
     61        @unlink($this->_sampleDirectory . '/example_mini.png'); 
     62        @unlink($this->_sampleDirectory . '/example_normal.png'); 
     63    } 
     64 
     65    public function afterAll() 
     66    { 
     67        parent::afterAll(); 
     68 
     69        @unlink($this->_sampleDirectory . '/example_mini.png'); 
     70        @unlink($this->_sampleDirectory . '/example_normal.png'); 
     71    } 
     72 
    5473    public function it基本情報が更新できる() 
    5574    { 
     
    189208    } 
    190209 
    191     public function itユーザ画像も個別で更新() 
    192     { 
    193         $this->pending(); 
     210    public function itユーザ画像も個別更新で、オリジナルファイルパスを指定するとデータベースへの情報格納および24x24、48x48の画像が生成される() 
     211    { 
     212        $image = $this->_sampleDirectory . '/' . $this->_sampleImage; 
     213 
     214        $this->_createUserRecord($this->_foo); 
     215         
     216        $mapper = Piece_ORM::getMapper('Users'); 
     217        $user = $mapper->findByUserName($this->_foo->userName); 
     218 
     219        $account = new Phwittr_Account(); 
     220        $account->updatePicture($user->id, $image); 
     221 
     222        $newUser = $mapper->findById($user->id); 
     223 
     224        $this->spec($newUser->image)->should->be($this->_sampleImage); 
     225        $this->spec(file_exists($this->_sampleDirectory . '/example_mini.png')) 
     226                    ->should->beTrue(); 
     227        $this->spec(file_exists($this->_sampleDirectory . '/example_normal.png')) 
     228                    ->should->beTrue(); 
    194229    } 
    195230