flush
[m6w6/seekat] / tests / CacheTest.php
1 <?php
2
3 class CacheTest extends BaseTest
4 {
5 use ConsumePromise;
6 use AssertSuccess;
7
8 /**
9 * @var seekat\API\Cache\Service
10 */
11 private $cache;
12
13 function setUp() {
14 $this->cache = new seekat\API\Call\Cache\Service\Hollow;
15 }
16
17 /**
18 * @group testdox
19 * @dataProvider provideAPI
20 */
21 function testCachesSuccessiveCalls($api) {
22 $m6w6 = $this->assertSuccess($api->users->m6w6, null, null, $this->cache);
23 $data = $this->cache->getStorage();
24 $m6w6_ = $this->assertSuccess($api->users->m6w6, null, null, $this->cache);
25
26 $this->assertEquals("m6w6", $m6w6->login);
27 $this->assertEquals("m6w6", $m6w6_->login);
28
29 $this->assertInternalType("array", $data);
30 $this->assertCount(1, $data);
31 $this->assertEquals($data, $this->cache->getStorage());
32 }
33
34 /**
35 * @group testdox
36 * @dataProvider provideAPI
37 */
38 function testRefreshesStaleCacheEntries($api) {
39 $this->markTestIncomplete("TODO");
40 }
41 }