Fix warnings and enforce conventions in ContentHandler tests.
authorTimo Tijhof <ttijhof@wikimedia.org>
Sat, 20 Oct 2012 01:51:15 +0000 (03:51 +0200)
committerTimo Tijhof <ttijhof@wikimedia.org>
Thu, 25 Oct 2012 20:37:32 +0000 (22:37 +0200)
commita4aef7d4952ce7b1887a4ba4f5c605e1c09cc770
tree43054e7b97936ddd2a0894c63f3eb27108abc407
parent0b7eafb8fba08cd674943be391da90690d888fa7
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 8b568be5e2dfb889e1eeedbdca50b304864174f7

Change-Id: Ic55d539b9a58f448b550bcd98894d389764e0694
15 files changed:
includes/AutoLoader.php
includes/DefaultSettings.php
tests/phpunit/MediaWikiTestCase.php
tests/phpunit/includes/ContentHandlerTest.php [deleted file]
tests/phpunit/includes/CssContentTest.php [deleted file]
tests/phpunit/includes/JavascriptContentTest.php [deleted file]
tests/phpunit/includes/TextContentTest.php [deleted file]
tests/phpunit/includes/WikitextContentHandlerTest.php [deleted file]
tests/phpunit/includes/WikitextContentTest.php [deleted file]
tests/phpunit/includes/content/ContentHandlerTest.php [new file with mode: 0644]
tests/phpunit/includes/content/CssContentTest.php [new file with mode: 0644]
tests/phpunit/includes/content/JavascriptContentTest.php [new file with mode: 0644]
tests/phpunit/includes/content/TextContentTest.php [new file with mode: 0644]
tests/phpunit/includes/content/WikitextContentHandlerTest.php [new file with mode: 0644]
tests/phpunit/includes/content/WikitextContentTest.php [new file with mode: 0644]