resourceloader: Fix broken getRequest/getDirection in derived context
authorTimo Tijhof <krinklemail@gmail.com>
Sat, 13 Jun 2015 05:00:33 +0000 (06:00 +0100)
committerTimo Tijhof <krinklemail@gmail.com>
Sat, 13 Jun 2015 05:00:33 +0000 (06:00 +0100)
commit149d721e75b411bddaf21b316be6c624a7c382c1
tree89b65a00c199e2079493d74c8c4715c4d8fd6681
parentd20583dd19502c8088f7522c07dde42d0846d6b1
resourceloader: Fix broken getRequest/getDirection in derived context

getDirection() isn't a simple getter value like the others. It actually
is tightly coupled with getLanguage() and lazy-initialised.

When calling setLanguage(), we shouldn't reset direction back to the
parent class but make sure getDirection() will recompute it based
on the local value.

Added regression test (which fails without this patch).

The parent getDirection() looks for $this->request, but the subclass
doesn't assign that member in the constructor. getRequest() forwards
it accordingly, so make sure getRequest() is also used internally.

Change-Id: Ifec703647368c3bb58748288ed754aaaf3730e19
includes/resourceloader/DerivativeResourceLoaderContext.php
includes/resourceloader/ResourceLoaderContext.php
tests/phpunit/includes/resourceloader/DerivativeResourceLoaderContextTest.php