Merge "Convert file delete to use OOUI"
[lhc/web/wiklou.git] / tests / phpunit / includes / Storage / NameTableStoreTest.php
index 0cd164b..e5104d8 100644 (file)
@@ -83,14 +83,17 @@ class NameTableStoreTest extends MediaWikiTestCase {
                BagOStuff $cacheBag,
                $insertCalls,
                $selectCalls,
-               $normalizationCallback = null
+               $normalizationCallback = null,
+               $insertCallback = null
        ) {
                return new NameTableStore(
                        $this->getMockLoadBalancer( $this->getCallCheckingDb( $insertCalls, $selectCalls ) ),
                        $this->getHashWANObjectCache( $cacheBag ),
                        new NullLogger(),
                        'slot_roles', 'role_id', 'role_name',
-                       $normalizationCallback
+                       $normalizationCallback,
+                       false,
+                       $insertCallback
                );
        }
 
@@ -295,4 +298,18 @@ class NameTableStoreTest extends MediaWikiTestCase {
                $this->assertSame( $barId, $store3->acquireId( 'bar' ) );
        }
 
+       public function testGetAndAcquireIdInsertCallback() {
+               $store = $this->getNameTableSqlStore(
+                       new EmptyBagOStuff(),
+                       1,
+                       1,
+                       null,
+                       function ( $insertFields ) {
+                               $insertFields['role_id'] = 7251;
+                               return $insertFields;
+                       }
+               );
+               $this->assertSame( 7251, $store->acquireId( 'A' ) );
+       }
+
 }