The purpose of NameTableStores is to provide aggressive caching for certain database tables. These caches need to be reset when the corresponding table is reset between unit tests. NameTableStore has a reloadMap() method for that purpose, but there is no easy way to get hold of all the NameTableStore instances. In particular, RevisionStoreFactory presently constructs NameTableStores for content_models and slot_roles that are untracked, it does not use the instances provided MediaWikiServices::getContentModelStore() and MediaWikiServices::getSlotRoleStore(), in order to be able to cosntruct NameTableStore for an arbitrary target database.
We needs to either:
- reset ALL services between tests
- or track all NameTableStore and reset them when the tables get reset
- or at least make RevisionStoreFactory use the same instances we return from getContentModelStore, getSlotRoleStore, etc. A NameTableStoreFactory may be used to achieve this.
Note: there are several mechanisms that may trigger a table to be re-set:
- MediaWikiTestCase::tablesUsed
- MediaWikiTestCase::truncateTable
- MediaWikiTestCase::getSchemaOverrides