MediaWiki.php: Factor out tryNormaliseRedirect
authorTimo Tijhof <krinklemail@gmail.com>
Fri, 19 Jun 2015 19:56:36 +0000 (20:56 +0100)
committerTimo Tijhof <krinklemail@gmail.com>
Tue, 23 Jun 2015 06:18:35 +0000 (07:18 +0100)
commit64431fcf8e467a006073ba6dc7f72f48011e5709
tree4b463dda8817bec65082dba7825f847d8cf47ae1
parent25636af1623daab9bff69eddce78113289eb69fe
MediaWiki.php: Factor out tryNormaliseRedirect

This is in preparation for fixing T67402, which requires adding
logic inside this condition block. However the to-be-added code
will influences whether or not a redirect should be made.

In case a redirect is not made, it has to fall through to the next
'elseif' handler in MediaWiki::performRequest(), which is not possible
from inside the 'if' block.

Hence, move it out in a separate block and use a boolean return value
to communicate whether the case has been handled.

This also allows us to unit test this thing. Which is desperately
needed. Albeit ugly as it requires lots of mocking.

Change-Id: If3157f2ff1fd3ab2ca20a5d1f550d864ea62c493
includes/MediaWiki.php
tests/phpunit/includes/MediaWikiTest.php [new file with mode: 0644]