| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
|
|
|
|
|
| |
In MediaWiki/Exception, to follow PSR-4 per plural vs. singular (this can be
changed later if people really care). Also, move the couple of exceptions in
here that were already namespaced in the MW-top-level into the new space.
Bug: T353458
Change-Id: I12ed850ae99effb699a6d7ada173f54e72f0570e
|
|
|
|
|
|
|
|
|
|
|
| |
No longer used except by other hard-deprecated methods.
Depends-On: I392088786faa4d52b7702dcf3b4e4549865b9650
Depends-On: I4760a342e7906000485142b63c739fb802bb40ed
Depends-On: I377e30f91ae41730b14731133c763fa100fb616f
Depends-On: Ic2302366e3d63413d110657ce999952b3fa7a1f6
Depends-On: I23ce3b4d26bbe58257b449993a54c45093007a3e
Change-Id: Ibf274036a1522001144c41ebff99f544860f6408
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
It provided structured exception data in a custom machine-readable
format. Since MediaWiki 1.26, structured exception data conforming to
the PSR-3 logging standard is also available on the 'exception' log
channel, and nobody uses 'exception-json' anymore. But the fact that
it exists and logs errors by default means that it has to be disabled,
and clutters configs, for example:
https://gerrit.wikimedia.org/g/operations/mediawiki-config/+/c0e5c7f71d70de5749f6770abcbbb7e57032bd29/wmf-config/InitialiseSettings.php#2225
https://gerrit.wikimedia.org/g/mediawiki/vagrant/+/c96e609b6ff6a73a412d3fd0a4291259eee026f6/puppet/modules/role/templates/psr3/settings.php.erb#57
Historical context:
* Iacda90fb401f6a45ed1ac1a991e088: Add "exception-json" channel, 2013.
* Ia7ba355d5925a6268ffa321ffc13cc: Add "error-json" channel, 2015.
* I71499d895582bdea033a2516c902e2: Convert "exception" to PSR-3, 2015.
* I782c96dac1181d12267fa610345e87: WMF disables "exception-json", 2017.
* I7a6e6fa52a47a29ec04411a6c8b05e: Remove "error-json" channel, 2024.
The custom data format has been reused for formatting exceptions in
the REST API, so keep getStructuredExceptionData() and rescue the tests.
Bug: T193472
Change-Id: If730618e5371a467cb76db239916b6bbe42512e3
|
|
|
|
|
|
|
|
| |
Changes to the use statements and some additions
are done automatically via script
This also updates @covers tag for the namespaced classes
Change-Id: I859ba6d05018c99710b744e2becab432410d3bca
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Why:
* When code throws a UserNotLoggedIn error for a temporary account,
this takes them to Special:UserLogin and asks them to log in to
an account
* Users using temporary accounts are less likely to have a named
account, so should instead be sent to Special:CreateAccount
(as described in T358586)
* When doing this, the warning message should be customised to
talk about the user needing to create an account (and not
log in)
What:
* Update UserNotLoggedIn to redirect to Special:CreateAccount
when the user is logged in to a temporary account
** The code which constructs the exception object can override
this and force the redirect to always be to Special:UserLogin.
* When the redirect is to Special:CreateAccount, allow customising
the message shown by adding a '-for-temp-user' suffix to the
message key in UserNotLoggedIn.
** This suffix is only added if the resulting message exists,
so that code can choose whether they need a message that is
different to the one on Special:UserLogin.
* Update SpecialPage::requiredNamedUser to allow special pages to
force the redirect to always be to Special:UserLogin
** This is made use of in Special:ChangeEmail and
Special:ConfirmEmail, as these special pages only make sense
for use with an existing account.
* Update and add message keys to allow a different message for
Special:CreateAccount.
* Update and add tests for these changes.
Bug: T358586
Change-Id: Ie0dd06f51b1e2b85eef6be377f673a02732ce604
|
|
|
|
|
|
|
|
|
|
|
|
| |
Follow-up to 298ec8382b7914d128c1baaa88d011ca668e5207, which replaced
`public $errors` with `public $status`, causing T372181.
* Add a deprecated fallback getter/setter for $errors
* Make $permission private and add a deprecated getter/setter
* Make $status private
Bug: T372181
Change-Id: If44b2256289d6bde9e9abb901d9dc145555c971f
|
|
|
|
| |
Change-Id: I5493deb8b72f499ecd46b8093b5fffbb12e7c246
|
|
|
|
|
|
|
| |
I believe this makes the code less brittle, and also makes it a bit
more obvious what these strings are meant to represent.
Change-Id: Ia39b5c80af4b495931d0a68fd091b783645dd709
|
|
|
|
|
|
|
| |
Changes to the use statements done automatically via script
Addition of missing use statement done manually
Change-Id: Iae45fa269363be8ee05c598ea6926514ce817762
|
|
|
|
|
|
|
| |
Was deprecated in I66d896f6f229b90e6ba9949311b56a6b6ab3da3d.
Bug: T353444
Change-Id: I004b1b87a7ef1a908123369842792d940b7d8079
|
|
|
|
| |
Change-Id: I5629f91387f2ac453ee4341bfe4bba310bd52f03
|
|
|
|
|
| |
Bug: T353458
Change-Id: I4dbef138fd0110c14c70214282519189d70c94fb
|
|
|
|
|
|
|
|
| |
The idea is that all formatters that need the user language or
other request specific context should be instantiated by
FormatterFactory.
Change-Id: I8334cc89dcf0f293298b82e004116be50a90f0d1
|
|\ |
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
It's now deprecated to use the individual error printing functions in
MWException or to override them. Printing MWException now works the
same as any other exception, and happens in MWExceptionRenderer.
It's still allowed to override MWException::report() to replace the
entire error page, for example in ErrorPageError.
Bug: T353444
Change-Id: I66d896f6f229b90e6ba9949311b56a6b6ab3da3d
|
|/
|
|
|
|
|
| |
The parent's ErrorPageError::__construct() expects an array of
params.
Change-Id: I1a3a225df97c75fba20d8b32d5a19e974d80c7a1
|
|
|
|
|
|
| |
Follows I8bc200d678.
Change-Id: Ief9c39223425ff7f73785efcabd212942d82c0fd
|
|
|
|
|
|
|
|
|
|
|
|
| |
Replace some other global variable checks with MW_ENTRY_POINT too.
This unfortunately makes it difficult to override the result of
isCommandLine() for testing. However, the existing tests weren't
really checking anything useful, but rather just duplicated the real
code, so I won't miss them.
Bug: T313841
Change-Id: I8bc200d67877ce04f80fd587481a76c7df629d51
|
|
|
|
|
|
|
| |
Changes to the use statements done automatically via script
Addition of missing use statements and changes to docs done manually
Change-Id: Ib326ae1e5c8409a98398c721e8b8ce42c73bd012
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Why:
* Recent additions of multiple message display mean that
adding tests for UserBlockedError is useful in reviewing
the change.
* As I made these tests to review the change, they can be
added into the repo as tests to increase test coverage.
What:
* Add two integration tests for UserBlockedError. These
are integration tests because the class relies on the
global state (calling MediaWikiServices::getInstance in
all cases).
Bug: T349826
Change-Id: I9f27d792ac7faf9378278e729a8cef2ec39c2bba
|
|
|
|
|
|
|
|
|
|
| |
And namesapce them:
- StreamFile
- OutputHandler
- OutputPage
Bug: T321882
Change-Id: Iedf8d88c595e580f2d8f0734c92aa5c45618ba33
|
|
|
|
|
|
|
|
| |
Mock the relevant services that need the DB instead, when possible. When
not possible, e.g. because DB access is needed for the test to make
sense, add the test to the Database group instead.
Change-Id: Iefbfe00bedc243906c6b860572568343268646cc
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Just methods where adding "static" to the declaration was enough, I
didn't do anything with providers that used $this.
Initially by search and replace. There were many mistakes which I
found mostly by running the PHPStorm inspection which searches for
$this usage in a static method. Later I used the PHPStorm "make static"
action which avoids the more obvious mistakes.
Bug: T332865
Change-Id: I47ed6692945607dfa5c139d42edbd934fa4f3a36
|
|\ |
|
| |
| |
| |
| |
| |
| |
| |
| |
| | |
Delay the formatting of numbers/lists when the message should be shown.
That allows to use the language of the user given to the message and
avoids global state by the global variable $wgLang or it use the global
state of Message class, which needs to be fixed later.
Change-Id: I015cea3a585a647e160b94d8ef30fad5d5df6cff
|
|/
|
|
|
|
|
|
|
| |
- Declare missing properties
- Remove unused or avoid set of properties
- Add AllowDynamicProperties
Bug: T314099
Change-Id: Ie631894f2ffbb616f6dd09851405d681f3eb8fcd
|
|
|
|
|
|
|
|
|
| |
Make use of `overrideConfigValue(s)()` where needed and also
make use of MainConfigNames constants.
NOTE: group multiple calls to setMwGlobals() to one and pass
an array of values instead.
Change-Id: I3bbfd037bb3765c00c426682cce3ef5cccc1a284
|
|
|
|
|
|
|
|
|
| |
createMock() is still relatively new. This code was using more
complicated mock builders before. This was changed just recently.
createMock() is now so short, the extra helper methods don't make
the code more readable, I would argue.
Change-Id: Ia7e24827157d5f49fc7da102418c79ae33c8e053
|
|
|
|
|
|
|
|
|
|
|
| |
createMock() does the same, but is much easier to read.
A small difference is that some of the replacements made in this
patch didn't use disableOriginalConstructor() before. In case this
was relevant we should see the respective test fail. If not we can
save some CPU cycles and skip these constructors.
Change-Id: Ib98fb06e0fe753b7a53cb087a47e1159515a8ad5
|
|
|
|
| |
Change-Id: Ic1247a6719032b3a0ea1f76514edc5ffd5a7854a
|
|
|
|
|
| |
Bug: T283978
Change-Id: I49f8c7bf1162dc834a1708e2e581f6fb264bbd0a
|
|
|
|
|
|
|
|
|
|
| |
Allow callers of MWExceptionHandler::getStructuredExceptionData() and
jsonSerializeException() to explicitly control whether a backtrace is
included in the return value. This avoids the need to rely on the
LogExceptionBacktrace setting in static methods.
Bug: T294739
Change-Id: Ib941c22d6b7ec5f1b984bf5ded90652e42ad7b67
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The use of HTTP 400 dates back to T35646, which was to address
caching proxies and mobile browsers incorrectly caching bad titles
as valid content. However, this also means that caches in front of
MediaWiki, like Varnish, don't cache it either. Since we know that
these titles will always have no content, having these get cached
in Varnish is totally fine. Presumably the 404 will be enough to
tell other crawlers or scrapers that there's still no content on
these pages.
There's some room for debate on whether a HTTP 400 or 404 is more
technically correct here, but emitting a 404 seems like the more
pragmatic option.
Change-Id: I7b16f30ca6fd9a68f2a410692582692610f1f944
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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
|
|
|
|
|
|
|
| |
Single use method in both BadTitleErrorTest and ThrottledErrorTest,
merge into only place that needs it
Change-Id: I1a5c2ed2ac76ae821758d50b7d6378acb98af861
|
|\ |
|
| |
| |
| |
| |
| |
| |
| | |
Use a mock message object to avoid
integration logic
Change-Id: Id4b85c8f80b0da61beff254344b851ed8a1e8945
|
|/
|
|
|
| |
Bug: T271504
Change-Id: I74d651c43cb67e928c627cb3812c6135232c99d8
|
|
|
|
|
|
|
|
|
| |
These were left behind during the initial sprint (344481f60d9) for
UnitTestCase as it used a global variable. Since then, UnitTestCase
has gained support for resetting these automatically for simple
cases like this. No need to bring in IntegrationTestCase for it.
Change-Id: Id8717c1f4148510ae4a67aec7a2dc0d23679a5ac
|
|
|
|
|
|
|
| |
Originally an autofix of PHPUnitAssertEquals sniff, but manually
updated.
Change-Id: I78efc6f7997f0b7227b40d7eab1495cc7a1d7da5
|
|
|
|
| |
Change-Id: Ib32cc0db07636238aa0b4f8ea7f8c1ae37084889
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The name change happened some time ago, and I think its
about time to start using the name name!
(Done with a find and replace)
My personal motivation for doing this is that I have started
trying out vscode as an IDE for mediawiki development, and
right now it doesn't appear to handle php aliases very well
or at all.
Change-Id: I412235d91ae26e4c1c6a62e0dbb7e7cf3c5ed4a6
|
|
|
|
|
|
|
|
|
| |
This patch adds two more commonly used methods for params/rawParams to
getMockMessage and relocates the functionality to the MediaWikiTestCaseTrait.
Follows-Up: Ia94521b786
Change-Id: If9a6ccf1885ba11fbf3fb1b586006118462c1410
|
|
|
|
|
|
|
|
|
|
|
| |
$wgLang is usually going to be a stub, since its semi-deprecated
so more and more code-paths don't call it. I'm not exactly sure
what checking it was supposed to accomplish. Note that
MWExceptionRenderer has very similar logic that does not check
$wgLang
Bug: T246619
Change-Id: I101a60b6fb3bc2c1abfa16fd1784caab3f75a95b
|
|
|
|
|
|
|
|
| |
This patch fixes all PHPUnit 8 compat issues in the DBless suite, aside
from assertArraySubset.
Bug: T192167
Change-Id: Iea782386509b9e579f06d63687669e14bc437fad
|
|
|
|
|
| |
Bug: T192167
Change-Id: I3b8176745f49b1d4bfe6f36978b7879d546f68a9
|
|
|
|
|
|
| |
MediaWiki.Commenting.PhpunitAnnotations.ForbiddenExpectedException* and make pass
Change-Id: I63f97497714a32236268be6965c5e181dade6c58
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This changeset resumes work on T89432 and related tickets
by porting an initial set of tests to the new unit test suite
separated out in I69b92db3e70093570e05cc0a64c7780a278b321a.
The tests were only ported if they worked immediately without
requiring any changes other than changing the test case class
to MediaWikiUnitTestCase and moving the test to the new suite.
If a test failed for any reason (even trivial misconfiguration),
it was NOT ported.
With this change, the unit tests suite now consits of a total
of 455 tests. As before, you can run these tests via the following
command:
$ composer phpunit:unit
Bug: T84948
Bug: T89432
Bug: T87781
Change-Id: Ibb8175981092d7f41864e641cc3c118af70a5c76
|
|
|
|
|
|
|
|
| |
This reverts commit 0a2b996278e57a8b8c5377cd3a3eaa54f993d4a9.
Reason for revert: Broke postgres tests.
Change-Id: I27d8e0c807ad5f0748b9611a4f3df84cc213fbe1
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This changeset implements T89432 and related tickets and is based on exploration
done at the Prague Hackathon. The goal is to identify tests in MediaWiki core
that can be run without having to install & configure MediaWiki and its dependencies,
and provide a way to execute these tests via the standard phpunit entry point,
allowing for faster development and integration with existing tooling like IDEs.
The initial set of tests that met these criteria were identified using the work Amir did in
I88822667693d9e00ac3d4639c87bc24e5083e5e8. These tests were then moved into a new subdirectory
under phpunit/ and organized into a separate test suite. The environment for this suite
is set up via a PHPUnit bootstrap file without a custom entry point.
You can execute these tests by running:
$ vendor/bin/phpunit -d memory_limit=512M -c tests/phpunit/unit-tests.xml
Bug: T89432
Bug: T87781
Bug: T84948
Change-Id: Iad01033a0548afd4d2a6f2c1ef6fcc9debf72c0d
|