wiki.techinc.nl/tests/phpunit/unit/includes/objectcache/ObjectCacheFactoryTest.php
Ebrahim Byagowi fab78547ad Add namespace to the root classes of ObjectCache
And deprecated aliases for the the no namespaced classes.

ReplicatedBagOStuff that already is deprecated isn't moved.

Bug: T353458
Change-Id: Ie01962517e5b53e59b9721e9996d4f1ea95abb51
2024-07-10 00:14:54 +03:30

40 lines
915 B
PHP

<?php
use MediaWiki\Config\ServiceOptions;
use MediaWiki\Logger\Spi;
use Wikimedia\ObjectCache\HashBagOStuff;
use Wikimedia\Stats\StatsFactory;
/**
* @covers ObjectCacheFactory
*/
class ObjectCacheFactoryTest extends MediaWikiUnitTestCase {
private function newObjectCacheFactory() {
return new ObjectCacheFactory(
$this->createMock( ServiceOptions::class ),
$this->createMock( StatsFactory::class ),
$this->createMock( Spi::class ),
static function () {
},
'testWikiId'
);
}
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 );
}
}