phpunit: Fix failing DeprecatedGlobalTest on HHVM at Travis CI
authorTimo Tijhof <krinklemail@gmail.com>
Sat, 29 Jul 2017 01:02:28 +0000 (18:02 -0700)
committerTimo Tijhof <krinklemail@gmail.com>
Sat, 29 Jul 2017 01:30:32 +0000 (18:30 -0700)
Follows-up 1d77070f19e3. On Travis CI, this test fails on HHVM:

> There was 1 failure:
> 1) DeprecatedGlobalTest::testWarning
> Failed asserting that exception of type "PHPUnit_Framework_Error" is thrown.

I've been unable to reproduce this locally, but within Travis CI
it happens on both Trusty containers and Trusty VMs, no matter the
version of HHVM. After some trial and error, I narrowed it down
to the error_reporting setting, which presumably has a different default
in the HHVM package Travis CI uses.

Change-Id: I588218103d6c72df5ad4fb6289df688b3740233e

tests/phpunit/includes/DeprecatedGlobalTest.php

index 802f9b1..237e3fb 100644 (file)
  * @covers DeprecatedGlobal
  */
 class DeprecatedGlobalTest extends MediaWikiTestCase {
+
+       public function setUp() {
+               parent::setUp();
+               $this->oldErrorLevel = error_reporting( -1 );
+       }
+
+       public function tearDown() {
+               error_reporting( $this->oldErrorLevel );
+               parent::tearDown();
+       }
+
        public function testObjectDeStub() {
                global $wgDummy;