Uusally, phpunit issues a warning and continues to generate the
report but in this case it caused an early exit with no output.
Follows-up 3706dcb5c.
> Trying to @cover not existing method Status::getErrorsOnlyStatus.
Also:
* Increase coverage by adding @covers where missing.
* Use setOK() internally.
* Add test for 'ok' setter.
Change-Id: If6db634079c857f02b2594be199e6910ec49a52a
This commit changes the way how HTMLForm handles a Status object
when executed from a request. It now handles, beside the errors,
also the warnings of a Status object and prints them out, wrapped
in a warning box.
The LoginSignupPage uses this feature to show informative warnings
actually as warnings and not as more disturbing error messages.
Error messages should be reserved for errors and only for erros. An
AuthenticationProvider, which returns an UI AuthenticationResponse
can choose, if the given message is an error or a warning message.
This commit also addds a new function to Status, which allows a
developer to split the object into two new Status objects, where one only
contains the errors and the other only the warnings of the origin
Status object (splitByErrorType). StatusValue also has a new function,
splitByErrorType(), to support this.
Bug: T139179
Change-Id: I9a27911613e62b5c4cb86bea40696cb37c4f49c2
If you have a non-existent message in the output, chances are its
user-controlled. If the message has the ->plain() or ->text()
format, the output used to be not safe for html. Obviously people
should not be using those format types where html is being outputted,
but sometimes that happens. I think we should prioritize always being
safe over the fallback content not potentially being double escaped.
Additionally switch the enclosing brackets to be fancy unicode
characters, to sidestep the escaping issue on the enclosing brackets.
So previously, wfMessage( 'script>alert(1)</script' )->text() would
have outputted <script>alert(1)</script>. Now it outputs
⧼script>alert(1)</script⧽. No sane message key will include
< or >, so this would really only come up if the user can control
the message key name.
This goes somewhat against T68199.
Change-Id: Ic8a60892b8e847e6021494c10968814aac391731
This also corrects a bug in MessageCache::parse() where it takes a
language code string but the Parser expects a Language object in
ParserOptions.
Bug: T128809
Change-Id: I3508c9e515e505890b3c62bc4a0982aa2a313782
RawMessage::__construct() takes a single array of params, it's not
varargs-style like wfMessage().
Change-Id: I63950ee16e359aa2627228350e27d9e94bb6e8ce
__get called a non-existant function which caused errors
in file deletion.
Also adds tests for $status->ok and $status->errors
Change-Id: I8f5a21eb8d795e5e3f5a58f2384ad0dcbad749a2
MediaWiki default is "@return type Description", so set a type after
return and start the description with a capital letter. Also use the
more common spelling of boolean.
See http://phpdoc.org/docs/latest/references/phpdoc/tags/return.html for
more about @return
Change-Id: I4e5198822fe92836f9cef9918a9fc1a1a1e0a043
- Swap "$variable type" to "type $variable"
- Fixed spacing inside docs
- Makes beginning of @param/@var/@throws in capital
- Changed some types to match the more common spelling
Change-Id: Ia041964250d8b7c0349d79dc9b131c5b8696e795
- Removed spaces after not operator (!)
- Removed spaces inside array index
- use tab as indent instead of spaces
- Add newline at end of file
- Removed spaces after casts
Change-Id: I9ba17c4385fcb43d38998d45f89cf42952bc791b
- use tab as indent instead of spaces
- Added space after closures "function"
- Added spaces around string_concat
- Added newline inside empty blocks
- Removed four spaces after comma
Change-Id: I4425b0c6a69b36f40acfea6511b8950cf09ce2b2
This improves on commit 34bd573144 by matching
Parsoid's newline handling in the PHP parser. It is the outcome of a
discussion with Erwin, where we agreed that
* foo
* bar
should produce
<ul><li>foo</li>
<li>bar</li></ul>
See the discussion in https://gerrit.wikimedia.org/r/#/c/94443/
The original rendering issue this tried to address is no longer present after
a change to the template. The pure CSS solution is now working.
Bug: 39617
Bug: 56809
Change-Id: Ib7aa9449bbd994cb23b83b3f23cff944b1cddadf
- Added spaces after if/foreach/catch
- Added new line before end of file
- Added or removed spaces before/after parenthesis, comma
- Added spaces around string concat
Change-Id: I0590070f1b3542108e242730e8d9a3ba9831e94f
This mistake was introduced in commit
92e284d3fa and the reason for the two
disabled tests. I did not enabled the second test because of an
unrelated problem. The first enabled test already covers the fix.
The method should return Message objects only but did return a
string in that special case (multiple warnings set but no context
message key).
Unfortunatelly Status::getMessage does have many, many more
problems but I understand it's not a good idea to address them all
in a single confusing patch.
Change-Id: I0dc37e248f407019d5921aaaca3eabba338b0fd3
Looking at the getMessage function the long and
short contexts should be strings not bools.
I was misslead by the defaults thus these tests
aren't actually testing much and should be removed
to avoid misslead more people!
This reverts commit cd9711ea35.
Change-Id: I889d42f720bf678a3543860893d0fedfca757dce
Currently it only returns wikitext with templates expanded (like
Message's text() method).
Bug: 45844
Change-Id: I24b5b098f15d0a4194817f31f63e37be1179aae6
- Place commas correct
- Moved comments
- Add space after if/foreach/catch
- Reformat some conditions
- Removed trailing spaces/tabs
Change-Id: I40ccda72c418c4a33fcd675773cb08d971510cdb
- Removed double spaces
- Added space after if/switch/foreach
- Removed space on elseif
- Added space around parentheses
- Added newline at end of file
- Removed space before semicolon at end of line
Change-Id: Id40b87e04786c6111e6686d7f7eea1e588bdf37d
When writing these I came accross a case that doesnt
quite seem right (I have left room for the test case
with a comment explaining)
Status now only has 4 untested methods
Change-Id: I61acf141de9f786793e8413d2d2ebb95e27e004d
Adds unit tests for some of the more basic
parts of the Status class
has todos at the bottom of the file for all other
methods that need to be tested
Change-Id: Ic2f2abafb44ef86af207c7595e440672dfcf4f1e