From 7cff82a1184e51c64c4e7cd89a52ef95cef2d628 Mon Sep 17 00:00:00 2001 From: Matthew Flaschen Date: Tue, 22 Oct 2013 01:55:25 -0400 Subject: [PATCH] Test BagOStuff->incr method Change-Id: I3b72f19df82ee302dee47dcf22b69ed9bb6ff8e0 --- tests/phpunit/includes/objectcache/BagOStuffTest.php | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/tests/phpunit/includes/objectcache/BagOStuffTest.php b/tests/phpunit/includes/objectcache/BagOStuffTest.php index be603e5050..f6667de1f2 100644 --- a/tests/phpunit/includes/objectcache/BagOStuffTest.php +++ b/tests/phpunit/includes/objectcache/BagOStuffTest.php @@ -118,6 +118,18 @@ class BagOStuffTest extends MediaWikiTestCase { $this->assertEquals( $this->cache->get( $key ), $value ); } + /** + * @covers HashBagOStuff::incr + */ + public function testIncr() { + $key = wfMemcKey( 'test' ); + $this->cache->add( $key, 0 ); + $this->cache->incr( $key ); + $expectedValue = 1; + $actualValue = $this->cache->get( $key ); + $this->assertEquals( $expectedValue, $actualValue, 'Value should be 1 after incrementing' ); + } + public function testGetMulti() { $value1 = array( 'this' => 'is', 'a' => 'test' ); $value2 = array( 'this' => 'is', 'another' => 'test' ); -- 2.20.1