Commit graph

9 commits

Author SHA1 Message Date
Alexander Vorwerk
9b09bf3112 Use updated ObjectFactory namespace
Depends-On: I99c5e5664d2401c36a9890f148eba7c25e6e8324
Depends-On: I48ab818b2965da14af15ef370aa83ad9455badd9
Depends-On: I018371e4b77911e56152ca7b2df734afc73f58a5
Change-Id: I04ebdb52102f6191d49a9cc70b1f98308299e72f
2022-03-09 23:04:51 +00:00
Ammar Abdulhamid
5dafaf9028 Remove usages of Skin::getAllowedSkins.
* Move the method to SkinFactory and replaces usages.
* Inject $wgSkipSkins into the SkinFactory

Bug: T257993
Change-Id: I9869cf34c5e87cbad963f48db0649b3b7a252a4a
2020-08-05 02:48:29 +01:00
mainframe98
2619b261bb Support the creation of Skins with services injected
The old way of providing a callable to SkinFactory::register is
still supported. Those callables expected the skin name as their
first argument. Coincidentally, so does the constructor of Skin.
Some skins might not define any constructor parameters at all,
which is acceptable to PHP, as it will just discard the argument.

The registration using $wgValidSkinNames has not been changed,
and skins that want to define services to be injected will still
need to manually register their skin to the skin factory.

CodeSearch did not indicate any extensions or skins manually
constructing a SkinFactory in tests, but for posterity, the old
way of creating a SkinFactory for testing can be replaced with
  new SkinFactory( new ObjectFactory(
  	$this->createMock( ContainerInterface::class )
  ) );

Note that the constructor for SkinFactory for internal use only,
in accordance with the Stable interface policy.
You should use MediaWikiServices::getInstance()->getSkinFactory
instead.

Bug: T244466
Change-Id: I8ba9d869bddd9b6124e47697b789d752c0620b02
2020-03-16 23:25:42 +00:00
Kunal Mehta
2de2e056a8 Use ExtensionRegistry::setAttributeForTest() instead of Reflection
Change-Id: If29e8825f1734f8c0efa21aa77f6354fa3468248
2019-06-02 21:08:07 -04:00
Kunal Mehta
01541db36b Remove usage of deprecated SkinFactory::getDefaultInstance()
Change-Id: I3bd50f8ca5baabd34dbc0e3bbc2f97e94650a17a
2019-06-02 21:08:07 -04:00
Timo Tijhof
b54a1e709e resourceloader: Use 'fallback' as default for ResourceLoaderTestCase
Follows-up fa05976f5f. This broke the Travis CI tests because
the Vector skin is not installed there (unlike in Wikimedia CI).

Make the test no longer reliant on that detail.

* Fix ResourceLoaderTestCase to use a default that actually
  works in plain core (previously 'vector' would be rejected
  as being an unknown skin, but then be re-normalised back to
  'vector' thanks to wgDefaultSkin. This was fixed in fa05976f5f,
  and the unknown skin now produces 'fallback' which is better.

* Update ResourceLoaderOOUIImageModuleTest to match this
  new default and also fix the test message while at it
  to mention 'skin', not 'image'.

Change-Id: I5fb69a6a38a42b1a5f325c0134e01ad880f65087
2019-04-15 20:21:00 +01: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
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
Bartosz Dziewoński
b6a238e6bf resourceloader: Add unit tests for ResourceLoaderImage
Follows-up I5b14d65a and I5a563c59.

Change-Id: Id42e1b868c9fe97cdb14b4bc7328947820a7fd94
2017-04-11 21:55:59 +00:00