Commit graph

338 commits

Author SHA1 Message Date
daniel
f10b8df598 Fix ApiStashEdit wrt custom DataUpdates.
My previous patch broke this: ApiStashEdit would stash ParserOutput
with no custom DataUpdates, but calling getSecondaryDataUpdates still
failed after unserialization. This patch should fix that.

Bug: T86305
Change-Id: Ic114e521c5dfd0d3c028ea7d16e93eace758deef
2015-01-09 19:19:13 +00:00
Kunal Mehta
e27ae6b5ec Convert more wfRunHooks() --> Hooks::run()
Change-Id: I1b1e3cb6871721fc05dda881a8020c9a5d30a514
2014-12-12 14:47:31 -08:00
umherirrender
91f26d50ee Use Parser::SFH_NO_HASH/SFH_OBJECT_ARGS class const
Instead of the global const
Add hint to Defines, that they should not be used.

Change-Id: I3e1dcf46fe18a97a05e3406c209815adb7e0e083
2014-11-18 21:19:22 +01:00
Timo Tijhof
96771e3a65 test: Clean up data providers that should be static
Follows-up b36d883.

By far most data providers are static (and PHPUnit expects them
to be static and calls them that way).

Most of these classes already had their data providers static
but additional commits sloppily introduced non-static ones.

* ResourceLoaderWikiModuleTest, 8968d8787f.
* TitleTest, 545f1d3a73.
  Odd unused method 'dataTestIsValidMoveOperation' was introduced
  in 550b878e63.
* GlobalVarConfigTest, a3e18c3670.

Change-Id: I5da99f7cd3da68c550ae507ffe1f725d31e7666f
2014-09-18 12:52:44 -07:00
Brad Jorsch
e2c9d4dfa9 Improve/rename Parser::replaceUnusualEscapes
The previous implementation would unescape '&', '=', '+', and '%'. The
first three will break the URL when unescaped in the query string, and
the last will break when unescaped anywhere.

The code is now changed to treat the path, query, and fragment parts of
the URL separately when unescaping. We also escape any unsafe characters
and ensure all percent-encodings use uppercase hexits.

And since the old name is no longer accurate,
Parser::replaceUnusualEscapes is deprecated in favor of
Parser::normalizeLinkUrl.

Bug: 57909
Change-Id: I77dc308d0d016c395ad737c08cf10a7711e25bbd
2014-09-16 23:00:16 +00:00
Brian Wolff
1bb00307a8 Make generating Parser test class names more robust
This includes the extension name, and it also does much
more stringent validation. In the (now rather unlikely)
event of a duplicate name, it will append a number.

This is important, as it is very confusing when this bug strikes.
There exists extensions like CharRangeSpan which will trigger this bug.

Bug: 42174
Change-Id: Idf14b4cbdb8ec103340d48855e0361acf707b101
2014-09-16 20:38:04 +00:00
umherirrender
b0cfcd0fcb Add missing @return and @param to doc blocks
Change-Id: I9d99ba1968ed8f97624d957754c8847dfe1b41da
2014-08-27 21:57:45 +02:00
umherirrender
63dc5abc9a Fixed spacing
- Added space after reserved words: function, foreach, if
- Combined 'else if' into elseif
- Added braces to one-line statements
- Added spaces after comma, before parentheses

Change-Id: Ie5bbf680d6fbe0f0872dab2700c16b1394906a72
2014-08-27 18:31:50 +02:00
physikerwelt
6a68fad159 Protect MathML from Tidy
MediaWiki installations that use the setting
$wgUseTidy = true; are unable to output
MathML since the well defined MathML elements
are filtered out by Tidy. This was reported as
  http://sourceforge.net/p/tidy/patches/84/ .

This change hides MathML blocks from
Tidy.

Bug: 66516
Change-Id: Ib48b91238c3eddd6a86b62f6ce57801d7058f0d8
2014-08-22 12:21:06 -04:00
jenkins-bot
7eddc5caaa Merge "Run some parser tests with tidy." 2014-08-13 21:02:56 +00:00
umherirrender
6b3cbc276c Set $wgUploadNavigationUrl to false on parser and unit tests
Setting this to default avoids failing parser tests,
when it is set in LocalSettings.php

Bug: 54576
Change-Id: I531d5839e9abe571c6c29f290bb159dabca34798
2014-08-13 15:05:14 +00:00
umherirrender
26837cd280 Cleanup some docs (tests)
- 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
2014-08-11 20:06:52 +02:00
C. Scott Ananian
019e8ce29d Run some parser tests with tidy.
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
2014-08-03 17:45:54 -04:00
addshore
892a992ab8 Remove MediaWikiPHPUnitCommand
All functionality has been moved to other places

Change-Id: I6b6b0ef846bc63108c4dff9e17098432fd9d1697
2014-08-02 21:35:34 +00:00
umherirrender
d15f1cc5e1 Break some long lines in maintenance, skins, tests
Change-Id: I5d86ad3e0c90e09440268a670f5af3e2bf080612
2014-07-24 19:03:17 +02:00
This, that and the other
e349358a5d No interlanguage links after local interwiki prefixes
This was noticed on enwiki after w: was marked as a local interwiki prefix
there. Links like [[w🇩🇪Foo]] ought to act like [[🇩🇪Foo]], not
[[de:Foo]].

Also adding a number of additional parser tests related to interwiki links.

Bug: 68085
Change-Id: If39af06edb4af2da85c9bcf43df7088181809fcf
2014-07-22 15:01:07 +02:00
umherirrender
2b021dc48a Fixed spacing
- Added/removed spaces around parenthesis
- Added space after switch/if/foreach
- changed else if to elseif

Change-Id: I99cda543e0e077320091addd75c188cb6e3a42c2
2014-07-19 23:12:10 +02:00
jenkins-bot
e9df496d11 Merge "Add parser test for "extra interlanguage links"." 2014-06-27 14:04:26 +00:00
C. Scott Ananian
09498e1d7f Add parser test for "extra interlanguage links".
This support was added in https://gerrit.wikimedia.org/r/111390
but no parser tests were added at that time.

Bug: 32189
Change-Id: I299ce844919b3f20b3ce116adf64b37dd95325d0
2014-06-26 22:46:13 +00:00
Timo Tijhof
0c2a013beb test: Remove MagicVariableTest#testServernameFromDifferentProtocols
This test was causing failures locally when wgServer != localhost
because {{SERVERNAME}} is derived from wgServerName, not wgServer
and the test is only mocking wgServer.

> MagicVariableTest::testServername.. with data set #2 ('//localhost/')
> Magic servername should be <localhost:string>
> Failed asserting that two strings are identical.
> --- Expected
> +++ Actual
> @@ @@
> -localhost
> +krinkle.dev

This value is no longer derived by the Parser, but is instead
set using wfParserUrl in Setup.php.

