示例#1
0
文件: Manager.php 项目: fuelphp/alias
 /**
  * @param Cache|null $cache
  */
 public function __construct(Cache $cache = null)
 {
     if ($cache === null) {
         $cache = new Memory();
     }
     $this->cache = $cache;
     $this->aliases = $cache->get();
 }
示例#2
0
 public function testBasics()
 {
     $alias = 'FooBar';
     $class = 'BazBat';
     // Make sure nothing odd is happening before we start for real
     $this->assertFalse($this->cache->has($alias));
     // Set an item in the cache and fetch it back out
     $this->cache->set($alias, $class);
     $this->assertTrue($this->cache->has($alias));
     $this->assertEquals($class, $this->cache->get($alias));
     $this->assertEquals([$alias => $class], $this->cache->get());
     // Remove the cache item and check it's gone and we can no longer fetch it
     $this->cache->delete($alias);
     $this->assertFalse($this->cache->has($alias));
     $this->assertFalse($this->cache->get($alias));
     $this->assertEquals([], $this->cache->get());
 }