| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
|
|
|
| |
It has been deprecated in favor UrlUtils::assemble() since 1.39.
Depends-On: If1a6251b7ea31f7eed217500fdac74637508d683
Change-Id: I4cc95e03dc0bdc0912b41f7598058ab8219cdca5
|
|
|
|
|
|
|
| |
It didn't have any use outside the core so went for the removal
instead of raising warning and hard deprecation.
Change-Id: I08dab348a89f1fe1adccfad4f003d9fb8b233f0d
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
In 279fd16bab170eba95158a7cf438cfac17ff37b5, I made what I thought
was a trivial change to UserAuthorityTest:
(diff slightly modified here for clarity)
- $message = $permissionStatus->getErrors()[2]['message'];
+ $message = $permissionStatus->getMessages()[2];
$this->assertArrayEquals(
$this->getFakeBlockMessageParams(),
$message->getParams()
);
And in 3d92cb2f824b333eef876211ad257478d1e8aa21, I made what I thought
was also a trivial change to UserAuthority:
(diff slightly modified here for clarity, likewise)
- foreach ( $errors as $err ) {
- $status->fatal( wfMessage( ...$err ) );
- }
+ $status->merge( $tempStatus );
However, it turns out these two pieces of code had vital roles:
* The code in UserAuthority ensured that the final status contains
Message objects instead of key strings + parameter arrays, and thus
does not trigger wikitext escaping in a legacy code path (T368821).
* The code in UserAuthorityTest accessed the internals of the same
status with (now deprecated) getErrors() to check that it indeed
contained a Message object, rather then a key string, which would
cause a test failure due to a fatal error in the code below.
getMessages() returns objects regardless of what's inside the
status, so the test never fails.
Thus I managed to disarm the regression test, and then cause exactly
the regression it was supposed to prevent: block error messages on
Special:CreateAccount have parameters shown as wikitext (T306494).
Restore a foreach loop instead of `$status->merge()` to fix that, and
document why it is there. Change the test so that it actually runs
the code whose behavior it wants to verify, instead of a related but
different method, hopefully making it more resilient against future
developers.
(I found the bug because the test started failing with the refactoring
I'm trying to do in I625a48a6ecd3fad5c2ed76b23343a0fef91e1b83.)
Bug: T306494
Change-Id: I7601fc51702cb33ef9d2b341ea555dc230d31537
|
|
|
|
|
|
|
|
| |
wfEscapeWikiText() has accidentally supported `null` and `false` as
input before, and now we should stay compatible with that.
Bug: T357032
Change-Id: I966e4c091dcd3234936f3a232ae0a629852051e4
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The result of wfEscapeWikiText() did not consider inclusion of a string
within table context, and so `!!` and `!` at start of line were not
previously escaped.
Additionally, if you are inserting the result of wfEscapeWikiText()
into a wikitext string, the result can inadventently form new tokens
at the left and right edges. For example:
{|
|<escaped string>
When the escaped string starts with a `-` or `+` it forms the `|-` or `|+`
token and changes the parse.
On the right side:
<escaped string>_FORCETOC__
is not a magic word unless the escaped string ends with a `_`.
Token-gluing can also occur with the double newline token denoting
a paragraph separator.
This patch adds additional cases to wfEscapeWikiText to armor
its output against all contexts in which the output may be
inserted.
Depends-On: I56147520620d56a4b98c2f22d1f469b49aed761f
Change-Id: I34f2fa8c329e6f6771453b2f94dc4afbec31dac8
|
|
|
|
|
|
|
|
| |
PHPUnit wants the filenames of the tests to match the class name being
tested.
Bug: T337333
Change-Id: Icc450c900b6d4589515d86889403043a5e4ef690
|
|
|
|
|
|
|
| |
Use SPL exceptions instead when the exception is unchecked.
Bug: T328220
Change-Id: Ia1e5edc2ef3269a44b670262b78b305d07559829
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
And also assertNotRegExp -> assertDoesNotMatchRegularExpression. The
methods were renamed in PHPUnit 9.
Done automatically with:
grep -rl assertRegExp tests/ | xargs sed -r -i "s/>assertRegExp\(/>assertMatchesRegularExpression\(/"
grep -rl assertNotRegExp tests/ | xargs sed -r -i "s/>assertNotRegExp\(/>assertDoesNotMatchRegularExpression\(/"
Split out from Ifdba0f9e98eb6bce4590b7eb73170c51a697d7c6 so that it
remains smaller and easier to review.
Also make a test use MediaWikiUnitTestCase (it's already in the unit/
dir) so that it can access the forward-compat method.
Bug: T243600
Change-Id: Ifa279d5f201d7abeebece292141ebface8278046
|
|
|
|
|
|
|
|
|
|
|
|
| |
Clarify docs and reasoning in the tests.
Add some line breaks.
Consistent comment formatting.
Add "NOTE" in both directions.
This is in prep for an implementation change to the JS version, to
detect/prevent regressions.
Change-Id: Iaae47c040e13dcb55b141e5bc8304e8d140ce04f
|
|
|
|
|
|
|
|
|
|
|
|
| |
phpunit --filter UrlUtilsTest would execute no tests because the class
was already loaded by the GlobalFunctions data providers via the
autoloader, so PHPUnit sees no additional classes when it examines
UrlUtilsTest.php.
So, split out all providers in UrlUtilsTest to a separate class which
can be safely autoloaded.
Change-Id: I483736ee70e598cdb19f8203bc6885f1c234fc42
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The new class, UrlUtils, is usable standalone or as a service. Using it
as a service will just automatically load a few settings from site
configuration.
In addition to just making our code cleaner, this will enable making
some of Setup.php's dynamic configuration more sane.
Test coverage is all lines except invalid URLs -- I couldn't find any.
Bug: T305093
Change-Id: I706ef8a50aafb518e13222719575d274c3583b90
|
|
|
|
| |
Change-Id: Ic663e81cca0bf007804a70772250914a85f1fef4
|
|
|
|
|
|
|
| |
Follows-up Ief9c15cc8fe0fcae07d2c.
Bug: T268852
Change-Id: I5ddac943aad4d634ea20cd4d4cb21d1c857c05fd
|
|
|
|
|
|
|
|
|
|
| |
parse_url() on PHP >= 8 will include an empty 'query' bit for input URLs that
end in '?' and have no query string, such as 'http://www.example.com/foo?'.
This causes the parser test for T4372 to break. Accordingly, fix wfAssembleUrl()
to not generate a query string if the input query field is empty.
Bug: T268852
Change-Id: Ief9c15cc8fe0fcae07d2cc3120db9ca95573324c
|
|
|
|
|
|
|
| |
Originally an autofix of PHPUnitAssertEquals sniff, but manually
updated.
Change-Id: I78efc6f7997f0b7227b40d7eab1495cc7a1d7da5
|
|
|
|
|
|
|
| |
Add public, protected or private to function missing a visibility
Enable the tests folder for the phpcs sniff
Change-Id: Ibefce76ea9984c47e08c94889ea2eafca7565e2c
|
|
|
|
|
|
|
| |
That mostly enables testing global functions
Bug: T87781
Change-Id: Ib42c56a67926ebcdba53f4c6c54a5bff98cb77a3
|
|
|
|
|
|
|
|
| |
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
|