Remove this obsolete test and add any missing test cases for
wgParserUrl to its test suite.

Change-Id: I7d7d201cb46841e63dac8ab9fd81b45b252264a3
2014-06-25 12:08:48 +02:00
Jackmcbarn
2d1c6e2634 Add support for testing transparent tags
Allow transparent tag hooks to be loaded during parser tests the way that
regular and function tag hooks can be.

Change-Id: I28ac9cc239628c248f72898d247fa1f6e2c308bd
2014-06-20 11:36:08 -04:00
jenkins-bot
8284e92f51 Merge "Add ParserOutput::unsetProperty, add tests" 2014-06-05 12:41:23 +00:00
Adrian Lang
12c76c1354 Add ParserOutput::unsetProperty, add tests
Change-Id: I29af31918c48a1225b6487c74fd638de26f07b28
2014-06-04 10:02:01 +00:00
C. Scott Ananian
dece73dff9 ParserTests: fix bits column in uploaded images for test cases.
When running parser tests on a sqlite3 database, the insertion of the
djvu image before running the test suite will fail because `NULL` is not
a valid value for the `bits` column of the `image` table.  This will
cause the test suite to eventually fail, since {{NUMBEROFFILES}} differs.

Test uploads show that `bits` is usually set to 0 for both SVG and
DJVU uploads, so fix this (in both the standalone test runner and the
phpunit test runner).

Change-Id: I8689a547d34035534723e87c4c2680c4e67245f2
2014-06-03 21:49:40 +00:00
Bartosz Dziewoński
fd718959b6 Copy various random files used by tests to tests/phpunit/data
The tests currently depend on them never being renamed, which is bad.
(Actual file data in git is de-duplicated automatically AFAIK.)

Change-Id: Id2440326981218f9e7d51541a168db59183fdadf
2014-06-03 22:52:51 +02:00
Tim Starling
4ba7a9c102 Revert "Use square bounding boxes for default-sized thumbnails"
Reverting for further discussion, due to community complaints at https://en.wikipedia.org/w/index.php?title=Wikipedia:Village_pump_%28technical%29&oldid=611154541#Infobox_Image

This reverts commit 7db5534179.

Change-Id: Ieea6224b2a295b5d65bbd486e30cf0573376c7e9
2014-06-02 11:24:09 +10:00
C. Scott Ananian
7db5534179 Use square bounding boxes for default-sized thumbnails
Thumbnails for portrait-orientation images have always been "too big",
especially when displayed in a gallery.  The 'upright' option did not
completely fix the issue.  Using a square bounding box for thumbnails
(and 'framed' images) without an explicit size specifiction provides
a better default appearance.

This also provides a clean syntax for content authored using
Parsoid/Visual Editor, which prefers square bounding boxes.

See:
https://www.mediawiki.org/wiki/Requests_for_comment/Square_bounding_boxes

Bug: 63903
Change-Id: I665d8945843d3b5437a74e376b63c44965590116
2014-05-21 14:30:06 -07:00
Bartosz Dziewoński
c3aa5ef597 Create Parser::stripOuterParagraph to avoid code duplication
We've had the logic for stripping the outer <p/> element in three
separate places. The version in OutputPage was missing the '$' at the
end of the regex, that was most likely a mistake caused by the
duplication.

Also, extend the logic in order not to generate invalid HTML if the
input contains more than one <p/> tag. Added tests for this and the
previous behaviour.

https://www.mail-archive.com/mediawiki-api@lists.wikimedia.org/msg03188.html

Change-Id: I6bb3597898324556df912a23a7ffc9ff250b8f58
2014-05-15 12:20:19 -04:00
jenkins-bot
ac971d9a06 Merge "Add $wgServerName" 2014-05-09 10:18:09 +00:00
Ori Livneh
72c0ce43a8 Add $wgServerName
This partially reverts r73950 which removed $wgServerName on the ground that it
was only used for {{SERVERNAME}}. When it was pointed out that $wgServerName was
also used by several extensions, the response was not to restore the variable, but
to proceed to remove it from extensions as well.

It is a useful variable to have, as the discussion on Id819246a9 makes clear
(see Tim's comment on PS12 and Timo's reply). So let's reintroduce it, and expose
it in mw.config and ApiQuerySiteInfo as well.

Change-Id: I40a6fd427d38c64c628f70a2f407b145443ea204
2014-05-09 11:53:56 +02:00
Brian Wolff
5a81ad0e8a Throw an error if calling parser recursively
People accidentally (or sometimes intentionally) calling the
parser recursively has been a major source of bugs over the
years. I think its much better to fail suddenly, instead
of having unclear signs like UNIQ's all over the place.

Change-Id: I0e42aa69835c15a5df7aecb0dc5c3dec946bdf6a
2014-05-09 09:53:21 +02:00
Tpt
17117f74f5 Addition of a parser test for page= parameter of image inclusion
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
2014-04-29 19:55:44 +02:00
Siebrand Mazeland
69ec133bc5 Pass phpcs-strict on some test files (10/11)
Change-Id: I5624292143fcabe890779f5095eae735d7afb176
2014-04-24 13:50:56 -07:00
Siebrand Mazeland
5a16395d8e Pass phpcs-strict on some test files (9/11)
Change-Id: I69f17bf2af45f03274fdb38853184880e46c3514
2014-04-24 13:50:47 -07:00
umherirrender
092cd8ee31 Fixed some @params documentation (tests)
Swapped some "$var type" to "type $var" or added missing types
before the $var. Changed some other types to match the more common
spelling. Makes beginning of some text in captial.
Also added some missing @param.

Change-Id: Ic8aaf0a93796b97d0fa4617c1f86ff59f4b36131
2014-04-17 20:43:42 +02:00
C. Scott Ananian
0f799ce2b2 Update set of files cleaned up after parserTests
The parser tests now include more generated thumbnails, so we need to
update the list of thumbnail files we clean up after a run.

