Fix so wfResetOutputBuffers doesn't break unit tests
authorBrad Jorsch <bjorsch@wikimedia.org>
Fri, 21 Aug 2015 16:01:10 +0000 (12:01 -0400)
committerBrad Jorsch <bjorsch@wikimedia.org>
Fri, 21 Aug 2015 16:24:07 +0000 (12:24 -0400)
commit437936215422d8d8bb3b7db0fb101d9dba78cb1d
treea1993382b2c0bd35da6875189bf3b6640d74b83a
parent8c76a6f0ff0a25145234127b71c2c2124a74d7f0
Fix so wfResetOutputBuffers doesn't break unit tests

If something being unit tested calls wfResetOutputBuffers(), it'll break
PHPUnit's attempt to capture output in order to fail tests. In the old
version we're currently using for Jenkins it will throw a warning
"ob_end_clean(): failed to delete buffer. No buffer to delete", while in
newer versions it'll detect that its buffer was removed and fail the
test as risky instead.

The solution here is to have MediaWikiTestCase add a buffer with a known
name in setUp() (and remove it in tearDown()), and have
wfResetOutputBuffers() stop when it sees that known name on the stack.

Bug: T109843
Change-Id: I8acd91ec9dd9c6d78a5d91d96202249f571d5d83
includes/GlobalFunctions.php
tests/phpunit/MediaWikiTestCase.php