Example #1
0
 /**
  * @dataProvider constructorProvider
  *
  * @param array $settings
  */
 public function testConstructor(array $settings)
 {
     $settingsObject = new Settings($settings);
     foreach ($settings as $name => $value) {
         $this->assertEquals($value, $settingsObject->get($name));
     }
     $this->assertTrue(true);
 }
 private function getListForParams(array $rawParams)
 {
     $extension = new Extension(Settings::newFromGlobals($GLOBALS));
     $definition = $extension->getListHookDefinition();
     $params = $this->getProcessedParams($definition, $rawParams);
     return $extension->newSubPageListRenderer()->render(self::$pages[$params['page']], $params);
 }
 private function getSubPageCountFor($pageName)
 {
     $extension = new Extension(Settings::newFromGlobals($GLOBALS));
     $functionRunner = new FunctionRunner($extension->getCountHookDefinition(), $extension->getCountHookHandler());
     $frame = $this->getMock('PPFrame');
     $frame->expects($this->once())->method('expand')->will($this->returnArgument(0));
     $result = $functionRunner->run($GLOBALS['wgParser'], array('page' => $pageName), $frame);
     return reset($result);
 }
 private function getListForRawParams(array $params)
 {
     $extension = new Extension(Settings::newFromGlobals($GLOBALS));
     $functionRunner = new FunctionRunner($extension->getListHookDefinition(), $extension->getListHookHandler());
     $frame = $this->getMock('PPFrame');
     $frame->expects($this->exactly(count($params)))->method('expand')->will($this->returnArgument(0));
     $result = $functionRunner->run($GLOBALS['wgParser'], $params, $frame);
     return reset($result);
 }
Example #5
0
 * @licence GNU GPL v2+
 * @author Jeroen De Dauw < *****@*****.** >
 */
if (!defined('MEDIAWIKI')) {
    die('Not an entry point.');
}
if (defined('SPL_VERSION')) {
    // Do not initialize more than once.
    return 1;
}
define('SPL_VERSION', '1.3.0-alpha');
// Include the composer autoloader if it is present.
if (is_readable(__DIR__ . '/vendor/autoload.php')) {
    include_once __DIR__ . '/vendor/autoload.php';
}
// Only initialize the extension when all dependencies are present.
if (!defined('ParserHooks_VERSION')) {
    throw new Exception('You need to have ParserHooks installed in order to use SubPageList');
}
call_user_func(function () {
    $GLOBALS['wgExtensionCredits']['parserhook'][] = array('path' => __FILE__, 'name' => 'SubPageList', 'version' => SPL_VERSION, 'author' => array('[https://www.mediawiki.org/wiki/User:Jeroen_De_Dauw Jeroen De Dauw]'), 'url' => 'https://github.com/JeroenDeDauw/SubPageList/blob/master/README.md', 'descriptionmsg' => 'spl-desc', 'license-name' => 'GPL-2.0+');
    $GLOBALS['wgMessagesDirs']['SubPageList'] = __DIR__ . '/i18n';
    $GLOBALS['wgExtensionMessagesFiles']['SubPageListMagic'] = __DIR__ . '/SubPageList.i18n.magic.php';
    $GLOBALS['wgExtensionFunctions'][] = function () {
        global $wgHooks;
        $extension = new \SubPageList\Extension(\SubPageList\Settings::newFromGlobals($GLOBALS));
        $extensionSetup = new \SubPageList\Setup($extension, $wgHooks, __DIR__);
        $extensionSetup->run();
    };
});
require_once 'SubPageList.settings.php';
Example #6
0
 private function newExtension()
 {
     return new \SubPageList\Extension(\SubPageList\Settings::newFromGlobals($GLOBALS));
 }
Example #7
0
 public function instanceProvider()
 {
     $argLists = [];
     $argLists[] = [new Extension(Settings::newFromGlobals($GLOBALS))];
     return $argLists;
 }
 public function instanceProvider()
 {
     $argLists = array();
     $argLists[] = array(new Extension(Settings::newFromGlobals($GLOBALS)));
     return $argLists;
 }