blob: 3dd40e24f5f98b20b9e0d4f1b670b48df08e7481 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
|
<?php
/** @group Database */
class AggregateMessageGroupLoaderTest extends PHPUnit\Framework\TestCase {
public function testCacheCalls() {
/** @var MessageGroupWANCache $mockMgWANCache */
$mockMgWANCache = $this->getMockBuilder( MessageGroupWANCache::class )
->disableOriginalConstructor()
->getMock();
$aggregateLoader = new AggregateMessageGroupLoader(
TranslateUtils::getSafeReadDB(),
$mockMgWANCache
);
$mockMgWANCache->expects( $this->once() )
->method( 'getValue' )
->with( 'recache' )
->willReturn( [] );
// should trigger a get call on cache
$aggregateLoader->recache();
// should return the cached groups from process cache
$this->assertEquals( [], $aggregateLoader->getGroups() );
$mockMgWANCache->expects( $this->once() )
->method( 'delete' );
// should trigger the delete method on cache
$aggregateLoader->clearCache();
}
}
|