/** * @group Slow * @slowExecutionTime 0.04572 ms * @dataProvider phalanxContentModelDataProvider */ public function testPhalanxContentModelSummary($title, $text, $summary, $block_text, $block_summary, $result_text, $result_summary) { $titleMock = $this->setUpTitle($title); $this->setUpTest($block_summary); $model = new PhalanxContentModel($titleMock); $ret = (int) $model->match_summary($summary); $this->assertEquals($result_summary, $ret); }
public static function abortMove($oldTitle, $newTitle, $user, &$error, $reason) { wfProfileIn(__METHOD__); if (self::isContentBlockingDisabled()) { wfProfileOut(__METHOD__); wfDebug(__METHOD__ . ": content blocking disabled by \$wgPhalanxDisableContent\n"); return true; } $phalanxModel = new PhalanxContentModel($newTitle); $ret = $phalanxModel->match_title(); if ($ret !== false) { /* compare reason with spam-whitelist - WTF? */ if (!empty($reason) && is_null(self::$whitelist)) { self::$whitelist = $phalanxModel->buildWhiteList(); } /* check reason - WHY? */ if (!empty(self::$whitelist)) { $reason = preg_replace(self::$whitelist, '', $reason); } $ret = $phalanxModel->match_summary($reason); } if ($ret === false) { $error .= $phalanxModel->reasonBlock(); } wfProfileOut(__METHOD__); return true; }