/** * Finds user by [[username]] * * @return User|null */ protected function getUser() { if ($this->_user === null) { $this->_user = User::findByEmail($this->email); } return $this->_user; }
public function testSaveTwoSameImagesInDifferentFields() { $user = new User(); $user->username = '******'; $user->email = '*****@*****.**'; $user->password = '******'; $user->image = $this->pathToImage; $user->image_path = $this->pathToImage; $user->getBehavior('uploadFile')->fields[] = 'image_path'; $user->save(); $compareUser = User::findByEmail('*****@*****.**'); $this->assertNotEquals((string) $compareUser->image, (string) $compareUser->image_path); }