| | 85 | public function it変更後のユーザ名が重複しないかを確認して問題がなければ正を得る() |
| | 86 | { |
| | 87 | $mapper = Piece_ORM::getMapper('Users'); |
| | 88 | $user = $mapper->findByUserName($this->_foo->userName); |
| | 89 | |
| | 90 | $this->spec(Phwittr_Account::confirmNewUserName($user->id, 'NewUserName') |
| | 91 | )->should->beTrue(); |
| | 92 | } |
| | 93 | |
| | 94 | public function it変更後のユーザ名が重複していれば例外発生() |
| | 95 | { |
| | 96 | $mapper = Piece_ORM::getMapper('Users'); |
| | 97 | $user = $mapper->findByUserName($this->_foo->userName); |
| | 98 | |
| | 99 | try { |
| | 100 | Phwittr_Account::confirmNewUserName($user->id, $this->_bar->userName); |
| | 101 | } catch (Phwittr_Account_Exception $e) { |
| | 102 | return; |
| | 103 | } |
| | 104 | |
| | 105 | $this->fail(); |
| | 106 | } |
| | 107 | |
| | 108 | public function it変更後のメールアドレスが重複しないかを確認して問題がなければ正を得る() |
| | 109 | { |
| | 110 | $mapper = Piece_ORM::getMapper('Users'); |
| | 111 | $user = $mapper->findByUserName($this->_foo->userName); |
| | 112 | |
| | 113 | $this->spec(Phwittr_Account::confirmNewEmail($user->id, 'new@example.com') |
| | 114 | )->should->beTrue(); |
| | 115 | } |
| | 116 | |
| | 117 | public function it変更後のメールアドレスが重複していれば例外発生() |
| | 118 | { |
| | 119 | $mapper = Piece_ORM::getMapper('Users'); |
| | 120 | $user = $mapper->findByUserName($this->_foo->userName); |
| | 121 | |
| | 122 | try { |
| | 123 | Phwittr_Account::confirmNewEmail($user->id, $this->_bar->email); |
| | 124 | } catch (Phwittr_Account_Exception $e) { |
| | 125 | return; |
| | 126 | } |
| | 127 | |
| | 128 | $this->fail(); |
| | 129 | } |
| | 130 | |
| | 131 | public function itユーザ名が他レコードのものと重複している状態では更新できない() |
| | 132 | { |
| | 133 | $mapper = Piece_ORM::getMapper('Users'); |
| | 134 | $fooUser = $mapper->findByUserName($this->_foo->userName); |
| | 135 | |
| | 136 | $fooUser->userName = $this->_bar->userName; |
| | 137 | |
| | 138 | try { |
| | 139 | $account = new Phwittr_Account(); |
| | 140 | $account->update($fooUser); |
| | 141 | } catch (Phwittr_Account_Exception $e) { |
| | 142 | return; |
| | 143 | } |
| | 144 | |
| | 145 | $this->fail(); |
| | 146 | } |
| | 147 | |
| | 148 | public function itメールアドレスが他レコードのものと重複している状態では更新できない() |
| | 149 | { |
| | 150 | $mapper = Piece_ORM::getMapper('Users'); |
| | 151 | $user = $mapper->findByUserName($this->_foo->userName); |
| | 152 | |
| | 153 | $user->email = $this->_bar->email; |
| | 154 | |
| | 155 | try { |
| | 156 | $account = new Phwittr_Account(); |
| | 157 | $account->update($user); |
| | 158 | } catch (Phwittr_Account_Exception $e) { |
| | 159 | return; |
| | 160 | } |
| | 161 | |
| | 162 | $this->fail(); |
| | 163 | } |
| | 164 | |
| 90 | | $this->spec($newUser->userName)->should->be($this->_bar->userName); |
| 91 | | $this->spec($newUser->email)->should->be($this->_bar->email); |
| 92 | | $this->spec($newUser->privateFlag)->should->be($this->_bar->flag); |
| 93 | | } |
| 94 | | |
| 95 | | public function it情報更新の際、変更後のユーザ名が重複しないかを事前に確認する() |
| 96 | | { |
| 97 | | $this->_createUserRecord($this->_foo); |
| 98 | | |
| 99 | | $mapper = Piece_ORM::getMapper('Users'); |
| 100 | | $user = $mapper->findByUserName($this->_foo->userName); |
| 101 | | |
| 102 | | $this->spec(Phwittr_Account::confirmNewUserName($user->id, 'NewUserName') |
| 103 | | )->should->beTrue(); |
| 104 | | } |
| 105 | | |
| 106 | | public function it事前確認における変更後のユーザ名が重複していれば例外発生() |
| 107 | | { |
| 108 | | $this->_createUserRecord($this->_foo); |
| 109 | | $this->_createUserRecord($this->_bar); |
| 110 | | |
| 111 | | $mapper = Piece_ORM::getMapper('Users'); |
| 112 | | $user = $mapper->findByUserName($this->_foo->userName); |
| 113 | | |
| 114 | | try { |
| 115 | | Phwittr_Account::confirmNewUserName($user->id, $this->_bar->userName); |
| 116 | | } catch (Phwittr_Account_Exception $e) { |
| 117 | | return; |
| 118 | | } |
| 119 | | |
| 120 | | $this->fail(); |
| 121 | | } |
| 122 | | |
| 123 | | public function it情報更新の際、変更後のメールアドレスが重複しないかを事前に確認する() |
| 124 | | { |
| 125 | | $this->_createUserRecord($this->_foo); |
| 126 | | |
| 127 | | $mapper = Piece_ORM::getMapper('Users'); |
| 128 | | $user = $mapper->findByUserName($this->_foo->userName); |
| 129 | | |
| 130 | | $this->spec(Phwittr_Account::confirmNewEmail($user->id, 'new@example.com') |
| 131 | | )->should->beTrue(); |
| 132 | | } |
| 133 | | |
| 134 | | public function it事前確認における変更後のメールアドレスが重複していれば例外発生() |
| 135 | | { |
| 136 | | $this->_createUserRecord($this->_foo); |
| 137 | | $this->_createUserRecord($this->_bar); |
| 138 | | |
| 139 | | $mapper = Piece_ORM::getMapper('Users'); |
| 140 | | $user = $mapper->findByUserName($this->_foo->userName); |
| 141 | | |
| 142 | | try { |
| 143 | | Phwittr_Account::confirmNewEmail($user->id, $this->_bar->email); |
| 144 | | } catch (Phwittr_Account_Exception $e) { |
| 145 | | return; |
| 146 | | } |
| 147 | | |
| 148 | | $this->fail(); |
| 149 | | } |
| 150 | | |
| 151 | | public function itユーザ名が他レコードのものと重複している状態では更新できない() |
| 152 | | { |
| 153 | | $this->_createUserRecord($this->_foo); |
| 154 | | $this->_createUserRecord($this->_bar); |
| 155 | | |
| 156 | | $mapper = Piece_ORM::getMapper('Users'); |
| 157 | | $user = $mapper->findByUserName($this->_foo->userName); |
| 158 | | |
| 159 | | $user->userName = $this->_bar->userName; |
| 160 | | |
| 161 | | try { |
| 162 | | $account = new Phwittr_Account(); |
| 163 | | $account->update($user); |
| 164 | | } catch (Phwittr_Account_Exception $e) { |
| 165 | | return; |
| 166 | | } |
| 167 | | |
| 168 | | $this->fail(); |
| 169 | | } |
| 170 | | |
| 171 | | public function itメールアドレスが他レコードのものと重複している状態では更新できない() |
| 172 | | { |
| 173 | | $this->_createUserRecord($this->_foo); |
| 174 | | $this->_createUserRecord($this->_bar); |
| 175 | | |
| 176 | | $mapper = Piece_ORM::getMapper('Users'); |
| 177 | | $user = $mapper->findByUserName($this->_foo->userName); |
| 178 | | |
| 179 | | $user->email = $this->_bar->email; |
| 180 | | |
| 181 | | try { |
| 182 | | $account = new Phwittr_Account(); |
| 183 | | $account->update($user); |
| 184 | | } catch (Phwittr_Account_Exception $e) { |
| 185 | | return; |
| 186 | | } |
| 187 | | |
| 188 | | $this->fail(); |
| 189 | | } |
| 190 | | |
| 191 | | public function itパスワードは個別で更新() |
| 192 | | { |
| 193 | | $this->_createUserRecord($this->_foo); |
| 194 | | |
| | 180 | $this->spec($newUser->userName)->should->be($this->_baz->userName); |
| | 181 | $this->spec($newUser->email)->should->be($this->_baz->email); |
| | 182 | $this->spec($newUser->privateFlag)->should->be($this->_baz->flag); |
| | 183 | } |
| | 184 | |
| | 185 | public function itパスワードは個別で更新する() |
| | 186 | { |