Exemplo n.º 1
0
 public function testAddExternalModule()
 {
     $moduleDefinition = $this->getMockBuilder('\\Bootstrap\\Definition\\ModuleDefinition')->disableOriginalConstructor()->setMethods(array('get'))->getMock();
     $moduleDefinition->expects($this->atLeastOnce())->method('get')->will($this->returnValue(array()));
     $instance = new BootstrapManager($moduleDefinition);
     $instance->addExternalModule('ExternalFooModule', 'ExternalRemoteBarPath');
     $this->assertArrayHasKey('ExternalFooModule', $this->getGlobalResourceModuleBootstrapExternalStyles());
 }
 public function testStylesCompile()
 {
     $setupAfterCache = new SetupAfterCache(BootstrapManager::getInstance(), $GLOBALS);
     $setupAfterCache->process();
     $resourceLoaderContext = $this->getMockBuilder('\\ResourceLoaderContext')->disableOriginalConstructor()->getMock();
     $module = new ResourceLoaderBootstrapModule($GLOBALS['wgResourceModules']['ext.bootstrap.styles']);
     $module->setCache(new HashBagOStuff());
     $styles = $module->getStyles($resourceLoaderContext);
     $css = CSSMin::minify($styles['all']);
     $this->assertNotEquals('', $css);
 }
    // define the skin's version
    define('CHAMELEON_VERSION', '1.2-alpha');
    // set credits
    $GLOBALS['wgExtensionCredits']['skin'][] = array('path' => __FILE__, 'name' => 'Chameleon', 'descriptionmsg' => 'chameleon-desc', 'author' => '[http://www.mediawiki.org/wiki/User:F.trott Stephan Gambke]', 'url' => 'https://www.mediawiki.org/wiki/Skin:Chameleon', 'version' => CHAMELEON_VERSION, 'license-name' => 'GPLv3+');
    // register skin
    $GLOBALS['wgValidSkinNames']['chameleon'] = 'Chameleon';
    // register message file for i18n
    $GLOBALS['wgExtensionMessagesFiles']['Chameleon'] = __DIR__ . '/Chameleon.i18n.php';
    $GLOBALS['wgMessagesDirs']['Chameleon'] = __DIR__ . '/resources/i18n';
    /**
     * Using callbacks for hook registration
     *
     * The hook registry should contain as less knowledge about a process as
     * necessary therefore a callback is used as Factory/Builder that instantiates
     * a business / domain object.
     *
     * GLOBAL state should be encapsulated by the callback and not leaked into
     * a instantiated class
     */
    /**
     * @see https://www.mediawiki.org/wiki/Manual:Hooks/SetupAfterCache
     */
    $GLOBALS['wgHooks']['SetupAfterCache'][] = function () {
        $setupAfterCache = new \Skins\Chameleon\Hooks\SetupAfterCache(\Bootstrap\BootstrapManager::getInstance(), $GLOBALS);
        $setupAfterCache->process();
    };
    // set default skin layout
    $GLOBALS['egChameleonLayoutFile'] = dirname(__FILE__) . '/layouts/standard.xml';
    // enable the VisualEditor for this skin
    $GLOBALS['egChameleonEnableVisualEditor'] = true;
});
 public function testBootstrapManagerIntegration()
 {
     $instance = new BootstrapManager(new V3ModuleDefinition());
     $instance->addAllBootstrapModules();
     $this->assertTrue(true);
 }
        $GLOBALS['wgAutoloadClasses']['Skins\\Chameleon\\Components\\' . $component] = __DIR__ . '/src/Components/' . $component . '.php';
    }
    $GLOBALS['wgAutoloadClasses']['SkinChameleon'] = dirname(__FILE__) . '/src/SkinChameleon.php';
    // register skin class (must be 'Skin' . SkinName)
    $GLOBALS['wgAutoloadClasses']['Skins\\Chameleon\\ChameleonTemplate'] = dirname(__FILE__) . '/src/ChameleonTemplate.php';
    $GLOBALS['wgAutoloadClasses']['Skins\\Chameleon\\IdRegistry'] = dirname(__FILE__) . '/src/IdRegistry.php';
    $GLOBALS['wgAutoloadClasses']['Skins\\Chameleon\\Hooks\\SetupAfterCache'] = __DIR__ . '/src/Hooks/SetupAfterCache.php';
    /**
     * Using callbacks for hook registration
     *
     * The hook registry should contain as less knowledge about a process as
     * necessary therefore a callback is used as Factory/Builder that instantiates
     * a business / domain object.
     *
     * GLOBAL state should be encapsulated by the callback and not leaked into
     * a instantiated class
     */
    /**
     * @see https://www.mediawiki.org/wiki/Manual:Hooks/SetupAfterCache
     */
    $GLOBALS['wgHooks']['SetupAfterCache'][] = function () {
        $configKeysToCopy = array('egChameleonExternalStyleModules', 'egChameleonExternalLessVariables', 'egChameleonEnableVisualEditor', 'IP', 'wgStyleDirectory', 'wgStylePath', 'wgVisualEditorSupportedSkins');
        $configuration = array_intersect_key($GLOBALS, array_flip($configKeysToCopy));
        $setupAfterCache = new \Skins\Chameleon\Hooks\SetupAfterCache(\Bootstrap\BootstrapManager::getInstance(), $configuration);
        $setupAfterCache->process()->adjustConfiguration($GLOBALS);
    };
    // set default skin layout
    $GLOBALS['egChameleonLayoutFile'] = dirname(__FILE__) . '/layouts/standard.xml';
    // enable the VisualEditor for this skin
    $GLOBALS['egChameleonEnableVisualEditor'] = true;
});