summaryrefslogtreecommitdiff
path: root/vendor/mustache/mustache/test/Mustache/Test/Cache
diff options
context:
space:
mode:
Diffstat (limited to 'vendor/mustache/mustache/test/Mustache/Test/Cache')
-rw-r--r--vendor/mustache/mustache/test/Mustache/Test/Cache/AbstractCacheTest.php44
-rw-r--r--vendor/mustache/mustache/test/Mustache/Test/Cache/FilesystemCacheTest.php36
2 files changed, 80 insertions, 0 deletions
diff --git a/vendor/mustache/mustache/test/Mustache/Test/Cache/AbstractCacheTest.php b/vendor/mustache/mustache/test/Mustache/Test/Cache/AbstractCacheTest.php
new file mode 100644
index 0000000..d977388
--- /dev/null
+++ b/vendor/mustache/mustache/test/Mustache/Test/Cache/AbstractCacheTest.php
@@ -0,0 +1,44 @@
+<?php
+
+/*
+ * This file is part of Mustache.php.
+ *
+ * (c) 2010-2016 Justin Hileman
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
+class Mustache_Test_Cache_AbstractCacheTest extends PHPUnit_Framework_TestCase
+{
+ public function testGetSetLogger()
+ {
+ $cache = new CacheStub();
+ $logger = new Mustache_Logger_StreamLogger('php://stdout');
+ $cache->setLogger($logger);
+ $this->assertSame($logger, $cache->getLogger());
+ }
+
+ /**
+ * @expectedException Mustache_Exception_InvalidArgumentException
+ */
+ public function testSetLoggerThrowsExceptions()
+ {
+ $cache = new CacheStub();
+ $logger = new StdClass();
+ $cache->setLogger($logger);
+ }
+}
+
+class CacheStub extends Mustache_Cache_AbstractCache
+{
+ public function load($key)
+ {
+ // nada
+ }
+
+ public function cache($key, $value)
+ {
+ // nada
+ }
+}
diff --git a/vendor/mustache/mustache/test/Mustache/Test/Cache/FilesystemCacheTest.php b/vendor/mustache/mustache/test/Mustache/Test/Cache/FilesystemCacheTest.php
new file mode 100644
index 0000000..2413125
--- /dev/null
+++ b/vendor/mustache/mustache/test/Mustache/Test/Cache/FilesystemCacheTest.php
@@ -0,0 +1,36 @@
+<?php
+
+/*
+ * This file is part of Mustache.php.
+ *
+ * (c) 2010-2016 Justin Hileman
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
+/**
+ * @group functional
+ */
+class Mustache_Test_Cache_FilesystemCacheTest extends Mustache_Test_FunctionalTestCase
+{
+ public function testCacheGetNone()
+ {
+ $key = 'some key';
+ $cache = new Mustache_Cache_FilesystemCache(self::$tempDir);
+ $loaded = $cache->load($key);
+
+ $this->assertFalse($loaded);
+ }
+
+ public function testCachePut()
+ {
+ $key = 'some key';
+ $value = '<?php /* some value */';
+ $cache = new Mustache_Cache_FilesystemCache(self::$tempDir);
+ $cache->cache($key, $value);
+ $loaded = $cache->load($key);
+
+ $this->assertTrue($loaded);
+ }
+}