Change-Id: Ibabab27ecb895a61f57fff265c8d6d3147666e0d
2014-03-25 14:41:23 -04:00
Siebrand Mazeland
0db516b9ac Use correct Creative Commons license abbreviation
Change-Id: I7df989de9dca2ee056030ff6f5830d5f0124185e
2014-03-24 13:51:29 +01:00
C. Scott Ananian
e784f96a56 Allow setting default thumb size in parser tests
The mediawiki default thumb size is 180px.  The Parsoid default thumb
size is 220px, to match the default thumb size for most WMF wikipedias
(see https://bugzilla.wikimedia.org/show_bug.cgi?id=43336).

This discrepancy leads to inconsistent image-related test output.
Allow a test to set an explicit default thumb size with the
'thumbsize' option so that it is possible to write consistent tests.

Change-Id: Ib764d1f1660a50caaf8f0ff245822d1d1a1d264e
2014-03-20 13:40:16 -04:00
C. Scott Ananian
eca4351d1f Parser tests: Make Foobar.svg consistent.
The parserTest.inc file created metadata saying that Foobar.svg was
240x180px, but created an empty SVG file; the DEFAULT_WIDTH and
DEFAULT_HEIGHT in includes/media/SVGMetadataExtractor.php would have
caused this to be treated as a 512x512px image.

In NewParserTest.php, a 200x200px image was created for Foobar.svg.

That caused inconsistent and confusing results for SVG-related parser
tests, depending on which of the testing frameworks you used.

Fixed both of these to use a consistent 240x180px image, since
non-square images are better for checking correct scaling.
(Parsoid has always used a 240x180px size for Foobar.svg).
The non-square image has caused three parser test results to
slightly change.

Change-Id: Ib60a7412d9be808a0995e94d3aa373f2c5ca9bad
2014-03-18 13:27:55 -04:00
Aaron Schulz
9ee2b6f7fc Added a MemoryFileBackend class and made MockFileBackend subclass it
* This backend passes all filebackend and parser tests
* Fixed setupUploads() in parser tests to just use create() instead
  of using store() and having a race condition in the process
* Fixed 'use-filebackend=' for Parser tests

bug: 58094
Change-Id: Ib0c38183cb7f9f2325da98c8a8a1eb2b8e39a7aa
2013-12-19 12:38:00 -08:00
jenkins-bot
76dc198651 Merge "filebackend: cleaned up the FileBackend constructor" 2013-12-10 22:09:21 +00:00
Aaron Schulz
2aa84651ca filebackend: cleaned up the FileBackend constructor
* Added some b/c code with deprecation warnings

Change-Id: Ifceffbc0a37a223bcd7cd3dc60181fc85765bc46
2013-12-03 13:57:01 -08:00
jenkins-bot
b0b37fd95c Merge "Revert "filebackend: cleaned up the FileBackend constructor"" 2013-12-03 20:46:05 +00:00
Aaron Schulz
2f29c7551b Revert "filebackend: cleaned up the FileBackend constructor"
Actually this messes with the implicit backend made for things like Math (when unconfigured), which uses the "new" operator.

This reverts commit 1f129a22cb.

Change-Id: I4c72c4f7c8b82e38df5496cf2b90fc9e19c40334
2013-12-03 20:40:24 +00:00
jenkins-bot
dfe52313df Merge "filebackend: cleaned up the FileBackend constructor" 2013-12-03 20:22:10 +00:00
Aaron Schulz
1f129a22cb filebackend: cleaned up the FileBackend constructor
* Moved some of the graph construction work to FileBackendGroup.
  This helps the code in not depending on the rest of MW so much.
* Updated tests and FileBackendMultiwrite, which are the only things
  directly constructing FileBackend objects.

Change-Id: I188a053c70ce088ce34613d5db40e6708e3ea9b7
2013-11-23 20:21:53 -08:00
aude
71cf107f99 Make setUp and tearDown protected in tests
These are protected in the parent MediaWikiTestCase and
PHPUnit_Framework_TestCase. No good reason to make them public.

Change-Id: I45ecc0e4209f0c3b27e63a550112e4e0ddf6e530
2013-11-24 01:48:09 +01:00
umherirrender
f153998317 Fixed spacing
- 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
2013-11-19 19:03:54 +01:00
jenkins-bot
a34dd90a36 Merge "Fix Tidy quietly breaking TOC disabling" 2013-10-25 19:44:11 +00:00
Max Semenik
d6f673c115 Fix Tidy quietly breaking TOC disabling
The functionality was introduced in I2889bcb9
but doesn't work in presence if Tidy.

Change-Id: Ibf96cc3bc94fac75fd92ec5b9205011fcb68f0c2
2013-10-25 19:04:51 +00:00
addshore
caec5f920a @covers tags for the rest of test files..
Change-Id: I0fafe80531325a412472ab7c9fc6d81c861b3751
2013-10-24 21:38:08 +01:00
jenkins-bot
8cabb5f777 Merge "Make TOC hideable" 2013-10-24 19:22:32 +00:00
addshore
de7af7ac2c Fix scope on all /phpunit test methods
Change-Id: I3ce92463d485a0fb23e464e9a8059330f32d79af
2013-10-24 10:31:32 +02:00
addshore
17c1e91238 General cleanup of Parser tests
- Fixes scope
 - Adds covers tags

Change-Id: I6024f2f7cc7a1812a417c6c389b0a15addde0b5e
2013-10-23 12:26:15 +00:00
addshore
5bf45af50e Cleanup MagicVariableTest
- Give methods scope
 - Make providers static
 - Add @covers todo
 - Merge the Providers file that is only used in here

Change-Id: I60a6bbd5a8ad3d9d414de493ec2b083f52114a7b
2013-10-23 07:58:14 +00:00
Max Semenik
21c1c7d025 Make TOC hideable
Currently, if an extension doesn't want a TOC, it has to remove it manually.
This change wraps the TOC in markers that make it easy to remove it in ParserOutput
on demand without fragmenting the parser cache with stuff like "use/not use TOC".

Change-Id: I2889bcb9eb999c9049601e92440132118e1a8a41
2013-10-18 17:47:47 +04:00
Brad Jorsch
12bc4f1c5b Handle raw <h#> when calculating $rawtoc
When the parser is constructing $rawtoc, it needs the sectionIndex
number to be able to calculate the byteoffset. This number is only
available for wikitext headings ("== foo =="), HTML headings
("<h2>foo</h2>") do not have it and the lack makes byteoffset be wrong
for all subsequent headings in the page.

To fix this, we just omit output of byteoffset in this situation.

Bug: 25203
Change-Id: I39e5faa4ac22d915f06125aac36ced11607b94a3
2013-10-09 13:48:03 -04:00
C. Scott Ananian
0d2c4c4d61 ParserTests: allow test of precedence between interwiki links and namespaces
Bug: 51680
Change-Id: I8ad82c596139824fb97d513a62513edf2941b958
2013-10-02 16:11:33 -04:00
jenkins-bot
7e06997959 Merge "Clean up parser test's InterwikiLoadPrefix hook" 2013-08-26 16:10:50 +00:00
umherirrender
24bfde2710 Fix spacing and break some lines
Change-Id: Ia57685d8858e02e399ad5c75ce64d12609d340ac
2013-08-24 17:06:25 +02:00
Brad Jorsch
7b08f602dc Clean up parser test's InterwikiLoadPrefix hook
Change I36865e38 adjusted the parser test class to hook
InterwikiLoadPrefix, and prevent any other uses of that hook. Which is
ok, except it doesn't clean up after itself so it winds up breaking any
other parser tests that use the same hook.

Change-Id: I351a56ac39a44721d427e9c980eaf5fff246fb57
2013-08-22 14:42:45 -04:00
C. Scott Ananian
35422cadf2 Allow lines empty but for tabs and comments to be ignored.
We originally allowed only spaces around comments.  Now allow tabs as
well.  This ought to affect very few pages, but it helps predictability
and to maintain consistency between the PHP preprocessor and parsoid.

Change-Id: Icb3ff6eec08aaa83ae332d03c910c13995c9c9ee
2013-08-13 15:36:57 -04:00
C. Scott Ananian
414e7ecae3 Code style cleanups to parserTest.inc and NewParserTest.php.
Break some long lines which were causing WARNINGs and ERRORs from the
PHP code style checker.

Change-Id: Id52e18119277030041786d0130e693289b3c519e
2013-07-16 15:01:05 -04:00
C. Scott Ananian
64800d7092 Add wgAllowExternalImages option to parser tests.
This allows us to test whether the parser properly respects the
$wgAllowExternalImages option.

I also renamed the 'rawhtml' option to wgRawHtml so that parser test
options which set wiki configuration variables have consistent names.

Bug: 51092
Change-Id: I6c453b3e366cf775d8eef2dcbde09fcfa7027125
2013-07-10 18:13:20 -04:00
Antoine Musso
2fe1b773d3 test: skip math parser tests when missing $wgTexvc
The Math extension has at least one test marked with the parsertest
option 'texvc'.  We now use it to detects whether $wgTexvc points to an
executable binary and would skip such parser tests if not.

'math' option is kept for backward compatibility, just in case.

Math extension has been updated to use this as of
https://gerrit.wikimedia.org/r/#/c/69873/

bug: 49884
Change-Id: I992b5a5b7aac067f1e368cb3eeba224c056b76f9
2013-06-27 14:18:03 +02:00
jenkins-bot
453a531a14 Merge "PHPUnit now recognizes extension parser tests" 2013-06-20 12:43:01 +00:00
Antoine Musso
35f802edd9 test: rework interwiki lookup in parser tests
Some of our parser tests lookup interwikis.  This was originally done
(parser/parserTest.inc) by inserting a set of interwikis in the database
and was later lamely copy pasted in the PHPUnit wrapped test suite
(phpunit/includes/parser/NewParserTest.php).

Since that time, we had duplicate code and had the test hitting the
database to fetch interwiki.  Nowadays, we can trick the Interwiki
lookup class by using the InterwikiLoadPrefix hook, that let us skip
database lookup entirely (by having the hook returning false) and get
rid of the duplicate code.

The good old parserTests.php still pass the tests :-]

