Commit graph

11 commits

Author SHA1 Message Date
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
addshore
60eaec2cc3 Tests for TitleValue::__toString
Change-Id: Ibb157b8e6e4fdc75bdb27ecaa4a552304465c4b2
2017-11-20 09:39:55 +00:00
Kunal Mehta
ab623befc5 Add LinkTarget::inNamespace() helper function
And implementation for TitleValue, plus tests

Change-Id: I42c301e28938dcd55580e20b7c1ddefcbf5a2bef
2016-05-12 08:28:26 +00:00
Kunal Mehta
9b1f8b4ca3 Add interwiki support to LinkTarget and TitleValue
This adds support to the LinkTarget interface and TitleValue
implementation for having an interwiki component, matching the function
names used in Title.

MediaWikiTitleCodec was updated accordingly.

The motivation behind this change is to be able to fully use LinkTarget
in the Linker rewrite instead of depending upon Title.

Change-Id: I6666b64f0e336aadc7261e7ca87ac2e498c61856
2016-04-26 22:25:28 -07:00
Kunal Mehta
59d838caea Add LinkTarget::createFragmentTarget() function
The createFragmentTarget function allows for switching the fragment on a
target in an easier way. TitleValue already had a now-renamed
createFragmentTitle function (no uses outside of tests), and an
implementation was added for Title.

This will also help with reducing the amount of public usage of
Title::setFragment(), which is deprecated.

Change-Id: I1e8ba2f85e748b1b4394fb2f2a1ccce69cf6e3c5
2016-04-21 17:19:04 -07:00
Kunal Mehta
55ec9f2e4d Add LinkTarget::hasFragment() helper function
LinkTarget::hasFragment() is a helper function which returns a boolean
of whether the target has a fragment. Title already had such a function,
and one was added to TitleValue.

Co-Authored-By: addshore <addshorewiki@gmail.com>
Change-Id: I49e607ae5a58c3aef96d0246297740e7d88ac816
2016-04-20 15:51:39 -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
Timo Tijhof
b4bac102b6 tests: Clean up file headers
* Remove redundant @licence/@license from test suite files.
  They already have full licence headers. And @licence raises a
  warning in Doxygen.

* Fix weird messes of comments inside comments and other things.

Change-Id: I38da8ca76330f72b8dc22b0ecf1ea69d5ea55ede
2015-04-01 00:17:12 +01:00
Aude
1b0e883698 Revert "Temporarily remove tests added in I8eef5a165"
this was to be temporary, right? we need the tests in.

If there are issues with jenkins, this is not the *best*
way to fix them.

This reverts commit 44a1968531.

Change-Id: I5dd60a9818c28155d96a6642c588781667e682c3
2014-04-06 13:18:07 +00:00
Ori Livneh
44a1968531 Temporarily remove tests added in I8eef5a165
Although the tests themselves pass, their introduction to the codebase pushed
the total number of tests past some threshold at which Jenkins starts
segfaulting. So remove the tests as a temporary workaround, and revert this
patch once the bug with Wikimedia's Jenkins deployment (bug 43972) is resolved.

Change-Id: I5722faf0e4216e1c1f98ecc1f2dba744b240b7d3
2014-03-28 13:36:26 -07:00
daniel
154bcdc63f Introducing TitleValue
TitleValue is intended to be a light weight alternative to the Title
class. Any operations on TitleValue are implemented in separate
service classes, like TitleFormatter and PageLinkRenderer. See
<https://www.mediawiki.org/wiki/Requests_for_comment/TitleValue>
for more information.

This change updates SpecialCategories and SpecialLinkSearch to use
TitleValue instead of Title, to demonstrate how TitleValue would be
used, and how the necessary services can be injected and applied.

The intention is to improve testability and reusability; these
advantages will however only become apparent with further refactoring
of the respective special pages. This will be done in follow-up
changes.

More work will be needed to migrate essential functionality from
Title and Linker classes into the respective service classes,
MediaWikiTitleCodec and MediaWikiPageLinkRenderer.

Change-Id: I8eef5a165de4ffcacfbc4911fdacdb15d502fff4
2014-03-28 18:42:17 +00:00