wiki.techinc.nl/tests/phpunit/unit/includes/objectcache/ObjectCacheFactoryTest.php
Derick Alangi e0c34987eb
objectcache: Restore default keyspace for LocalServerCache service
* Fix main makeLocalServerCache() call in ObjectCacheFactory::newFromId
  to include a default keyspace, since wgCachePrefix is false by default
  (including at WMF).
* Idem for ExtensionRegistry.
* Dependency inject the domain ID so that service wiring does the
  correct thing when doing cross-wiki operations.

This is a followup on: I3179a387486377c6a575d173f39f82870c49c321.

Bug: T358346
Bug: T361177
Change-Id: Ibbb250465529810b8593f90bbb8330af0a2c3dbd
2024-03-28 19:47:44 +01:00

39 lines
868 B
PHP

<?php
use MediaWiki\Config\ServiceOptions;
use MediaWiki\Logger\Spi;
use Wikimedia\Stats\StatsFactory;
/**
* @covers ObjectCacheFactory
*/
class ObjectCacheFactoryTest extends MediaWikiUnitTestCase {
private function newObjectCacheFactory() {
$factory = new ObjectCacheFactory(
$this->createMock( ServiceOptions::class ),
$this->createMock( StatsFactory::class ),
$this->createMock( Spi::class ),
'testWikiId'
);
return $factory;
}
public function testNewObjectCacheFactory() {
$this->assertInstanceOf(
ObjectCacheFactory::class,
$this->newObjectCacheFactory()
);
}
public function testNewFromParams() {
$factory = $this->newObjectCacheFactory();
$objCache = $factory->newFromParams( [
'class' => 'HashBagOStuff',
'args' => [ 'foo', 'bar' ],
] );
$this->assertInstanceOf( HashBagOStuff::class, $objCache );
}
}