Commit graph

20 commits

Author SHA1 Message Date
libraryupgrader
5357695270 build: Updating dependencies
composer:
* mediawiki/mediawiki-codesniffer: 36.0.0 → 37.0.0
  The following sniffs now pass and were enabled:
  * Generic.ControlStructures.InlineControlStructure
  * MediaWiki.PHPUnit.AssertCount.NotUsed

npm:
* svgo: 2.3.0 → 2.3.1
  * https://npmjs.com/advisories/1754 (CVE-2021-33587)

Change-Id: I2a9bbee2fecbf7259876d335f565ece4b3622426
2021-07-22 03:36:05 +00:00
Umherirrender
7691dbeca9 Add missing @param and @return to documentation in tests
Change-Id: Ic663e81cca0bf007804a70772250914a85f1fef4
2021-01-22 19:57:25 +01:00
Timo Tijhof
91c73f6bac resourceloader: Add some typehints and misc clean up
* Add a void return hint to methods that are not meant to return
  anything. This helps catch accidental return statements in the
  future, lets Phan better understand how methods are meant to be
  used, and might also allow PHP to better optimise the compiled
  code form (speculation).

  I did not, however, add it to publicly extended methods as that
  might mess with strict mode.

* Remove the internal getResourceLoader() method from MessageBlobStore.
  This has been redundant since 3edaa0b37c.
  The method was protected, and not considered stable to subclass
  for extensions. Hence not a breaking change.

* Add Throwable typehint to formatException() and friends.
  This is the narrowest one I could add given that the methods
  called from here already enforce the same typehint.
  Update the doc to match for now. There isn't a reason right now
  to limit this only to Exception, and given this is the method
  and not the catch statement itself, does not change behaviour.

* Remove unused ResourceLoader->getHookContainer().
  Added within 1.35 cycle, safe to remove.

* Remove unexpected `@since` for `@internal` getHookRunner().

* Remove redundant `@internal` from ResourceLoaderMwUrlModule
  methods, which itself is already `@internal`.

Change-Id: I68d33ff6feca7ef95282a7ff03eb9332adfde31c
2020-07-02 03:05:59 +01:00
Timo Tijhof
d85ea2b030 resourceloader: Convert ImageModule test to stricter unit test
Bug: T233343
Change-Id: I1f9d0b6b735c9192bb32baf249eefea76c65929e
2019-09-24 23:17:31 +00:00
Bartosz Dziewoński
77f4bab8b7 Allow skins/extensions to define custom OOUI themes
This change follows I39cc2a735d9625c87bf4ede6f5fb0ec441d47dcc.

docs/extension.schema.v1.json
docs/extension.schema.v2.json
includes/registration/ExtensionProcessor.php
* The new extension attribute 'OOUIThemePaths' can be used to define
  custom OOUI themes. See I9187a63e509b601b8558ea82850fa828e5c8cc0a
  for an example usage.

includes/resourceloader/ResourceLoaderOOUIModule.php
* Add support for 'OOUIThemePaths'.
* Defining 'images' is now optional. I figure custom themes are
  unlikely to have or need them.
* Use ResourceLoaderFilePath objects to allow skin-/extension-defined
  OOUI module files to use skin/extension's base paths.
  This was previously used to support $wgResourceModuleSkinStyles,
  but only for 'skinStyles' - now ResourceLoaderFileModule needs
  to also handle it for 'skinScripts', and ResourceLoaderImageModule
  for 'images').

includes/resourceloader/ResourceLoaderFilePath.php
* Add getters for local/remote base paths, for when we need to
  construct a new ResourceLoaderFilePath based on existing one.

includes/resourceloader/ResourceLoaderFileModule.php
includes/resourceloader/ResourceLoaderImageModule.php
includes/resourceloader/ResourceLoaderOOUIImageModule.php
* Add or improve handling of ResourceLoaderFilePaths:
  * Replace `(array)` casts with explicit array wrapping, to avoid
    casting objects into associative arrays.
  * Use getLocalPath() instead of string concatenation.

tests/phpunit/includes/resourceloader/ResourceLoaderFileModuleTest.php
tests/phpunit/includes/resourceloader/ResourceLoaderImageModuleTest.php
* Some basic checks for the above.

Bug: T100896
Change-Id: I74362f0fc215b26f1f104ce7bdbbac1e106736ad
2019-07-10 22:08:14 +02:00
Umherirrender
45da581551 Use ::class to resolve class names in tests
This helps to find renamed or misspelled classes earlier.
Phan will check the class names

Change-Id: Ie541a7baae10ab6f5c13f95ac2ff6598b8f8950c
2018-01-26 22:49:13 +01:00
James D. Forrester
1a4ebad8b7 Increase Opera minimum for Grades A and C to 15
This drops into Grade X the Opera versions 12.10+ from Grade A,
and versions 10.x from Grade C.

Bug: T121517
Change-Id: Ie4df9c751bd0250581cd2e25cf1b38e69e67e82f
2017-11-29 02:40:27 +00:00
Bartosz Dziewoński
efd707de37 Rename all files used in ResourceLoaderImageModule tests to fake names
Using names that match real OOjs UI icons is confusing when trying to
find usages of the real icons and when debugging the tests.

