Commit graph

19 commits

Author SHA1 Message Date
Tim Starling
2c6c954e23 Abstract and refactor Tidy support
* Split tidy implementations into a class hierarchy
* Bring all tidy configuration into a single associative array and
  deprecate the old configuration.
* Remove $wgAlwaysUseTidy

This is preparatory to replacement of Tidy (T89331). I used the name
"Raggett" for things relating to Dave Raggett's Tidy, since if we use
"tidy" to mean the new abstract system as well as Raggett's tidy, it
gets confusing.

Change-Id: I77af1a16cbbb47fc226d05fb9aad56c58e8910b5
2015-09-10 20:18:52 -07:00
umherirrender
cb82a1d798 Fix bypassing hooks in TextContentTest
Save the whole global $wgHooks with the default way instead of just a
hook in a own variable.

Change-Id: Ie796f7a53ee38e0dc07f5b026134bbdcb8c9fd53
2014-10-23 17:46:55 +00:00
Chad Horohoe
f129b1baf9 Limit test leakage, $wgCapitalLinks expected to be true
Change-Id: I0f837d29595abefaebeb67d6cc62ea48838d626a
2014-07-07 16:54:35 -07:00
daniel
48d5e5b3c9 Introduce ContentGetParserOutput hook
This hooks allows extensions to override the normal model-specific
rendering of page content. A typical use would be to provide syntax
highlighting for pages that contain scripts. In that sense,
ContentGetParserOutput is a generalization of the old ShowRawCssJs
hook.

This, together with I76412f9d, is a (hopefully) fixed version of the
reverted Ibfb2cbefea44.

Change-Id: I979e2438689648ba4c959d8083197ef14ce524e8
2014-05-10 14:27:33 +02:00
Siebrand Mazeland
1742e9448c Pass phpcs-strict on some test files (6/11)
Change-Id: I5f4bc0df8183cf338ff45cacfc7279c2cd38ee04
2014-04-24 18:26:19 +00:00
addshore
2df1b0f0be Add @covers tags for /content files
Change-Id: Ied40e5afb1027f7d8ff46ffbf722ff6558eed880
2013-10-18 12:53:29 +02:00
Ori.livneh
6ec90a1acd Revert "Introducing ContentGetParserOutput hook."
This change removed getHtml(), but not the call to it from fillParserOutput.
It has a few other issues that I'll flag in-line after deploying the revert.

This reverts commit fda090a7e7

Bug: 49398
Change-Id: Idcef8d4cedc7c03f72bc1743e0f89cc5ed4ad7a7
2013-06-10 19:13:00 +00:00
daniel
fda090a7e7 Introducing ContentGetParserOutput hook.
This hooks allows extensions to override the normal model-specific rendering
of page content. A typical use would be to provide syntax highlighting for
pages that contain scripts. In that sense, ContentGetParserOutput is a
generalization of the old ShowRawCssJs hook.

Change-Id: Ibfb2cbefea44eeee9f2a027f47e7721bf177ba0f
2013-06-04 15:57:04 +00: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
Siebrand Mazeland
791d0b2a98 Update code formatting
Change-Id: I16a9b42651f1cfb1a70dffbb67b7b83dfeb90d03
2013-04-26 14:21:20 +00:00
umherirrender
ff3485ec99 Tests: Use more setMwGlobals
Change some tests to use setMwGlobals to have restoring of globals after
the test.
This also removes some save/restore code, which is not needed, due to
the automatically restoring on tearDown with setMwGlobals.

Change-Id: I8d2ac9f6cc14f0bd4ee8eb851c09f2e71babc6e0
2013-03-21 20:35:44 +01:00
Siebrand Mazeland
9f77245218 Update formatting
4 of n.

Change-Id: I23e2409ce9eff14c3434154d236de83c93a92440
2013-02-14 14:10:38 +01:00
Platonides
aa929e2aa7 Set $wgUseTidy = false on TextContentTest
If $wgUseTidy = true on LocalSettings, although this test
runs fine standalone, when batched with other database tests
it can fail with:
 --- Expected
 +++ Actual
 @@ @@
 -'<p>hello <i>world</i>
 -</p>'
 +'<p>hello <i>world</i></p>'

Change-Id: Id143abf45def7bb686f00584d3f7838dc7396ad7
2013-02-13 05:54:05 +00:00
Alexandre Emsenhuber
4769f44ea5 (bug 37209) Make TextContentTest and WikitextContentTest work in all cases
Currently TextContentTest::testDeletionUpdates() and
WikitextContentTest::testGetSecondaryDataUpdates() set a random page ID to
pages that does not exist. This works in most cases, but when a method like
Title::getLatestRevID() is called on these objects, it throws an excpection
"LinkCache doesn't currently knows about this title."
This happens e.g. when SemanticMediaWiki extension is installed.

Intsead of setting a random page ID, really insert the page in the database
before getting table updates so that it won't crash anymore.

Change-Id: I489c406f78897bc38ac41d8d599b778b47b30021
2013-01-23 18:14:35 +01:00
Platonides
bbd5b3f786 Use the canonical class name: s/JavascriptContent/JavaScriptContent/
Change-Id: I95bfb8860f77d01bad027d1c2baf2d871e093758
2012-12-06 23:11:16 +01:00
umherirrender
2316a649d4 Let TextContentTest extends MediaWikiLangTestCase
There is signature expansion, which fails on $wgLanguageCode = 'de';

Change-Id: I827693a9f872219b983c62f4d3483e67ed9e8a2f
2012-11-11 09:18:04 +00: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
daniel
ea4473037d Content::convert() for conv. betw. content models.
This is needed to fix bug 41706 and similar, watch for follow-ups.

Automatic, implicit conversion may be handy in several cases, especially
for converting between different text based content models. E.g. it should
be possible to create a diff between a JavaScript and a wikitext page. This
change lais the foundations for this ability.

Change-Id: Ie7d87b67b24ac9897cb5696220a7785b228d3c79
2012-11-06 17:39:10 +01:00
Timo Tijhof
a4aef7d495 Fix warnings and enforce conventions in ContentHandler tests.
Syntax:
* Call parent setUp from setUp.
* Set required globals for the test inside the test class instead
  of assuming the default settings.
* Data providers are called statically and outside setUp/tearDown
  ("public static function")
* Test function names should be prefixed with "test"
  ("testIsRedirect")
* Marked 2 functions as unused. JavascriptContentTest has 2 data
  providers for tests that don't exist in it (nor in TextContentText)
  but do exist in WikitextContentTest.

Style:
* Single quotes
* Remove odd comment "# =====" lines
* Consistent tree wrapping with arrays.
  array(
      array(
          .. ) );
  array(
      array(
          ..
      )
  );
  Some were closing on the previous line instead.
  Made it consistent now.
* Remove odd indentation to make nested arrays line up:
  array( 'foo' => array(  'bar' => true,
                          'baz' => array() ) )
  array( 'foo' => array(
      'bar' => true,
      'baz' => array()
  ) )

  We don't do this kind of indentation because it is fragile
  and becomes outdates when any of the earlier keys ("foo")
  change. Converted to a regular tree instead.

  Also triggered git warnings for mixing spaces with tabs, which
  is almost always an detector for this style.

* Not using @annotations in inline comments, reserved (and only
  parsed/meaningful) for block comments.

Follows-up 8b568be5e2

Change-Id: Ic55d539b9a58f448b550bcd98894d389764e0694
2012-10-25 22:37:32 +02:00
Renamed from tests/phpunit/includes/TextContentTest.php (Browse further)