Change-Id: I36865e3890e08a05b8a6aaafa309a87556e235b9
2013-06-17 20:58:42 +00:00
Antoine Musso
a9ab983b26 PHPUnit now recognizes extension parser tests
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
2013-06-17 15:21:31 +00:00
jarry1250
3f5d41d413 The language used to render SVGs should be definable
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
2013-06-05 19:28:03 +00:00
Timo Tijhof
beb1c4a0ec phpcs: More require/include is not a function
Follows-up I1343872de7, Ia533aedf63 and I2df2f80b81.

Also updated usage in text in documentation and the
installer LocalSettingsGenerator.

Most of them were handled by this regex:
- find: (require|include|require_once|include_once)\s*\(\s*(.+?)\s*\)\s*;$
- replace: $1 $2;

Change-Id: I6b38aad9a5149c9c43ce18bd8edbab14b8ce43fa
2013-05-21 23:26:28 +02:00
umherirrender
15ff79312d Fixed spacing and removed unneeded parenthesis
Added spaces after/before parenthesis
Removed unneeded parenthesis around some statements
Broke a long line

Change-Id: I7fbe129f7bbf524dd0598ece2a9708643f08453b
2013-05-17 16:12:08 +00:00
jenkins-bot
93b273da00 Merge "Fix global objects and singletons in NewParserTest" 2013-05-16 16:19:44 +00:00
Daniel Friesen
97caae596d Drop support for XHTML 1.0
* $wgHtml5 = false; is now ignored completely.
* $wgDocType and $wgDTD have been removed.
* $wgXhtmlDefaultNamespace is now ignored.
* XHTML5 will be output if $wgMimeType is set to an XML mime type (according to HTML5's rules).
* For backwards compatibility with extensions $wgHtml5 and $wgXhtmlDefaultNamespace are set
  in Setup.php but depending on them is deprecated.

Change-Id: Iad9634e2ee420b5a3bbffe550421fde4fa1819b0
2013-05-15 23:09:25 -07:00
Timo Tijhof
4bd5471ca3 docs: Remove odd colons after @todo
Most were this way already:
https://doc.wikimedia.org/mediawiki-core/master/php/html/todo.html

Ran a find/replace on the odd ones. Also made them all
lower case.

Change-Id: I70c6a69344ddebc603e9a1c1d87e3cc4f4f4c560
2013-05-15 06:23:40 +00:00
Alexandre Emsenhuber
00f891ce90 Fix global objects and singletons in NewParserTest
- Don't set $wgMemc, $parserMemc and $messageMemc on each test,
  the correct values for $wgMainCacheType and such are already set
  in phpunit.php, so those objects are already the good ones
- Only destroy RepoGroup and FileBackendGroup once before starting
  the tests instead of two
- No need to clear the MessageCache in addDBData(), it is already
  destroyed in setupGlobals() (also avoids creating an object on
  some tests to only call clear() on it)
- Group singleton cleanup after the test in tearDown()

Change-Id: Ib2d6522019160f63f3f968e69940413a1def2f8b
2013-05-10 20:47:35 +00:00
Antoine Musso
dfaf583d83 tests: mock parser tests file access
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
2013-05-10 10:16:55 -07:00
Timo Tijhof
53ee1cefcf tests: Don't set wgStyleSheetPath in addition to wgStylePath
Because 1) `$wgStyleSheetPath = &$wgStylePath;` in default
settings, so setting one sets the other. No need to set both
and 2) in wmf-branches this variable is unset, thus this
caused an E_NOTICE internally when Test::setMwGlobals is
trying to access it to preserve the current value,
and 3) wgStyleSheetPath is deprecated.

Follows-up I1362932db223.

Change-Id: Ibd3f28e460fef995f68dfe1292d25fb75950dcf5
2013-05-08 00:04:38 +00:00
Alexandre Emsenhuber
91a5ea4e5c Remove LocalisationCache::unloadAll() call from NewParserTest::addDBData()
- Localisation cache does not depend on the database, only on the
  localisation files themselves
- the backend is already set to LCStore_Null, so it will not interfere
  with other caches (CDB, database, etc.)

Unloading the whole cache before each test thus only adds overhead
without any benefit, and slows down the test suite (this changes allows
to win about 20 seconds on my local machine).

