From 98f709c36e99612b87a1c26cfc6ee00541a0eced Mon Sep 17 00:00:00 2001 From: "Timothy J. Warren" Date: Tue, 12 Apr 2016 14:05:13 -0400 Subject: [PATCH] Add tests for Cache Manager class --- tests/Ion/Cache/CacheManagerTest.php | 40 ++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) create mode 100644 tests/Ion/Cache/CacheManagerTest.php diff --git a/tests/Ion/Cache/CacheManagerTest.php b/tests/Ion/Cache/CacheManagerTest.php new file mode 100644 index 00000000..bad7a202 --- /dev/null +++ b/tests/Ion/Cache/CacheManagerTest.php @@ -0,0 +1,40 @@ +cache = new CacheManager($this->container); + $this->friend = new Friend($this->cache); + } + + public function testGet() + { + $this->cachedTime = $this->cache->get($this, 'time'); + $this->assertEquals($this->cache->get($this, 'time'), $this->cachedTime); + } + + public function testGetFresh() + { + $this->assertNotEquals($this->cache->getFresh($this, 'time'), $this->cachedTime); + } + + public function testPurge() + { + $this->cachedTime = $this->cache->get($this, 'time'); + $key = $this->friend->generateHashForMethod($this, 'time', []); + $this->cache->purge(); + $this->assertEmpty($this->friend->driver->get($key)); + } +} \ No newline at end of file