Example #1
0
 /**
  * @covers BagOStuff::makeGlobalKey
  * @covers BagOStuff::makeKeyInternal
  */
 public function testMakeKey()
 {
     $cache = ObjectCache::newFromId('hash');
     $localKey = $cache->makeKey('first', 'second', 'third');
     $globalKey = $cache->makeGlobalKey('first', 'second', 'third');
     $this->assertStringMatchesFormat('%Sfirst%Ssecond%Sthird%S', $localKey, 'Local key interpolates parameters');
     $this->assertStringMatchesFormat('global%Sfirst%Ssecond%Sthird%S', $globalKey, 'Global key interpolates parameters and contains global prefix');
     $this->assertNotEquals($localKey, $globalKey, 'Local key and global key with same parameters should not be equal');
 }
 protected function setUp()
 {
     parent::setUp();
     // type defined through parameter
     if ($this->getCliArg('use-bagostuff')) {
         $name = $this->getCliArg('use-bagostuff');
         $this->cache = ObjectCache::newFromId($name);
     } else {
         // no type defined - use simple hash
         $this->cache = new HashBagOStuff();
     }
     $this->cache->delete(wfMemcKey('test'));
 }