| 1 |
<?php |
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
class SqlBagOStuffMultiPrimaryIntegrationTest extends BagOStuffTestBase { |
| 9 |
protected function newCacheInstance() { |
| 10 |
return $this->getServiceContainer()->getObjectCacheFactory()->newFromParams( [ |
| 11 |
'class' => SqlBagOStuff::class, |
| 12 |
'loggroup' => 'SQLBagOStuff', |
| 13 |
'multiPrimaryMode' => true, |
| 14 |
'purgePeriod' => 0, |
| 15 |
'reportDupes' => false |
| 16 |
] ); |
| 17 |
} |
| 18 |
|
| 19 |
public function testModtoken() { |
| 20 |
$now = self::TEST_TIME; |
| 21 |
$this->cache->setMockTime( $now ); |
| 22 |
$this->cache->set( 'test', 'a' ); |
| 23 |
$this->assertSame( 'a', $this->cache->get( 'test' ) ); |
| 24 |
|
| 25 |
$now--; |
| 26 |
|
| 27 |
$this->cache->set( 'test', 'b' ); |
| 28 |
$this->assertSame( 'a', $this->cache->get( 'test' ) ); |
| 29 |
|
| 30 |
$now += 2; |
| 31 |
$this->cache->set( 'test', 'c' ); |
| 32 |
$this->assertSame( 'c', $this->cache->get( 'test' ) ); |
| 33 |
} |
| 34 |
} |