mirror of
https://gerrit.wikimedia.org/r/mediawiki/skins/Vector.git
synced 2024-11-23 15:26:47 +00:00
Normalise PHP namespaces used in Vector
- `MediaWiki\Skins\Vector\Tests` is now the prefix for all tests in the skin - we followed PSR conventions of following folder structure after the prefix - Optimize imports/use order - update namespace in skin.json Bug: T303102 Change-Id: Ib76374d81d973c83adfd6c8e7863ff6d797e655d
This commit is contained in:
parent
80fc9dcace
commit
e46eef19d0
|
@ -1,5 +1,5 @@
|
|||
<?php
|
||||
namespace Vector;
|
||||
namespace MediaWiki\Skins\Vector;
|
||||
|
||||
use FatalError;
|
||||
|
||||
|
|
|
@ -20,9 +20,9 @@
|
|||
* @since 1.35
|
||||
*/
|
||||
|
||||
namespace Vector\FeatureManagement;
|
||||
namespace MediaWiki\Skins\Vector\FeatureManagement;
|
||||
|
||||
use Vector\FeatureManagement\Requirements\SimpleRequirement;
|
||||
use MediaWiki\Skins\Vector\FeatureManagement\Requirements\SimpleRequirement;
|
||||
use Wikimedia\Assert\Assert;
|
||||
|
||||
/**
|
||||
|
@ -33,7 +33,7 @@ use Wikimedia\Assert\Assert;
|
|||
*
|
||||
* @unstable
|
||||
*
|
||||
* @package Vector\FeatureManagement
|
||||
* @package MediaWiki\Skins\Vector\FeatureManagement
|
||||
* @internal
|
||||
*/
|
||||
final class FeatureManager {
|
||||
|
|
|
@ -20,7 +20,7 @@
|
|||
* @since 1.35
|
||||
*/
|
||||
|
||||
namespace Vector\FeatureManagement;
|
||||
namespace MediaWiki\Skins\Vector\FeatureManagement;
|
||||
|
||||
/**
|
||||
* NOTE: This API hasn't settled. It may change at any time without warning. Please don't bind to
|
||||
|
@ -28,7 +28,7 @@ namespace Vector\FeatureManagement;
|
|||
*
|
||||
* @unstable
|
||||
*
|
||||
* @package Vector\FeatureManagement
|
||||
* @package MediaWiki\Skins\Vector\FeatureManagement
|
||||
* @internal
|
||||
*/
|
||||
interface Requirement {
|
||||
|
|
|
@ -20,9 +20,9 @@
|
|||
* @since 1.35
|
||||
*/
|
||||
|
||||
namespace Vector\FeatureManagement\Requirements;
|
||||
namespace MediaWiki\Skins\Vector\FeatureManagement\Requirements;
|
||||
|
||||
use Vector\FeatureManagement\Requirement;
|
||||
use MediaWiki\Skins\Vector\FeatureManagement\Requirement;
|
||||
|
||||
/**
|
||||
* Some application state changes throughout the lifetime of the application, e.g. `wgSitename` or
|
||||
|
@ -61,7 +61,7 @@ use Vector\FeatureManagement\Requirement;
|
|||
*
|
||||
* @unstable
|
||||
*
|
||||
* @package Vector\FeatureManagement\Requirements
|
||||
* @package MediaWiki\Skins\Vector\FeatureManagement\Requirements
|
||||
* @internal
|
||||
*/
|
||||
final class DynamicConfigRequirement implements Requirement {
|
||||
|
|
|
@ -19,12 +19,12 @@
|
|||
* @file
|
||||
*/
|
||||
|
||||
namespace Vector\FeatureManagement\Requirements;
|
||||
namespace MediaWiki\Skins\Vector\FeatureManagement\Requirements;
|
||||
|
||||
use CentralIdLookup;
|
||||
use Config;
|
||||
use MediaWiki\Skins\Vector\FeatureManagement\Requirement;
|
||||
use User;
|
||||
use Vector\FeatureManagement\Requirement;
|
||||
use WebRequest;
|
||||
|
||||
/**
|
||||
|
@ -63,7 +63,7 @@ use WebRequest;
|
|||
* NOTE: This API hasn't settled. It may change at any time without warning. Please don't bind to
|
||||
* it unless you absolutely need to
|
||||
*
|
||||
* @package Vector\FeatureManagement\Requirements
|
||||
* @package MediaWiki\Skins\Vector\FeatureManagement\Requirements
|
||||
*/
|
||||
final class OverridableConfigRequirement implements Requirement {
|
||||
|
||||
|
|
|
@ -20,9 +20,9 @@
|
|||
* @since 1.35
|
||||
*/
|
||||
|
||||
namespace Vector\FeatureManagement\Requirements;
|
||||
namespace MediaWiki\Skins\Vector\FeatureManagement\Requirements;
|
||||
|
||||
use Vector\FeatureManagement\Requirement;
|
||||
use MediaWiki\Skins\Vector\FeatureManagement\Requirement;
|
||||
|
||||
/**
|
||||
* NOTE: This API hasn't settled. It may change at any time without warning. Please don't bind to
|
||||
|
@ -30,7 +30,7 @@ use Vector\FeatureManagement\Requirement;
|
|||
*
|
||||
* @unstable
|
||||
*
|
||||
* @package Vector\FeatureManagement\Requirements
|
||||
* @package MediaWiki\Skins\Vector\FeatureManagement\Requirements
|
||||
* @internal
|
||||
*/
|
||||
class SimpleRequirement implements Requirement {
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
<?php
|
||||
|
||||
namespace Vector;
|
||||
namespace MediaWiki\Skins\Vector;
|
||||
|
||||
use Config;
|
||||
use MediaWiki\Auth\Hook\LocalUserCreatedHook;
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
<?php
|
||||
|
||||
namespace Vector\ResourceLoader;
|
||||
namespace MediaWiki\Skins\Vector\ResourceLoader;
|
||||
|
||||
use MediaWiki\Skins\Vector\Constants;
|
||||
use ResourceLoaderContext;
|
||||
use ResourceLoaderUserModule;
|
||||
use Vector\Constants;
|
||||
|
||||
class VectorResourceLoaderUserModule extends ResourceLoaderUserModule {
|
||||
/**
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
<?php
|
||||
|
||||
namespace Vector\ResourceLoader;
|
||||
namespace MediaWiki\Skins\Vector\ResourceLoader;
|
||||
|
||||
use MediaWiki\Skins\Vector\Constants;
|
||||
use ResourceLoaderContext;
|
||||
use ResourceLoaderUserStylesModule;
|
||||
use Vector\Constants;
|
||||
|
||||
class VectorResourceLoaderUserStylesModule extends ResourceLoaderUserStylesModule {
|
||||
/**
|
||||
|
|
|
@ -23,10 +23,10 @@
|
|||
*/
|
||||
|
||||
use MediaWiki\MediaWikiServices;
|
||||
use Vector\Constants;
|
||||
use Vector\FeatureManagement\FeatureManager;
|
||||
use Vector\FeatureManagement\Requirements\DynamicConfigRequirement;
|
||||
use Vector\FeatureManagement\Requirements\OverridableConfigRequirement;
|
||||
use MediaWiki\Skins\Vector\Constants;
|
||||
use MediaWiki\Skins\Vector\FeatureManagement\FeatureManager;
|
||||
use MediaWiki\Skins\Vector\FeatureManagement\Requirements\DynamicConfigRequirement;
|
||||
use MediaWiki\Skins\Vector\FeatureManagement\Requirements\OverridableConfigRequirement;
|
||||
|
||||
return [
|
||||
Constants::SERVICE_FEATURE_MANAGER => static function ( MediaWikiServices $services ) {
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
<?php
|
||||
|
||||
namespace Vector\Services;
|
||||
namespace MediaWiki\Skins\Vector\Services;
|
||||
|
||||
class LanguageService {
|
||||
/**
|
||||
|
|
|
@ -22,7 +22,7 @@
|
|||
* @ingroup Skins
|
||||
*/
|
||||
|
||||
namespace Vector;
|
||||
namespace MediaWiki\Skins\Vector;
|
||||
|
||||
use ExtensionRegistry;
|
||||
use Html;
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
<?php
|
||||
|
||||
namespace Vector;
|
||||
namespace MediaWiki\Skins\Vector;
|
||||
|
||||
use MediaWiki\MediaWikiServices;
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
<?php
|
||||
|
||||
namespace Vector;
|
||||
namespace MediaWiki\Skins\Vector;
|
||||
|
||||
/**
|
||||
* @ingroup Skins
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
<?php
|
||||
|
||||
namespace Vector;
|
||||
namespace MediaWiki\Skins\Vector;
|
||||
|
||||
use MediaWiki\MediaWikiServices;
|
||||
use Vector\FeatureManagement\FeatureManager;
|
||||
use Vector\Services\LanguageService;
|
||||
use MediaWiki\Skins\Vector\FeatureManagement\FeatureManager;
|
||||
use MediaWiki\Skins\Vector\Services\LanguageService;
|
||||
|
||||
/**
|
||||
* A service locator for services specific to Vector.
|
||||
|
|
21
skin.json
21
skin.json
|
@ -25,7 +25,7 @@
|
|||
},
|
||||
"ValidSkinNames": {
|
||||
"vector-2022": {
|
||||
"class": "Vector\\SkinVector22",
|
||||
"class": "MediaWiki\\Skins\\Vector\\SkinVector22",
|
||||
"args": [
|
||||
{
|
||||
"name": "vector-2022",
|
||||
|
@ -78,7 +78,7 @@
|
|||
]
|
||||
},
|
||||
"vector": {
|
||||
"class": "Vector\\SkinVectorLegacy",
|
||||
"class": "MediaWiki\\Skins\\Vector\\SkinVectorLegacy",
|
||||
"@args": "See SkinVector::__construct for more detail.",
|
||||
"args": [
|
||||
{
|
||||
|
@ -129,14 +129,17 @@
|
|||
]
|
||||
},
|
||||
"AutoloadNamespaces": {
|
||||
"Vector\\": "includes/"
|
||||
"MediaWiki\\Skins\\Vector\\": "includes/"
|
||||
},
|
||||
"TestAutoloadNamespaces": {
|
||||
"MediaWiki\\Skins\\Vector\\Tests\\": "tests/phpunit/"
|
||||
},
|
||||
"ConfigRegistry": {
|
||||
"vector": "GlobalVarConfig::newInstance"
|
||||
},
|
||||
"HookHandlers": {
|
||||
"VectorHooks": {
|
||||
"class": "Vector\\Hooks"
|
||||
"class": "MediaWiki\\Skins\\Vector\\Hooks"
|
||||
}
|
||||
},
|
||||
"Hooks": {
|
||||
|
@ -151,10 +154,10 @@
|
|||
"@note": "When modifying skins.vector.styles definition, make sure the installer still works",
|
||||
"ResourceModules": {
|
||||
"skins.vector.user": {
|
||||
"class": "Vector\\ResourceLoader\\VectorResourceLoaderUserModule"
|
||||
"class": "MediaWiki\\Skins\\Vector\\ResourceLoader\\VectorResourceLoaderUserModule"
|
||||
},
|
||||
"skins.vector.user.styles": {
|
||||
"class": "Vector\\ResourceLoader\\VectorResourceLoaderUserStylesModule"
|
||||
"class": "MediaWiki\\Skins\\Vector\\ResourceLoader\\VectorResourceLoaderUserStylesModule"
|
||||
},
|
||||
"skins.vector.search": {
|
||||
"es6": true,
|
||||
|
@ -170,7 +173,7 @@
|
|||
"resources/skins.vector.search/App.vue",
|
||||
{
|
||||
"name": "resources/skins.vector.search/config.json",
|
||||
"callback": "Vector\\Hooks::getVectorWvuiSearchResourceLoaderConfig"
|
||||
"callback": "MediaWiki\\Skins\\Vector\\Hooks::getVectorWvuiSearchResourceLoaderConfig"
|
||||
}
|
||||
],
|
||||
"messages": [
|
||||
|
@ -299,7 +302,7 @@
|
|||
"resources/skins.vector.es6/linkHijack.js",
|
||||
{
|
||||
"name": "resources/skins.vector.es6/config.json",
|
||||
"callback": "Vector\\Hooks::getVectorResourceLoaderConfig"
|
||||
"callback": "MediaWiki\\Skins\\Vector\\Hooks::getVectorResourceLoaderConfig"
|
||||
}
|
||||
],
|
||||
"dependencies": [
|
||||
|
@ -316,7 +319,7 @@
|
|||
"resources/skins.vector.js/skin.js",
|
||||
{
|
||||
"name": "resources/skins.vector.js/config.json",
|
||||
"callback": "Vector\\Hooks::getVectorResourceLoaderConfig"
|
||||
"callback": "MediaWiki\\Skins\\Vector\\Hooks::getVectorResourceLoaderConfig"
|
||||
},
|
||||
"resources/skins.vector.js/dropdownMenus.js",
|
||||
"resources/skins.vector.js/sidebar.js",
|
||||
|
|
|
@ -4,12 +4,12 @@ namespace MediaWiki\Skins\Vector\Tests\Integration;
|
|||
use Exception;
|
||||
use HashConfig;
|
||||
use MediaWiki\MediaWikiServices;
|
||||
use MediaWiki\Skins\Vector\SkinVector22;
|
||||
use MediaWiki\Skins\Vector\SkinVectorLegacy;
|
||||
use MediaWikiIntegrationTestCase;
|
||||
use ReflectionMethod;
|
||||
use RequestContext;
|
||||
use Title;
|
||||
use Vector\SkinVector22;
|
||||
use Vector\SkinVectorLegacy;
|
||||
use Wikimedia\TestingAccessWrapper;
|
||||
|
||||
/**
|
||||
|
@ -178,7 +178,7 @@ class SkinVectorTest extends MediaWikiIntegrationTestCase {
|
|||
}
|
||||
|
||||
/**
|
||||
* @covers \Vector\SkinVector22::getTocData
|
||||
* @covers \MediaWiki\Skins\Vector\SkinVector22::getTocData
|
||||
* @dataProvider provideGetTOCData
|
||||
*/
|
||||
public function testGetTocData(
|
||||
|
@ -198,7 +198,7 @@ class SkinVectorTest extends MediaWikiIntegrationTestCase {
|
|||
}
|
||||
|
||||
/**
|
||||
* @covers \Vector\SkinVector::getTemplateData
|
||||
* @covers \MediaWiki\Skins\Vector\SkinVector::getTemplateData
|
||||
*/
|
||||
public function testGetTemplateData() {
|
||||
$title = Title::newFromText( 'SkinVector' );
|
||||
|
@ -422,7 +422,7 @@ class SkinVectorTest extends MediaWikiIntegrationTestCase {
|
|||
|
||||
/**
|
||||
* @dataProvider providerLanguageAlertRequirements
|
||||
* @covers \Vector\SkinVector::shouldLanguageAlertBeInSidebar
|
||||
* @covers \MediaWiki\Skins\Vector\SkinVector::shouldLanguageAlertBeInSidebar
|
||||
* @param array $requirements
|
||||
* @param Title $title
|
||||
* @param array $getLanguagesCached
|
||||
|
|
|
@ -7,6 +7,10 @@
|
|||
namespace MediaWiki\Skins\Vector\Tests\Integration;
|
||||
|
||||
use HashConfig;
|
||||
use MediaWiki\Skins\Vector\Constants;
|
||||
use MediaWiki\Skins\Vector\Hooks;
|
||||
use MediaWiki\Skins\Vector\SkinVector22;
|
||||
use MediaWiki\Skins\Vector\SkinVectorLegacy;
|
||||
use MediaWiki\User\UserOptionsManager;
|
||||
use MediaWikiIntegrationTestCase;
|
||||
use ReflectionMethod;
|
||||
|
@ -15,16 +19,12 @@ use ResourceLoaderContext;
|
|||
use RuntimeException;
|
||||
use Title;
|
||||
use User;
|
||||
use Vector\Constants;
|
||||
use Vector\Hooks;
|
||||
use Vector\SkinVector22;
|
||||
use Vector\SkinVectorLegacy;
|
||||
|
||||
/**
|
||||
* Integration tests for Vector Hooks.
|
||||
*
|
||||
* @group Vector
|
||||
* @coversDefaultClass \Vector\Hooks
|
||||
* @coversDefaultClass \MediaWiki\Skins\Vector\Hooks
|
||||
*/
|
||||
class VectorHooksTest extends MediaWikiIntegrationTestCase {
|
||||
|
||||
|
|
|
@ -19,14 +19,14 @@
|
|||
* @since 1.35
|
||||
*/
|
||||
|
||||
namespace Vector\FeatureManagement\Tests;
|
||||
namespace MediaWiki\Skins\Vector\Tests\Unit\FeatureManagement;
|
||||
|
||||
use Vector\FeatureManagement\FeatureManager;
|
||||
use MediaWiki\Skins\Vector\FeatureManagement\FeatureManager;
|
||||
|
||||
/**
|
||||
* @group Vector
|
||||
* @group FeatureManagement
|
||||
* @coversDefaultClass \Vector\FeatureManagement\FeatureManager
|
||||
* @coversDefaultClass \MediaWiki\Skins\Vector\FeatureManagement\FeatureManager
|
||||
*/
|
||||
class FeatureManagerTest extends \MediaWikiUnitTestCase {
|
||||
|
||||
|
|
|
@ -20,14 +20,14 @@
|
|||
* @since 1.35
|
||||
*/
|
||||
|
||||
namespace Vector\FeatureManagement\Tests;
|
||||
namespace MediaWiki\Skins\Vector\Tests\Unit\FeatureManagement\Requirements;
|
||||
|
||||
use Vector\FeatureManagement\Requirements\DynamicConfigRequirement;
|
||||
use MediaWiki\Skins\Vector\FeatureManagement\Requirements\DynamicConfigRequirement;
|
||||
|
||||
/**
|
||||
* @group Vector
|
||||
* @group FeatureManagement
|
||||
* @coversDefaultClass \Vector\FeatureManagement\Requirements\DynamicConfigRequirement
|
||||
* @coversDefaultClass \MediaWiki\Skins\Vector\FeatureManagement\Requirements\DynamicConfigRequirement
|
||||
*/
|
||||
class DynamicConfigRequirementTest extends \MediaWikiUnitTestCase {
|
||||
|
||||
|
|
|
@ -18,19 +18,19 @@
|
|||
* @file
|
||||
*/
|
||||
|
||||
namespace Vector\FeatureManagement\Tests;
|
||||
namespace MediaWiki\Skins\Vector\Tests\Unit\FeatureManagement\Requirements;
|
||||
|
||||
use CentralIdLookup;
|
||||
use HashConfig;
|
||||
use MediaWiki\Skins\Vector\Constants;
|
||||
use MediaWiki\Skins\Vector\FeatureManagement\Requirements\OverridableConfigRequirement;
|
||||
use User;
|
||||
use Vector\Constants;
|
||||
use Vector\FeatureManagement\Requirements\OverridableConfigRequirement;
|
||||
use WebRequest;
|
||||
|
||||
/**
|
||||
* @group Vector
|
||||
* @group FeatureManagement
|
||||
* @coversDefaultClass \Vector\FeatureManagement\Requirements\OverridableConfigRequirement
|
||||
* @coversDefaultClass \MediaWiki\Skins\Vector\FeatureManagement\Requirements\OverridableConfigRequirement
|
||||
*/
|
||||
class OverridableConfigRequirementTest extends \MediaWikiUnitTestCase {
|
||||
|
||||
|
|
Loading…
Reference in a new issue