summaryrefslogtreecommitdiff
path: root/vendor/guzzle/guzzle/tests/Guzzle/Tests/Service/CachingConfigLoaderTest.php
diff options
context:
space:
mode:
Diffstat (limited to 'vendor/guzzle/guzzle/tests/Guzzle/Tests/Service/CachingConfigLoaderTest.php')
-rw-r--r--vendor/guzzle/guzzle/tests/Guzzle/Tests/Service/CachingConfigLoaderTest.php43
1 files changed, 43 insertions, 0 deletions
diff --git a/vendor/guzzle/guzzle/tests/Guzzle/Tests/Service/CachingConfigLoaderTest.php b/vendor/guzzle/guzzle/tests/Guzzle/Tests/Service/CachingConfigLoaderTest.php
new file mode 100644
index 0000000..b8245ad
--- /dev/null
+++ b/vendor/guzzle/guzzle/tests/Guzzle/Tests/Service/CachingConfigLoaderTest.php
@@ -0,0 +1,43 @@
+<?php
+
+namespace Guzzle\Tests\Service;
+
+use Guzzle\Cache\DoctrineCacheAdapter;
+use Guzzle\Service\CachingConfigLoader;
+use Doctrine\Common\Cache\ArrayCache;
+
+/**
+ * @covers Guzzle\Service\CachingConfigLoader
+ */
+class CachingConfigLoaderTest extends \Guzzle\Tests\GuzzleTestCase
+{
+ public function testLoadsPhpFileIncludes()
+ {
+ $cache = new DoctrineCacheAdapter(new ArrayCache());
+ $loader = $this->getMockBuilder('Guzzle\Service\ConfigLoaderInterface')
+ ->setMethods(array('load'))
+ ->getMockForAbstractClass();
+ $data = array('foo' => 'bar');
+ $loader->expects($this->once())
+ ->method('load')
+ ->will($this->returnValue($data));
+ $cache = new CachingConfigLoader($loader, $cache);
+ $this->assertEquals($data, $cache->load('foo'));
+ $this->assertEquals($data, $cache->load('foo'));
+ }
+
+ public function testDoesNotCacheArrays()
+ {
+ $cache = new DoctrineCacheAdapter(new ArrayCache());
+ $loader = $this->getMockBuilder('Guzzle\Service\ConfigLoaderInterface')
+ ->setMethods(array('load'))
+ ->getMockForAbstractClass();
+ $data = array('foo' => 'bar');
+ $loader->expects($this->exactly(2))
+ ->method('load')
+ ->will($this->returnValue($data));
+ $cache = new CachingConfigLoader($loader, $cache);
+ $this->assertEquals($data, $cache->load(array()));
+ $this->assertEquals($data, $cache->load(array()));
+ }
+}