[MediaWiki-commits] [Gerrit] Nicified some tests - change (mediawiki...Bootstrap)
Mwjames has uploaded a new change for review. https://gerrit.wikimedia.org/r/131009 Change subject: Nicified some tests .. Nicified some tests - SetupAfterCacheTest all combinations of invalid configurations - Remove V3ModuleDefinition from BootstrapManagerTest and use a mock object instead - V3ModuleDefinitionTest adds an integration test with BootstrapManager - Add compliance for coverage reports on PHPunit 4.0.* - Split ModuleDefinition and V3ModuleDefinition into separate files Change-Id: I75d280a4c0df3b9842cda3242259a76d9a248b8d --- M Bootstrap.php M README.md M src/BootstrapManager.php A src/Definition/ModuleDefinition.php R src/Definition/V3ModuleDefinition.php M src/Hooks/SetupAfterCache.php M tests/phpunit/BootstrapManagerTest.php A tests/phpunit/Definition/V3ModuleDefinitionTest.php M tests/phpunit/Hooks/SetupAfterCacheTest.php M tests/phpunit/ResourceLoaderBootstrapModuleTest.php D tests/phpunit/V3ModuleDefinitionTest.php 11 files changed, 253 insertions(+), 118 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Bootstrap refs/changes/09/131009/1 diff --git a/Bootstrap.php b/Bootstrap.php index 64c4ff0..adac389 100644 --- a/Bootstrap.php +++ b/Bootstrap.php @@ -33,11 +33,10 @@ * * @file * @ingroup Bootstrap + * + * @codeCoverageIgnore */ - - call_user_func( function () { - if ( !defined( 'MEDIAWIKI' ) ) { die( 'This file is part of the MediaWiki extension Bootstrap, it is not a valid entry point.' ); @@ -68,10 +67,10 @@ // register classes $GLOBALS[ 'wgAutoloadClasses' ][ 'Bootstrap\ResourceLoaderBootstrapModule' ] = __DIR__ . '/src/ResourceLoaderBootstrapModule.php'; - $GLOBALS[ 'wgAutoloadClasses' ][ 'Bootstrap\BootstrapManager' ] = __DIR__ . '/src/BootstrapManager.php'; + $GLOBALS[ 'wgAutoloadClasses' ][ 'Bootstrap\BootstrapManager' ] = __DIR__ . '/src/BootstrapManager.php'; $GLOBALS[ 'wgAutoloadClasses' ][ 'Bootstrap\Hooks\SetupAfterCache' ] = __DIR__ . '/src/Hooks/SetupAfterCache.php'; - $GLOBALS[ 'wgAutoloadClasses' ][ 'Bootstrap\ModuleDefinition' ] = __DIR__ . '/src/ModuleDefinition.php'; - $GLOBALS[ 'wgAutoloadClasses' ][ 'Bootstrap\V3ModuleDefinition' ] = __DIR__ . '/src/ModuleDefinition.php'; + $GLOBALS[ 'wgAutoloadClasses' ][ 'Bootstrap\Definition\ModuleDefinition' ] = __DIR__ . '/src/Definition/ModuleDefinition.php'; + $GLOBALS[ 'wgAutoloadClasses' ][ 'Bootstrap\Definition\V3ModuleDefinition' ] = __DIR__ . '/src/Definition/V3ModuleDefinition.php'; $GLOBALS[ 'wgHooks' ][ 'SetupAfterCache' ][ ] = function() { @@ -89,8 +88,7 @@ $GLOBALS[ 'wgResourceModules' ][ 'ext.bootstrap.styles' ] = array( 'class' = 'Bootstrap\ResourceLoaderBootstrapModule', 'styles' = array(), - 'variables' = array( - ), + 'variables' = array(), 'dependencies' = array(), ); diff --git a/README.md b/README.md index b7ecb2b..21d720b 100644 --- a/README.md +++ b/README.md @@ -1,8 +1,14 @@ # Bootstrap extension [![Latest Stable Version](https://poser.pugx.org/mediawiki/bootstrap/version.png)](https://packagist.org/packages/mediawiki/bootstrap) [![Packagist download count](https://poser.pugx.org/mediawiki/bootstrap/d/total.png)](https://packagist.org/packages/mediawiki/bootstrap) +[![Dependency Status](https://www.versioneye.com/php/mediawiki:bootstrap/badge.png)](https://www.versioneye.com/php/mediawiki:bootstrap) The [Bootstrap extension][mw-bootstrap] provides Twitter's Bootstrap web front-end framework to skins and extensions. + +## Requirements + +- PHP 5.3.2 or later +- MediaWiki 1.22 or later ## Installation @@ -16,5 +22,10 @@ } ``` +## Tests + +The extension provides unit tests that covers core-functionality normally run by a continues integration platform. Tests can also be executed manually using the [PHPUnit][mw-testing] configuration file found in the root directory. + [mw-bootstrap]: https://www.mediawiki.org/wiki/Extension:Bootstrap +[mw-testing]: https://www.mediawiki.org/wiki/Manual:PHP_unit_testing [composer]: https://getcomposer.org/ diff --git a/src/BootstrapManager.php b/src/BootstrapManager.php index bb129f0..14e7eaa 100644 --- a/src/BootstrapManager.php +++ b/src/BootstrapManager.php @@ -2,6 +2,9 @@ namespace Bootstrap; +use Bootstrap\Definition\V3ModuleDefinition; +use Bootstrap\Definition\ModuleDefinition; + /** * File holding the Bootstrap class * @@ -122,9 +125,11 @@ $GLOBALS[ 'wgResourceModules' ][ 'ext.bootstrap.' . $filetype ][ $filetype ] = array_merge( $GLOBALS[ 'wgResourceModules' ][ 'ext.bootstrap.' . $filetype ][ $filetype ], - array_map( function (
[MediaWiki-commits] [Gerrit] Nicified some tests - change (mediawiki...Bootstrap)
Mwjames has submitted this change and it was merged. Change subject: Nicified some tests .. Nicified some tests - SetupAfterCacheTest test all combinations of invalid configurations - Remove V3ModuleDefinition from BootstrapManagerTest and use a mock object instead - V3ModuleDefinitionTest adds an integration test with BootstrapManager - Add compliance for coverage reports on PHPunit 4.0.* - Split ModuleDefinition and V3ModuleDefinition into separate files Change-Id: I75d280a4c0df3b9842cda3242259a76d9a248b8d --- M Bootstrap.php M README.md M src/BootstrapManager.php A src/Definition/ModuleDefinition.php R src/Definition/V3ModuleDefinition.php M src/Hooks/SetupAfterCache.php M tests/phpunit/BootstrapManagerTest.php A tests/phpunit/Definition/V3ModuleDefinitionTest.php M tests/phpunit/Hooks/SetupAfterCacheTest.php M tests/phpunit/ResourceLoaderBootstrapModuleTest.php D tests/phpunit/V3ModuleDefinitionTest.php 11 files changed, 253 insertions(+), 118 deletions(-) Approvals: Mwjames: Verified; Looks good to me, approved diff --git a/Bootstrap.php b/Bootstrap.php index 64c4ff0..adac389 100644 --- a/Bootstrap.php +++ b/Bootstrap.php @@ -33,11 +33,10 @@ * * @file * @ingroup Bootstrap + * + * @codeCoverageIgnore */ - - call_user_func( function () { - if ( !defined( 'MEDIAWIKI' ) ) { die( 'This file is part of the MediaWiki extension Bootstrap, it is not a valid entry point.' ); @@ -68,10 +67,10 @@ // register classes $GLOBALS[ 'wgAutoloadClasses' ][ 'Bootstrap\ResourceLoaderBootstrapModule' ] = __DIR__ . '/src/ResourceLoaderBootstrapModule.php'; - $GLOBALS[ 'wgAutoloadClasses' ][ 'Bootstrap\BootstrapManager' ] = __DIR__ . '/src/BootstrapManager.php'; + $GLOBALS[ 'wgAutoloadClasses' ][ 'Bootstrap\BootstrapManager' ] = __DIR__ . '/src/BootstrapManager.php'; $GLOBALS[ 'wgAutoloadClasses' ][ 'Bootstrap\Hooks\SetupAfterCache' ] = __DIR__ . '/src/Hooks/SetupAfterCache.php'; - $GLOBALS[ 'wgAutoloadClasses' ][ 'Bootstrap\ModuleDefinition' ] = __DIR__ . '/src/ModuleDefinition.php'; - $GLOBALS[ 'wgAutoloadClasses' ][ 'Bootstrap\V3ModuleDefinition' ] = __DIR__ . '/src/ModuleDefinition.php'; + $GLOBALS[ 'wgAutoloadClasses' ][ 'Bootstrap\Definition\ModuleDefinition' ] = __DIR__ . '/src/Definition/ModuleDefinition.php'; + $GLOBALS[ 'wgAutoloadClasses' ][ 'Bootstrap\Definition\V3ModuleDefinition' ] = __DIR__ . '/src/Definition/V3ModuleDefinition.php'; $GLOBALS[ 'wgHooks' ][ 'SetupAfterCache' ][ ] = function() { @@ -89,8 +88,7 @@ $GLOBALS[ 'wgResourceModules' ][ 'ext.bootstrap.styles' ] = array( 'class' = 'Bootstrap\ResourceLoaderBootstrapModule', 'styles' = array(), - 'variables' = array( - ), + 'variables' = array(), 'dependencies' = array(), ); diff --git a/README.md b/README.md index b7ecb2b..21d720b 100644 --- a/README.md +++ b/README.md @@ -1,8 +1,14 @@ # Bootstrap extension [![Latest Stable Version](https://poser.pugx.org/mediawiki/bootstrap/version.png)](https://packagist.org/packages/mediawiki/bootstrap) [![Packagist download count](https://poser.pugx.org/mediawiki/bootstrap/d/total.png)](https://packagist.org/packages/mediawiki/bootstrap) +[![Dependency Status](https://www.versioneye.com/php/mediawiki:bootstrap/badge.png)](https://www.versioneye.com/php/mediawiki:bootstrap) The [Bootstrap extension][mw-bootstrap] provides Twitter's Bootstrap web front-end framework to skins and extensions. + +## Requirements + +- PHP 5.3.2 or later +- MediaWiki 1.22 or later ## Installation @@ -16,5 +22,10 @@ } ``` +## Tests + +The extension provides unit tests that covers core-functionality normally run by a continues integration platform. Tests can also be executed manually using the [PHPUnit][mw-testing] configuration file found in the root directory. + [mw-bootstrap]: https://www.mediawiki.org/wiki/Extension:Bootstrap +[mw-testing]: https://www.mediawiki.org/wiki/Manual:PHP_unit_testing [composer]: https://getcomposer.org/ diff --git a/src/BootstrapManager.php b/src/BootstrapManager.php index bb129f0..14e7eaa 100644 --- a/src/BootstrapManager.php +++ b/src/BootstrapManager.php @@ -2,6 +2,9 @@ namespace Bootstrap; +use Bootstrap\Definition\V3ModuleDefinition; +use Bootstrap\Definition\ModuleDefinition; + /** * File holding the Bootstrap class * @@ -122,9 +125,11 @@ $GLOBALS[ 'wgResourceModules' ][ 'ext.bootstrap.' . $filetype ][ $filetype ] = array_merge( $GLOBALS[ 'wgResourceModules' ][ 'ext.bootstrap.' . $filetype ][ $filetype ], - array_map( function ( $filename ) use ( $fileExt ) { return $filename . $fileExt; },