예제 #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());
 }