Test BagOStuff->incr method
authorMatthew Flaschen <mflaschen@wikimedia.org>
Tue, 22 Oct 2013 05:55:25 +0000 (01:55 -0400)
committerMatthew Flaschen <mflaschen@wikimedia.org>
Tue, 22 Oct 2013 19:48:50 +0000 (15:48 -0400)
Change-Id: I3b72f19df82ee302dee47dcf22b69ed9bb6ff8e0

tests/phpunit/includes/objectcache/BagOStuffTest.php

index be603e5..f6667de 100644 (file)
@@ -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' );