Change-Id: Ifa36a7135d9f8355e1a10dd49ece806d90f657a2
2013-04-30 23:58:21 +00:00
Alexandre Emsenhuber
a3e979a872 Clean-up to global overrides in NewParserTest
- Move definitions of constant values from NewParserTest::setupGlobals()
  to NewParserTest::setUp() so that the former only defines values
  depending on the test
- Remove duplicate definitions
- Use setMwGlobals() to override the globals in NewParserTest::setUp()
- Change the overriding of $wgNamespaceProtection to use the normal
  procedure instead of the "weirdglobal" thing
- Only define $wgUser, $wgOut and $wgRequest in NewParserTest::setupGlobals()

Change-Id: I1362932db2230455b23e469759ff3f9946da0392
2013-04-26 16:34:12 +02:00
Siebrand Mazeland
791d0b2a98 Update code formatting
Change-Id: I16a9b42651f1cfb1a70dffbb67b7b83dfeb90d03
2013-04-26 14:21:20 +00:00
Daniel Werner
7e4890405d Added more fine grained groups for parser tests
* Group "ParserTests" which allows to run all parser tests in PHPUnit without running other tests
  related to the MediaWiki parser from group "Parser"
* Dynamically generated groups to only run certain parser tests. All of those groups are the parser
  test file names ("." and "_" replaced) prefixed with "ParserTests_". This allows to easily run
  the parser tests of a certain extension separately without using "parserTests.txt".

Change-Id: I03b87820c2968cf16eba2ac39cd8444a0e4dc41a
2013-04-20 20:42:36 +00:00
Daniel Werner
93e7bc4c44 Improved readability of MediaWikiParserTest::suite code
Change-Id: Ic74048bcce71c2eeb8adfca872b978c3f0de094b
2013-04-20 22:40:56 +02:00
C. Scott Ananian
11adcad08b Fix link target and retina thumbnails for manual thumbnails. (Bug 45405.)
The output for [[Image:Bad.jpg|thumb=Foobar.jpg|Title]] used to be:

<div class="thumb tright"><div class="thumbinner" style="width:1943px;"><a
href="/wiki/File:Foobar.jpg" class="image"><img alt=""
src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220"
class="thumbimage" srcset="http://example.com/images/0/09/Bad.jpg 1.5x,
http://example.com/images/0/09/Bad.jpg 2x" /></a>  <div
class="thumbcaption"><div class="magnify"><a href="/wiki/File:Bad.jpg"
class="internal" title="Enlarge"><img
src="/skins/common/images/magnify-clip.png" width="15" height="11" alt=""
/></a></div>Title</div></div></div>

Note that the target of the <a> is the thumb, not the original image,
and that the srcset is loading the full resolution version of Bad.jpg.

The attached patches fix the link target and srcset issues
(suppressing the srcset when a manual thumb is used).  It also adds a
new "Thumb.png" pseudo-file to the parserTests so that we can write
new tests documenting how manual thumbnails are expected to work,
and adds the 'php' option to the thumbnail tests (since the Parsoid
parser generates different output).

Change-Id: I5be80bfce855b85f9debf3ef1776b877d1f84b9f
2013-03-29 12:12:02 -04:00
Aaron Schulz
e8e2474c8f Revert "Misc follow-ups to I2fc3966e (a161c5e)"
That apparently caused bug 46397.

This reverts commit 388b14a15d


Bug : 46397
Change-Id: Ideaa86f0d535873a08e27d6f98f6bd4255b8c594
2013-03-22 21:24:58 +00:00
umherirrender
7d8a184bac Tests: Fix case of some methods
Change-Id: Iab247f805410f2e9157d325edd80880538a3e54c
2013-03-22 17:44:34 +01:00
Timo Tijhof
b36d883017 Tests: Make phpunit providers "public static".
Follows-up I9d2b148e57 (including phpunit/languages this time).

Bug: 46434
Change-Id: I30e5efcd88c516121c454676bd7a18f9b7c8fca6
2013-03-22 03:12:37 +01:00
umherirrender
817d4fc55b MagicVariableTest.php: Use dataProvider
Setting a global 3 times in one test method looks weird

Change-Id: I97f6a932ee2d5c9a5e427cf0f40ced730b7e12ec
2013-03-20 20:10:18 +01:00
Brad Jorsch
fc00763f0d Add parser method to call parser functions
There is currently no straightforward way for anything to call a parser
function and get the result. This abstracts out that portion of
braceSubstitution() to allow this.

The immediate motivation for this patch is to close bug 41769 against
Scribunto, see I0138836654b0e34c5c23daaedcdf5d4f9d1c7ab2.

Bug: 41769
Change-Id: I339b882010dedd714e7965e25ad650ed8b8cd48f
2013-03-20 02:52:45 +00:00
C. Scott Ananian
2c56e3b087 Add 'parsoid' option to parserTests.txt.
Rather than overload the 'disabled' option, explicitly mark Parsoid-only
parser tests with "parsoid" in the options field.  These are disabled
by default when the PHP parser tests are run (but you could explicitly
enable them with --run-parsoid if you wished, in the same way that you
can enable other disabled tests with --run-disabled).

Document the 'php' option, which the PHP parser tests will ignore, but
will (in the future) be used to mark php-only tests which should be
ignored by the Parsoid parser.

Tweaked 'disabled' option to 'parsoid' for those tests which explicitly
call themselves parsoid-only.  I was conservative in this patch; if
the title of the test didn't explicitly mention Parsoid, I left the
test disabled rather than switch it to parsoid.

Change-Id: Id6c396f7966fcb21c1e54e222ab0c9f4e3a34dcc
2013-02-28 18:42:37 -06:00
Mark Holmquist
db6214985a (bug 45396) Use IETF example domains, not Britney
I don't know why Britney-Spears was in core parser tests as the example domain
name, but....well, suffice it to say she's not any more. We're using
example.org now, like sane people.

Change-Id: I47b53b94b4d7e8ad4a992de5e112685df48156c2
2013-02-26 00:25:38 +00:00
jenkins-bot
32b58ee118 Merge "Misc follow-ups to I2fc3966e (a161c5e)" 2013-02-25 08:55:30 +00:00
umherirrender
4eb980fe0a set wgLanguageCode in NewParserTests for all tests
Change one method default and use a constant

Change-Id: Id8d6817c616c289834c6af9ecbc183dbc76fbded
2013-02-19 21:18:03 +00:00
Alexandre Emsenhuber
388b14a15d Misc follow-ups to I2fc3966e (a161c5e)
- Also add LinkCache::addLinkObj() calls to isRedirect(), getLength() and getContentModel()
- Changed error messages when LinkCache returns null, since this really should not happen anymore
- Removed incorrect comments
- Only use the value of the member variable if GAID_FOR_UPDATE is not passed
  (for consistency between the three methods)
