From e1decd825d937e4f952f3e2a913946314f9f9cc4 Mon Sep 17 00:00:00 2001 From: Timo Tijhof Date: Mon, 25 Jul 2016 16:53:03 +0100 Subject: [PATCH] objectcache: Disable RedisBagOStuff constructor in unit test Follows-up c4e698dc2. The tests are failing on Travis CI because php5-redis isn't installed by default. These tests shouldn't need that to be installed (and even then, we should skip gracefully as it is an optional dependency). > RedisBagOStuffTest::testUnserialize with data set #0 > Exception: RedisConnectionPool requires a Redis client library. > ./mediawiki/includes/clientpool/RedisConnectionPool.php:86 Fixed by using a mock and disabling the original constructor. Change-Id: Icced7c30a75516c2118489ad29eac2aa5cff80ad --- tests/phpunit/includes/objectcache/RedisBagOStuffTest.php | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/tests/phpunit/includes/objectcache/RedisBagOStuffTest.php b/tests/phpunit/includes/objectcache/RedisBagOStuffTest.php index cf87a98098..705a34a68d 100644 --- a/tests/phpunit/includes/objectcache/RedisBagOStuffTest.php +++ b/tests/phpunit/includes/objectcache/RedisBagOStuffTest.php @@ -2,13 +2,16 @@ /** * @group BagOStuff */ -class RedisBagOStuffTest extends MediaWikiTestCase { +class RedisBagOStuffTest extends PHPUnit_Framework_TestCase { /** @var RedisBagOStuff */ private $cache; protected function setUp() { parent::setUp(); - $this->cache = TestingAccessWrapper::newFromObject( new RedisBagOStuff( [ 'servers' => [] ] ) ); + $cache = $this->getMockBuilder( 'RedisBagOStuff' ) + ->disableOriginalConstructor() + ->getMock(); + $this->cache = TestingAccessWrapper::newFromObject( $cache ); } /** -- 2.20.1