Bug: T166730
Change-Id: Ibb97c0347476efc95f1a50c97822d7dab19737f2
2017-06-06 13:17:29 +00:00
Gergő Tisza
525bfbc8df Switch to librarized version of TestingAccessWrapper
Replaces \TestingAccessWrapper (defined in core) with
\Wikimedia\TestingAccessWrapper (defined in the composer package
wikimedia/testing-access-wrapper).

See https://gerrit.wikimedia.org/r/#/q/topic:librarize-testing-access-wrapper
for downstream patches.

The core version of the class is kept around for a while to avoid
circular dependency problems.

Bug: T163434
Change-Id: I52cc257e593da3d6c3b01a909e554a950225aec8
2017-04-20 14:15:57 +00:00
Timo Tijhof
e65ade7844 resourceloader: Fix broken @coverage for ImageModuleTest
Follows-up f4329ddbc8.

Change-Id: I7e1761295328af7ead42da4b722a2275b5c1ddb9
2017-03-18 01:28:37 +00:00
WMDE-Fisch
f4329ddbc8 resourceloader: Use SVG url when ResourceLoaderImageModule can't embed
When the SVG is too big to be embeded it is now included via URL.
Previously it would produce an empty/broken 'url()' value.

Bug: T160532
Change-Id: I158781f9430cfa35737397ac7537a471634c4480
2017-03-16 22:11:11 +00:00
Timo Tijhof
c4e5cc2957 resourceloader: Create unit tests for ResourceLoaderContext
* Fix up one last use of global config vars in this class.
  Other places in this class already used $rl->getConfig().
  This way we don't inherit all of MediaWikiTestCase.

* Add unit tests covering all of ResourceLoaderContext
  except expandModuleNames and getImageObj (tested in better
  places already with the right @covers).

* Increase coverage for expandModuleNames(), add missing case
  of when modules are not in alphabetical order.

Change-Id: Id19b084d37a6c3a77b36e03509adffb6b156fee1
2016-08-29 16:47:15 -07:00
Kunal Mehta
6e9b4f0e9c Convert all array() syntax to []
Per wikitech-l consensus:
 https://lists.wikimedia.org/pipermail/wikitech-l/2016-February/084821.html

Notes:
* Disabled CallTimePassByReference due to false positives (T127163)

Change-Id: I2c8ce713ce6600a0bb7bf67537c87044c7a45c4b
2016-02-17 01:33:00 -08:00
Reedy
58f0a7ee4e Wrap some long strings in tests/
Change-Id: I89d53c5051e5ee4bd8624df8ee2b25993090a7df
2015-09-26 21:01:59 +01:00
Bartosz Dziewoński
a3e6df1690 ResourceLoaderImage: Allow shorthand syntax
array( "en,de,fr" => "foo.svg" ) now means the same as
array( "en" => "foo.svg", "de" => "foo.svg", "fr" => "foo.svg" ).

Bug: T76539
Change-Id: I0bf82e06be3c5f94b6ac88bbc0437b5229ceb284
2015-04-02 21:27:06 +02:00
Bartosz Dziewoński
d469b37955 ResourceLoaderImage: Add basic tests
Also remove some wrappers from ResourceLoaderImageModule tests that
are no longer necessary, since the files they were mocking now exist.

Bug: T86334
Change-Id: If02e58716ce8e6c8327c8939c6c6425bd48bb560
2015-03-30 19:15:35 +02:00
Bartosz Dziewoński
fca3887393 ResourceLoaderImageModule: Rename 'image' in descriptors to 'file'
Like in OOjs UI. Less confusing. No one is using this yet.

Bug: T93669
Change-Id: Ib1c9af96b46ba660b3697d272129e071da1fdf18
2015-03-29 19:38:14 +02:00
Bartosz Dziewoński
8c9ff9c46c ResourceLoaderImageModule: Remove 'type' stuff
Provides no value and makes the definitions uglier. Also, the
implementation sucks.

This is a breaking change, but ResourceLoaderImageModule was not in
any public release yet.

Submitted patches to fix two usages in extensions:
* Gather: I371209afe7b48e7c215ea9912826d4eb2cacf4e5
* MobileFrontend: I1963f5fe759c3a031220157d3a6f0f3b42bc5426

Bug: T94073
Change-Id: I36cfdb09bb203b8d9958e6016447e446dd6ff78b
2015-03-29 19:37:11 +02:00
Bartosz Dziewoński
8edbfb5feb ResourceLoaderImageModule: Implement CSS selector templates
Instead of a 'prefix', a 'selector' can be specified, with a string
containing a simple template to use for CSS selector. For example:

    'selector' => '.mw-ui-icon-{name}'

'prefix' continues to work as before.

When using variants, one might want to provide separate
'selectorWithoutVariant' and 'selectorWithVariant' options.

Available variables are {prefix}, {type}, {name}, and {variant}.

Bug: T78215
Change-Id: I99ccaf25e8d24fed5afd0c4b770d2f389789ce4b
2015-03-29 17:25:02 +00:00
Bartosz Dziewoński
5ed35b04c9 ResourceLoaderImageModule: Add basic tests
Bug: T86334
Change-Id: Ie98bf5dec2d4d4c309ed5075b3191da3017f5ad4
2015-03-29 18:29:51 +02:00