- Mark tests that need database access as such due to the call to Title::getContentModel()
  (generally called through Parser::getFunctionLang())

Change-Id: I84e0c47cdf7412f2b7fa5f296d066b64b7bbfd42
2013-02-18 13:31:55 +01:00
Siebrand Mazeland
49dfbc59d0 Update formatting
6 of n.

Change-Id: I0ca3f1f72349623631ce1d7f3a4e2ed5edbdbdf4
2013-02-15 12:44:42 +00:00
Dan Collins
9846e2558c (bug 27936) Improve parser handling of nested braces.
Parser tests also included, test case and original patch supplied by
Bergi on bugzilla. Tested against the current version.

Change-Id: Id7ec4e694783dd0f682f65f39d8b9e59f82e58aa
2013-02-06 03:39:07 +00:00
daniel
40cb62d558 Better way for extensions to add to ParserOutput.
Extensions sometimes need to stash information in the ParserOutput
for later use. This change provides a clean way to do that.

Change-Id: I8bc571d13c9a70bb71430862c2ab679ff1947126
2013-01-30 12:45:47 +01:00
Antoine Musso
0fd05285d7 pass codesniffer on tests/
Fix almost all occurences of the following sniffs:

Generic.CodeAnalysis.UselessOverridingMethod.Found
Generic.Formatting.NoSpaceAfterCast.SpaceFound
Generic.Functions.FunctionCallArgumentSpacing.SpaceBeforeComma
Generic.Functions.OpeningFunctionBraceKernighanRitchie.BraceOnNewLine
Generic.PHP.LowerCaseConstant.Found
PSR2.Classes.PropertyDeclaration.ScopeMissing
PSR2.Files.EndFileNewline.TooMany
PSR2.Methods.MethodDeclaration.StaticBeforeVisibility

Change-Id: I96aacef5bafe5a2bca659744fba1380999cfc37d
2013-01-28 12:14:26 +01:00
Reedy
1bff6d7428 Remove unreachable lines
Change-Id: Ie7ec14f4ce65bc87b0cd49ec9266c394770ee7c4
2012-12-09 02:37:10 +00:00
Reedy
ffe431dc75 Remove code duplication
Remove trailing whitespace

Change-Id: I31b381c45ccc1631bd17c4d62a1cc1985a4770ba
2012-12-07 01:11:38 +00:00
Antoine Musso
5b9f76aef7 test: detects parent setUp not being called
Our test classes often overload MediaWikiTestCase::setUp() but forget to
call their parent. This patch makes MediaWikiTestCase to flag whenever
its own setUp() is called and then simply assert it got called. Any
class failing the assertion is missing a call to its parent setup which
is easily fixed by adding: parent::setUp().

It would be nice to find a similar trick for tearDown().

Change-Id: Ia2afed6052eb3863d6c8e68c551cf03b33bb4be9
2012-12-05 16:44:41 +01:00
Timo Tijhof
5f41c8ba87 (bug 40632) Remove CleanupPresentationalAttributes feature
Removed $wgCleanupPresentationalAttributes, the associated
code it toggles and references to those in src and tests.

Also fixes bug 40329.

This was originally introduced in r94465 (released in REL1_19) but
disabled by default. Then enabled in r98053, after which several
bugs were filed and eventually the decision was made to remove
this feature.

Removed obsolete release-note entry, as this is to be backported
to REL1_20.

Change-Id: I4e86305520a3b22ef88381caab55d24abac932e3
2012-11-19 22:09:17 +01:00
Alexandre Emsenhuber
07818096df (bug 35204) set wgLanguageCode in unit tests
Setting $wgContLang without changing $wgLanguageCode accordingly is a
very bad idea.

This caused about 20 exceptions when using LanguageCode set to 'fr'
on my installation:

"MWException: Error in MediaWikiLangTestCase::setUp(): $wgLanguageCode
('fr') is different from $wgContLang->getCode() (en)"

Follow-up of I2987db68 (2b0edc8).

Change-Id: I56d3f1bfc78d6a2e40460533524e82f360490206
2012-11-17 09:53:34 +01:00
umherirrender
9d6977cdbd Delete more thumbnails after (new) parser tests.
Same as I0a0e757a only for the new parser tests (under phpunit)

Change-Id: If2198676da7e8a621d02227b42da0713f67a1de0
2012-11-16 23:28:39 +01:00
Alexandre Emsenhuber
d1be0a802e Define $wgAlwaysUseTidy to false where needed in unit tests
Tidy changes some whitespaces in the HTML which breaks the tests if enabled.

Change-Id: Ib44f60c0d4b595c76c258b41962c3c45ca21ac3e
2012-11-07 23:08:56 +01:00
umherirrender
dcb6ad0097 Use ParserOptions::newFromUserAndLang in tests
This avoids using $wgUser and $wgLang for the ParserOption, which is not
needed in the tests

Change-Id: Iea07e9a0f0898ec5f8eb98a40000f5d33b279c9e
2012-10-24 15:59:30 +02:00
Antoine Musso
c6ea55bf54 tests: always call parent setUp
Some class extending MediaWikiTestCase did not call its setUp method. We
most probably always want to do it since MediaWikiTestCase::setUp() does
garbage collection and might do more in the future.

Change-Id: I68dde370a62c8f4a779836ca0c4ad06844fdc916
2012-10-23 19:04:40 +02:00
daniel
e6c8c43356 Skip parser tests if main NS isn't wikitext.
Change-Id: Ie3267e4db4246d522b6564204e9688258fc41324
2012-10-12 15:39:01 +02:00
Brion Vibber
966cda2f80 Initial stab at responsive images for screen densities.
* adds $wgResponsiveImages setting, defaulting to true, to enable the feature
* adds 'srcset' attribute with 1.5x and 2x URLs to image links and image thumbs
* adds jquery.hidpi plugin to check pixel density and implement partial 'srcset' polyfill
** $.devicePixelRatio() returns window.devicePixelRatio, with compat fallback for IE 10
** $().hidpi() performs a 'srcset' polyfill for browsers with no native 'srcset' support
* adds mediawiki.hidpi RL script to trigger hidpi loads after main images load

Note that this is a work in progress. There will be places where this doesn't yet work which output their imgs differently. If moving from a low to high-DPI screen on a MacBook Pro Retina display, you won't see images load until you reload.

Confirmed basic images and thumbs in wikitext appear to work in Safari 6, Chrome 21, Firefox 18 nightly on MacBook Pro Retina display, and IE 10 in Windows 8 at 150% zoom, 200% zoom, and 140% and 180%-ratio Metro tablet sizes.

