| | 74 | } |
| | 75 | |
| | 76 | public function it情報更新の際、変更後のユーザ名が重複しないかを事前に確認する() |
| | 77 | { |
| | 78 | $this->_createUserRecord($this->_foo); |
| | 79 | |
| | 80 | $mapper = Piece_ORM::getMapper('Users'); |
| | 81 | $user = $mapper->findByUserName($this->_foo->userName); |
| | 82 | |
| | 83 | $this->spec(Phwittr_Account::confirmNewUserName($user->id, 'NewUserName') |
| | 84 | )->should->beTrue(); |
| | 85 | } |
| | 86 | |
| | 87 | public function it事前確認における変更後のユーザ名が重複していれば例外発生() |
| | 88 | { |
| | 89 | $this->_createUserRecord($this->_foo); |
| | 90 | $this->_createUserRecord($this->_bar); |
| | 91 | |
| | 92 | $mapper = Piece_ORM::getMapper('Users'); |
| | 93 | $user = $mapper->findByUserName($this->_foo->userName); |
| | 94 | |
| | 95 | try { |
| | 96 | Phwittr_Account::confirmNewUserName($user->id, $this->_bar->userName); |
| | 97 | } catch (Phwittr_Account_Exception $e) { |
| | 98 | return; |
| | 99 | } |
| | 100 | |
| | 101 | $this->fail(); |
| | 102 | } |
| | 103 | |
| | 104 | public function it情報更新の際、変更後のメールアドレスが重複しないかを事前に確認する() |
| | 105 | { |
| | 106 | $this->_createUserRecord($this->_foo); |
| | 107 | |
| | 108 | $mapper = Piece_ORM::getMapper('Users'); |
| | 109 | $user = $mapper->findByUserName($this->_foo->userName); |
| | 110 | |
| | 111 | $this->spec(Phwittr_Account::confirmNewEmail($user->id, 'new@example.com') |
| | 112 | )->should->beTrue(); |
| | 113 | } |
| | 114 | |
| | 115 | public function it事前確認における変更後のメールアドレスが重複していれば例外発生() |
| | 116 | { |
| | 117 | $this->_createUserRecord($this->_foo); |
| | 118 | $this->_createUserRecord($this->_bar); |
| | 119 | |
| | 120 | $mapper = Piece_ORM::getMapper('Users'); |
| | 121 | $user = $mapper->findByUserName($this->_foo->userName); |
| | 122 | |
| | 123 | try { |
| | 124 | Phwittr_Account::confirmNewEmail($user->id, $this->_bar->email); |
| | 125 | } catch (Phwittr_Account_Exception $e) { |
| | 126 | return; |
| | 127 | } |
| | 128 | |
| | 129 | $this->fail(); |