/** * @dataProvider getRedirectsDataProvider */ public function testPrepareRedirects($redirects, $expected) { $redirectService = new RedirectService('wam'); $redirectService->setRedirects($redirects); $prepare = $this->getReflectionMethod('prepareRedirects'); $preparedRedirects = $prepare->invoke($redirectService); $this->assertEquals($expected, $preparedRedirects); }
/** * @param Title $title * @param Page $article * * @return true because it's a hook */ public static function onArticleFromTitle(&$title, &$article) { global $wgOut; wfProfileIn(__METHOD__); self::init(); if (self::$model->isWAMPage($title)) { self::$app->wg->SuppressPageHeader = true; self::$app->wg->SuppressWikiHeader = true; self::$app->wg->SuppressRail = true; self::$app->wg->SuppressFooter = true; $article = new WAMPageArticle($title); } else { $redirectService = new RedirectService('wam'); $redirectService->redirectIfURLExists(); } wfProfileOut(__METHOD__); return true; }
public static function onArticleFromTitle(&$title, &$article) { $redirectService = new RedirectService('hubsv2'); $redirectService->redirectIfURLExists(); return true; }