Internally this is still a bit of a hack; Linker::makeImageLink and Linker::makeThumbLink explicitly ask for 1.5x and 2x scaled versions and insert their URLs, if different, into the original thumbnail object which (in default handler) outputs the srcset. This means that a number of places that handle images differently won't see the higher-resolution versions, such as <gallery> and the large thumbnail on the File: description page.

At some point we may wish to redo some of how the MediaHandler stuff works so that requesting a single thumbnail automatically produces the extra sizes in all circumstances. We might also consider outputting a 'srcset' or multiple src sizes in 'imageinfo' API requests, which would make ApiForeignRepo/InstantCommons more efficient. (Currently it has to make three requests for each image to get the three sizes.)

Change-Id: Id80ebd07a1a9f401a2c2bfeb21aae987e5aa863b
2012-10-11 10:54:21 -07:00
Timo Tijhof
181c7cdc8e Clean and repair many phpunit tests (+ fix implied configuration)
This commit depends on the introduction of
MediaWikiTestCase::setMwGlobals in change Iccf6ea81f4.

Various tests already set their globals, but forgot to restore
them afterwards, or forgot to call the parent setUp, tearDown...

Either way they won't have to anymore with setMwGlobals.

Consistent use of function characteristics:
* protected function setUp
* protected function tearDown
* public static function (provide..)

(Matching the function signature with PHPUnit/Framework/TestCase.php)

