flush
[m6w6/seekat] / tests / CacheTest.php
diff --git a/tests/CacheTest.php b/tests/CacheTest.php
new file mode 100644 (file)
index 0000000..6ceffbd
--- /dev/null
@@ -0,0 +1,41 @@
+<?php
+
+class CacheTest extends BaseTest
+{
+       use ConsumePromise;
+       use AssertSuccess;
+
+       /**
+        * @var seekat\API\Cache\Service
+        */
+       private $cache;
+
+       function setUp() {
+               $this->cache = new seekat\API\Call\Cache\Service\Hollow;
+       }
+
+       /**
+        * @group testdox
+        * @dataProvider provideAPI
+        */
+       function testCachesSuccessiveCalls($api) {
+               $m6w6 = $this->assertSuccess($api->users->m6w6, null, null, $this->cache);
+               $data = $this->cache->getStorage();
+               $m6w6_ = $this->assertSuccess($api->users->m6w6, null, null, $this->cache);
+
+               $this->assertEquals("m6w6", $m6w6->login);
+               $this->assertEquals("m6w6", $m6w6_->login);
+
+               $this->assertInternalType("array", $data);
+               $this->assertCount(1, $data);
+               $this->assertEquals($data, $this->cache->getStorage());
+       }
+
+       /**
+        * @group testdox
+        * @dataProvider provideAPI
+        */
+       function testRefreshesStaleCacheEntries($api) {
+               $this->markTestIncomplete("TODO");
+       }
+}