Commit graph

9 commits

Author SHA1 Message Date
Bartosz Dziewoński
e36dcfa4c6 CSSMin: Change behavior for missing files
We would previously return the path to the local file on the
filesystem, which is useless in all cases and possibly a security
issue in some. Now we return the URL at which the file would be
accessible had it existed.

Also reordered the code around that part to make the control flow
clearer and added a test.

Change-Id: I1d5befb2ea385ae4d316c5d8c5d1fc092b64c4ff
2013-12-11 21:21:36 +01:00
Bartosz Dziewoński
3987b10b51 CSSMin: Fix remapOne() for URLs that are proto-relative or have query part
Bug: 58338
Change-Id: I836a2c054ae3edc07895b2388f4ec8663223347a
2013-12-11 20:58:28 +01:00
Bartosz Dziewoński
f3779e067f Rewrite CSSMin::remap to support multiple url() values in one rule
Each can be selectively embedded by placing the /* @embed */ comment
just before the url() value. /* @embed */ at the beginning of the rule
affects all url() values appearing in it.

Three changes in existing behavior for previously supported syntax:
* /* @embed */ comments are no longer preserved in output
* rules not terminated by semicolons are correctly supported
* spaces within url() values are correctly supported

Bug: 46757
Bug: 56514
Change-Id: If9082f553fa920c606f12093f39f4a163ebacc32
2013-11-29 18:23:33 +00:00
Bartosz Dziewoński
cdcf0d5ed7 More tests for CSSMin::remap
Also added commented-out tests which should work, but don't.
Making them work in subsequent patch If9082f55.

Change-Id: I65f62493e6d10e7e90af8844f8a26e3982d75f51
2013-11-29 18:19:23 +00:00
addshore
749599fc3c @covers tags for unit tests
Change-Id: I2b486b38326bf23bd379efba2142034e24c0745f
2013-10-24 18:22:57 +01:00
addshore
de7af7ac2c Fix scope on all /phpunit test methods
Change-Id: I3ce92463d485a0fb23e464e9a8059330f32d79af
2013-10-24 10:31:32 +02: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
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
Timo Tijhof
41759f322c PHP test suite for CSSMin
Change-Id: Ic9195614acfd616ccdff57cfc666aa4dfa71fb96
2012-06-20 14:28:09 +02:00