Replaces:
 * public function (setUp|tearDown)\(
 * protected function $1(

 * \tfunction (setUp|tearDown)\(
 * \tprotected function $1(

 * \tfunction (data|provide)\(
 * \tpublic static function $1\(

Also renamed a few "data#", "provider#" and "provides#" functions
to "provide#" for consistency. This also removes confusion where
the /media tests had a few private methods called dataFile(),
which were sometimes expected to be data providers.

Fixes:

TimestampTest often failed due to a previous test setting a
different language (it tests "1 hour ago" so need to make sure
it is set to English).

MWNamespaceTest became a lot cleaner now that it executes with
a known context. Though the now-redundant code that was removed
didn't work anyway because wgContentNamespaces isn't keyed by
namespace id, it had them was values...

FileBackendTest:
* Fixed: "PHP Fatal: Using $this when not in object context"

HttpTest
* Added comment about:
  "PHP Fatal: Call to protected MWHttpRequest::__construct()"
  (too much unrelated code to fix in this commit)

ExternalStoreTest
* Add an assertTrue as well, without it the test is useless
  because regardless of whether wgExternalStores is true or false
  it only uses it if it is an array.

Change-Id: I9d2b148e57bada64afeb7d5a99bec0e58f8e1561
2012-10-09 03:01:51 +02:00
umherirrender
a2e470ee68 (bug 32951) Do not register absolute internal externals
Setting $wgRegisterInternalExternals = false for proto server should not
store the http/https links in externallinks table

Also fix detection of own links for links with query or anchor or
nothing

new also detected:
//localhost
//localhost?query
//localhost#anchor

already detected:
//localhost/path

Change-Id: Idd03d309cc3b71728a8cbea460efa12b10348d64
2012-10-03 23:15:38 +00:00
jeroendedauw
38c7f444e1 Use __DIR__ instead of dirname( __FILE__ )
We can now do this since we finally switched to PHP 5.3 for MW 1.20 and get rid of the silly dirname(__FILE__) stuff :)

Change-Id: Id9b2c9cd2e678197aa81c78adced5d1d31ff57b1
2012-08-27 21:45:00 +02:00
Alexandre Emsenhuber
7f9f359edf MessageCache::destroyInstance() is static.
So there is no point calling it using
MessageCache::singleton()->destroyInstance()

Change-Id: Ie4e10284b4b911fff018c52a2a680452601f8288
2012-08-16 10:00:45 +02:00
Daniel Werner
aaf45a0b75 New hook 'ParserTestGlobals'
Allows to set globals before running parser tests.

Change-Id: Iea057b992b260611bca7f3adade2c8214b0dcea2
2012-08-14 00:18:50 +02:00
Antoine Musso
12e608e3d5 converts '@fixme' to '@todo FIXME'
@fixme is simply not recognized by doxygen whereas @todo is used to
generate a nice ... todo list!!

Change-Id: If956c0a164373126ce48b791d45c56962034eecd
2012-07-10 17:16:46 +02:00
Platonides
1896e83ff2 Class renaming didn't went into change 12729
Change-Id: I0e5eff79a41662c89d111eaf0f13c35d9a689dde
2012-06-23 23:04:57 +02:00
Platonides
a05c1a1ab7 WikiPage::preSaveTransform() was deprecated in r103228 (018d885f)
Hide the warning on the tests and add tests for the Parser method.

Change-Id: I939bf59206da1dd45e33db2251e92d9792a0a767
2012-06-23 20:28:51 +02:00
Christian Aistleitner
cc13cf0564 Increase permitted runtime for testParserTest
Change-Id: Id8a73b2d5d32af38c6856c3120394a2d6150f835
2012-04-20 20:00:36 +02:00
Aaron Schulz
638b58c272 * In NewParserTest, made it possible to use the --use-filebackend param to run the tests on a given registered backend.
* In FileBackendTest, killed useless recursiveClean() call.
2012-01-28 01:20:42 +00:00
Aaron Schulz
e9f1ffeed7 Killed the metric arseload of test folders that were being leaked and killing jenkins 2012-01-27 22:57:14 +00:00
Aaron Schulz
c1c6433bfc * In NewParserTest, refactored code to use FileBackend (bug 31737). Also made some speed improvements and made regex= not flood the output with 600 items of crap.
* In FileBackendTest, call clean() on the dirs *after* deleting all the files first.
* Speed improvements to MediaWikiTestCase.
2012-01-25 23:11:53 +00:00
Antoine Musso
f0493a88a0 move parser fuzz test to ParserFuzz group
Somehow fixes bug 29493:
« Put parser fuzz tests in @group and disable by default »
2012-01-10 20:50:34 +00:00
Platonides
4fc7769069 Revert r108358. It's a good fellow and we like to keep it. 2012-01-09 22:33:00 +00:00
Chad Horohoe
6cc1277748 Remove no-op codepath 2012-01-09 13:04:05 +00:00
Chad Horohoe
95d52efc32 * Drop old parserTests.php way of running parser tests. You can run parser tests via --group Parser or specifying
the includes/parser/MediaWikiParserTest.php test case
* Drop now unused various test recorder options -- phpunit outputs its data in lots of machine-readable formats, use those if you need to work with
  test data
* There's still a lot of duplication between NewParserTest::setUp() and MediaWikiTestCase, but hey one step at a time ;-)
* All tests pass for me (make phpunit && make parser)
2012-01-08 17:28:13 +00:00
Alexandre Emsenhuber
40c98e0ad1 * Don't select (even twice for PHPUnit tests) "FOR UPDATE", but use the master database directly instead
* Also pass the line number
* Removed useless usage of $title when throwing the exception about invalid since that variable is always null
* Added $ignoreDuplicate parameter to ParserTest::addArticle()
2012-01-07 12:19:10 +00:00
Aaron Schulz
73e83a48b9 * Fixed bogus dollar signs left in $tmpGlobals array keys in r108300.
* Various documentation cleanups.
2012-01-07 03:46:54 +00:00
Aaron Schulz
7d923a9360 In FileBackend/FileOp:
* Replaced 'media' portion of container names with the repo name. This makes it easy for multiple repos to use the same backend without 'wikiId' hacks. Full container names are now like <wiki>-<repo>-<zone> (or <repo>-<zone> if 'wikiId' is set to an empty string).
* Restricted isValidContainerName() more in light of Azure portability and shorted shard suffix.
* Bumped $maxCacheSize to 75 storage paths.
* Code comment cleanups and additions.
Unit tests:
* Updated related tests and marked testBug29408() as broken (I can't find the problem).
* Reduced leakage in UploadFromUrlTestSuite a bit.
2012-01-07 01:33:23 +00:00
Aaron Schulz
eeb4bd77e1 * FU r106752: de-uglified Setup.php by moving most of the b/c code into FileBackendGroup. Deferred registration of file backends and lock managers to the respective singleton() functions for the group objects.
* Refactored FileRepo::initZones() to require the specific zones; nothing was using it differently.
* Removed deleted zone check in deleteBatch(), a similar error will instead trigger with the initZones() call as needed.
* Added $wgLocalFileRepo comment.
* Updated tests.
2011-12-22 01:06:19 +00:00
Aaron Schulz
53f96171cc FU r106752: use "media-" instead of "images-" in container names. Long live books, video, 3D meshes, and animated holograms from the future! 2011-12-20 23:47:53 +00:00
Aaron Schulz
5275f9b097 Merged FileBackend branch. Manually avoiding merging the many prop-only changes SVN likes to sprinkle in (easy to spot from the change list). Did not add SwiftFileBackend.php as it still is in development. 2011-12-20 03:52:06 +00:00
John Du Hart
216d661d3b Bug 29524 - Rename RequestContext::getLang to getLanguage
I'll be amazed if this doens't break any tests.
2011-11-21 16:13:21 +00:00
Chad Horohoe
d04fac7853 Comment tweak on MediaWikiParserTest and make ResourceLoaderTest extend MediaWikiTestCase 2011-11-12 21:32:39 +00:00
Alexandre Emsenhuber
6efba66c04 Made setupGlobals() return the created context and use it instead of either global variables or recreating more instance of those classes 2011-11-10 12:49:10 +00:00
gicode
08de237f76 Move tests that have likely never been executed. Now they will be executed.
It might be a good idea to have a commit hook or similar to catch these.

You can find candidates for renaming with this command:
$ find tests/phpunit/includes/ -name '*.php' | grep -Ev 'Test.php$' | xargs grep -l MediaWikiTestCase
2011-11-09 23:11:52 +00:00
Platonides
a2db41381e Another old, uncommitted, test (passing on NtPP) 2011-10-31 22:24:26 +00:00
Platonides
2903c6b9a9 Template as parameter name.
I had this test pending longtime, as it is failing in NativePreprocessor.
2011-10-31 22:21:46 +00:00
Platonides
e0afa3b22c The test "{{Foo|1=bar|2=baz}}" got removed in r96887.
Readding without the linestart="1", which is all the difference removed on this file in r96887.
2011-10-29 21:19:08 +00:00
Platonides
796ef5eff2 An alternative to using DOMDocument for normalizing when using Preprocessor_Hash.
Follow-up r99909.
2011-10-28 15:13:27 +00:00
Platonides
6ee7039b29 Follow-up r99909. If there is a preprocessToXml method, use that.
Some preprocessor could have preprocessToObj as a native type.

PHP Fatal error:  Call to a member function __toString() on a non-object in phase3/tests/phpunit/includes/parser/PreprocessorTest.php on line 119
2011-10-28 15:02:10 +00:00
Platonides
58c4ae9c79 Convert the string to single quoted and manually escape it.
http://us.php.net/manual/en/language.types.string.php

addslashes() is convenient, but this way we have no legitimate 
usage, and it's easier to have it banned everywhere.
2011-10-27 21:18:01 +00:00
Sam Reed
6906724935 Add, update, tweak documentation
Fix document comment blocks

Tweak some returns
2011-10-26 03:45:13 +00:00
Antoine Musso
874ae7a731 test that preloaded text is unstripped
bug 27467 reported our preloaded system did not unstrip <nowiki>
or <pre> enclosed text. The fix was applied by r82473.
2011-10-24 10:51:46 +00:00
Antoine Musso
ae87825ed9 test {{SERVERNAME}} with relative URLS
bug 31176 mentionned an issue with {{SERVERNAME}} returning the full
URL instead of servername when using relative URLs (//localhost).
The fix was made by r98193.

This patch test three different URL protocols (http, https & relative)
and check we return the expected 'localhost'.
2011-10-24 09:32:33 +00:00
Antoine Musso
c1f23144e1 using real identity for hashar
Converting my pseudonym to use my real identity instead:
Ashar Voultoiz -> Antoine Musso
2011-10-24 09:08:13 +00:00
Brion Vibber
61bb13a24a Followup r80375: let PreprocessorTest work on Preprocessor_Hash etc as well as Preprocessor_Dom
Using same technique as ApiExpandTemplates to serialize the object tree back to XML, rather than asking for the DOM implementation's internal XML return function.
Have to also perform normalization on the test cases, as they aren't normalized to what libxml2 serializes. :P

Note that there are 4 test failures currently with Preprocessor_Hash, as it makes a separate <equals> element around = which doesn't appear to be in Preprocessor_Dom's output.
2011-10-15 20:21:52 +00:00
Daniel Friesen
7a1d3bf06a Followup r98056; Add to this screwed up NewParserTest phpunit stuff as well. 2011-09-26 02:04:17 +00:00
Brian Wolff
4fc3cd0b22 Make the phpunit old-style parserTest converter thingy not fall on its face if an extension registers a parserTests test file that has a period in it. 2011-09-18 03:32:43 +00:00
Aaron Schulz
23d5a27e2e Reverted r86072, r86419 per CR. Lots of conflicts resolved here. Removes lineStart from r87346 code as well for preprocess parser tests. 2011-09-12 19:16:22 +00:00
Max Semenik
02b2c6c8db Fix for r96344: explicitly set $wgExtensionAssetsPath during tests 2011-09-06 16:47:05 +00:00
Chad Horohoe
df19f6cdea Merge ParserTestStaticParserHook into ParserTestParserHook since they practically do the same thing. 2011-09-06 14:46:58 +00:00