This is copied from Wikibase. A follow up change adds a test
for Special:BlankPage to demonstrate how it works.
Change-Id: I3c34fd17ceb0049b160ec4f821474de457533983
* Add the $wgExtendedLoginCookies configuration variable, which defines
the set of login cookies that can have their lifetime configured
independently
* Add the $wgExtendedLoginCookieExpiration configuration variable, which
dictates when the extended lifetime login cookies expire
* Default $wgExtendedLoginCookieExpiration to null so that the current
behaviour is unaffected
Bug: T68699
Change-Id: I0cc24524e4d7d9d1d21c9fa8a28c7c76b677b96c
Test the LogFormatter by passing old and new database rows to it.
The text shown on Special:Log and the api result returned by
list=logevents is tested.
Change-Id: Icfcba506f4fa3010cdaf973aa2df23b6e92c25e4
This adds supportsDirectApiEditing and
supportsDirectEditing methods to ContentHandler. Both
return false by default for the ContentHandler base
class, and true for TextContentHandler and it's
derivatives. (everything in core)
Extension content types that directly extend
AbstractContent / ContentHandler, often / generally don't
support direct editing. EntityContent in Wikibase
and Flow boards are the two such content types currently
in gerrit-hosted extensions.
The use and direct settings of the allowNonTextContent
member variable is replaced by enableApiEditOverride and
a setter for that. The only place allowNonTextContent is
used in all of Wikimedia-hosted git repos is core itself
(EditPage and ApiEditPage), so should be safe to make
this change.
With this change, Wikibase can remove its ApiCheckCanExecute
hook handler that disallows editing there, and MobileFrontend
could check if direct editing is allowed before enabling it's
editing features, instead of Wikibase having to add
MobileFrontend hook handlers to disable the features.
Bug: T96382
Change-Id: I276cd6ecedf38108f1f2be16b38e699e8c5d2d0c
Also remove some wrappers from ResourceLoaderImageModule tests that
are no longer necessary, since the files they were mocking now exist.
Bug: T86334
Change-Id: If02e58716ce8e6c8327c8939c6c6425bd48bb560
The new TestingAccessWrapper class provides a convenient way to make
all of an object's methods and properties public.
TODO: We should organize test helpers into a source directory. Note that the
helper and its test are in the same directory.
Change-Id: I958d55df18c74e9d2b25d98cd0316989a0fbbe6f
This makes it easier for subclasses to use ResourceLoaderWikiModule. Currently
many subclasses of this simply need to override the getPages() method.
UserModule and SiteModule keep their getPages override due to the set of pages
being dependent on context.
Change-Id: I388531398671afacfec36c6c5746d72267b5bdac
In most cases, we just check whether the pages exist before saying
the module is not empty to avoid generating cached HTML without
the appropriate <script> or <link> tags.
However, for modules in the 'user' group, normal users cannot
delete their personal JavaScript/CSS pages, causing needless
extra requests, even though we know the pages are empty.
ResourceLoader::isKnownEmpty() now checks the page_len field
for modules in the 'user' group to check that there is
some actual content.
Bug: 68488
Change-Id: I0570f62887fd4642fd60367ae0b51d7dc19488ca
Note that the old parser tests helper function `tidy()` never actually did
anything, since $wgUseTidy was forced to `false` in the parser test setup.
Remove this unused code, and replace it with our new tidy support.
Allows new parser test sections: 'html+tidy' denotes "tidied" HTML (open
tags closed and other fixups to original wikitext markup) which should be
applicable to any parser. 'html/php+tidy' is output specific to the PHP
parser with tidy turned on. The Parsoid backend will use the 'html/parsoid'
section if present, but if it is not present it will fallback to first the
'html+tidy' section, and if that is missing the 'html' section.
Note that 'tidy' has a large number of open bugs (see
https://bugzilla.wikimedia.org/show_bug.cgi?id=2542 ) and so in some cases
we deliberately do *not* use 'html+tidy' or 'html/php+tidy' clauses, in
order to avoid documenting broken output. In these cases, there is no
broken HTML in the PHP parser output, and so (in theory) the 'html' and
'html+tidy' sections would be identical (that is, if tidy didn't have
bugs).
Change-Id: Iba45f38774b221522dc3b6ae2d1312fb79f8f41f
Deprecated the old User::crypt, et. al password hashing
system and implemented an extensible password hashing
API.
The new Password class allows registering of child classes
and provides factory functions for creating new Password
objects. The built-in hash types are the old MediaWiki MD5
types, which are for backwards-compatibility only, and bcrypt.
Also included is support for wrapping existing hashes as well
as encrypting passwords with a configured encryption key.
Bug: 54948
Bug: 28419
Change-Id: I0a9c972931a0eff0cfb2619cef3ddffd03710285
Support for DjVu is detected and parser tests that rely on it are disabled if needed.
Introduce DjVuSupport to easily detect DjVu support in unit tests
Change-Id: I53fd7b54e765d5f349abe74481bbc6f62f2b349e
Add the LessFileCompilationTest test case class, which represents the
validation of a LESS file by compilation.
Add the LessTestSuite test suite, which tests all LESS files registered
with the ResourceLoader, and use this to rewrite the checkLess.php
maintenance script.
Bug: 54665
Change-Id: Iedb8dc31e4817d8b4e40b655cf9b8fb092979e90
ApiQueryBase::titlePartToKey now allows an extra parameter that
indicates the namespace in order to properly capitalize the title part.
This allows list=allcategories, list=allimages, list=alllinks,
list=allpages, list=deletedrevs and list=filearchive to
handle case-sensitivity properly for all parameters.
Bug: 25702
Change-Id: Iaa5a71ec536f3716f54bc84b39f645545dfd8660
- Give methods scope
- Make providers static
- Add @covers todo
- Merge the Providers file that is only used in here
Change-Id: I60a6bbd5a8ad3d9d414de493ec2b083f52114a7b
This adds a listener to the PHPUnit test runner that will report
testing progress via wfDebugLog. This is useful for debugging
situations in which phpunit itself fails to report errors and
does not terminate normally. Having a debug log should at least
help with locating the trigger of the problem.
Change-Id: I433537a7f26197d8cff6f133e26ae5709871500f
Parser tests are registeredd by appending one or more .txt files to the
$wgParserTestFiles global setting. Since this is shared with MediaWiki
core, I have made MediaWikiParserTest a factory of PHPUnit testsuite
which would filter in/out extensions tests.
The `extensions` test suite now has a second test suite builder which is
simply a wrapper around MediaWikiParserTest factory.
Play cases:
$ php phpunit.php --group Parser --tap
Runs any parser tests including the ones coming from extensions.
With an extension having parser tests such as Cite:
$ php phpunit.php --testsuite extensions --tap
// Extensions tests are run including parser tests.
bug: 42506
Change-Id: Icc3e9d30706b32149aa9dd18552e4241ec4af67e
This never really worked properly, doesn't conform to coding
conventions, and isn't actually used by anyone for testing.
Our selenium stuff these days are in the qa/browsertests repo
Change-Id: I8f1efaa118fe41821fb3f4a6099d75a33681f17b
See bug for context.
The implementation is slightly untidy because I've written it so
as to avoid invalidating the existing SVG thumbs -- there will be
no immediate difference (visual/performance/other) as a result of
this.
Tested by me in both...
* [[File:Example.svg|thumb|lang=fr]] AND
* http://example.org/w/index.php?title=File:Example.svg&lang=fr
...modes. Example file on
https://commons.wikimedia.org/wiki/File:Gerrit_patchset_25838_test.svg
Added parser tests.
Bug: 32987
Change-Id: I4cadf96ecd5e169a88ad468a0478d355db980103
Jenkins does not run the autoloader test (will be fixed in a different
commit). This patch fix the main and test autoloader to add in all the
missing entries.
bug: 47750
Change-Id: I285fa7ed24a6fc45a4dc475b54d80cf3816436fb
I eventually got tired of our parser tests creating and deleting fixture
files over and over. This patch mock the files in memory and just
expose the file metadata which is all we need for parser tests.
The mocked classes are under /tests/phpunit/mocks/ and respect the
hierarchy of /includes/.
The wiki.png and headbg.jpg files are still copied on each test :/
Change-Id: Iccdff67222e66d48d01dd1596d09df2ea24b8c2a
Created a DatabaseTestHelper class, which extends DatabaseBase and
implements STUBs for the interface methods and abstract methods
Change-Id: I9965b3604e78b2722077a35a7b4ce62a5bcb370e
This patch introduce the new ParserTestResult class which is meant to
represent the result of a parser test. I have refactored some methods
to take advantage of this new class.
It just hold the test description and the actual/expected parser output.
A short isSuccess() method is provided for convenience, we can later
improve the class to carry more methods.
Change-Id: Ifb86e09451875dc119633b52d3f7e4f47c67cc60
By PSR2 PHP Standard, the files should ends with exactly one newline.
Some of our files have 2 or more and some other were missing a newline.
Fix almost all occurences of CodeSniffer sniff:
PSR2.Files.EndFileNewline.TooMany
I have not fixed the selenium files, I believe we will drop them.
Change-Id: I89fca8c1786fee94855b7b77bb0f364001ee84b6
Since 7c6c05a, the ORMTableTest and SeleniumTestConstants classes points
to a wrong path. The reason is the variable name has not been renamed
for them.
Change-Id: I430031d0d00a8f0da047184285d1797a145bd389
* Move scattered pieces from tests/* in main AutoLoader.php
into tests/TestsAutoLoader.php.
Verified with:
'ack -Q i --ignore-dir tests/phpunit/ <classname>'
on mediawiki/core that these classes are not used outside
tests/phpunit/.
* Moved entry for maintenance/backup.inc to the main AutoLoader.
* Refactored assertion logic in maintenance/checkAutoLoader.php
into a public static method used in it's execute method
and in the (new) AutoLoaderTest suite.
* The new test was immediately failing, added missing classes
and removed old ones that don't exist.
And CheckAutoLoader itself, so that it can actually be used
in AutoLoaderTest.php
* Per discussion on Gerrit, moved the logic into the unit test
instead of refactoring the maintenance script, we no longer
need the maintenance script.
* Fixed the regex to also detect abstract, final and interface.
The test was failing badly, claiming many classes did not
exist.
* Improved the logic to also catch entries in the AutoLoader
configuration for inexisting classes in existing files.
So far it only catched entries with wrong files and missing
entries for classes in known files.
An entry like "BlablaSomethingHere => includes/Action.php"
did not emit any kind of warning. The refactored logic
builds a reverse index and uses a simple assertEquals to
find any inconsistencies (whatever the cause).
Change-Id: I0a307f23175d52345180cdfc7c2d5e172536be1b
- this is more generally useful than to be buried inside Wikibase client.
- it was in Wikibase/client/tests/phpunit/includes/store/EntityCacheTableTest.php
- patchset 2: add to test autoloader
Change-Id: I5bc41d6d205f28bcc5bf0c8a78b782c8888c18eb
The language classes have been using the same setUp() tearDown() to
craft a new language object. I have abstracted that code in
LanguageClassesTestCase and made all the language test classes to extend
it. The language is interpolated directly from the class name and an
object for it can be retrieved with the getLang() method.
Change-Id: Ib931336ce219edabe2c72b7e9f04c976a500723e