/** * @dataProvider phalanxUserModelDataProvider */ public function testPhalanxUserModelMatchEmail($isAnon, $userName, $email, $block, $result, $errorMsg) { $userMock = $this->setUpUser($userName, $email, $isAnon); $this->setUpTest($block); // model $model = new PhalanxUserModel($userMock); $ret = (int) $model->match_email(); $this->assertEquals($result, $ret); }
/** * handler for hook blockCheck * * @static * * @desc blockCheck() will return false if user is blocked. The reason why it was * written in such way is below when you look at method UserBlock::onUserCanSendEmail(). */ public static function blockCheck(User $user) { wfProfileIn(__METHOD__); $phalanxModel = new PhalanxUserModel($user); $ret = $phalanxModel->match_user(); if ($ret !== false) { if (self::$checkEmail === true) { $ret = $phalanxModel->match_email(); if ($ret === false) { self::$typeBlock = 'email'; } } } if ($ret === false) { $user = $phalanxModel->userBlock($user->isAnon() ? 'ip' : 'exact')->getUser(); self::$typeBlock = empty(self::$typeBlock) ? 'user' : self::$typeBlock; } wfProfileOut(__METHOD__); return $ret; }