Inheritance: extends Model
Exemplo n.º 1
0
 public function configure(Cache $cacheConfig)
 {
     $this->cacheConfig = $cacheConfig;
     $this->config = $cacheConfig->getOptions()->toArray();
     $this->testConfig($this->config);
     $this->setup($this->config);
 }
Exemplo n.º 2
0
    public function testSystemConfigCache()
    {
        $xml = '<config>
  <cache service="vendor.other.cache">
    <options>
      <option key="servers">
        <option>127.0.0.1</option>
        <option>192.168.0.1</option>
      </option>
      <option key="compression">true</option>
      <option key="foo">bar</option>
    </options>
  </cache>
</config>';
        $config5 = new SystemConfig();
        $cache = new Cache();
        $cache->setService('vendor.other.cache');
        $cache->setOption('servers', array('127.0.0.1', '192.168.0.1'));
        $cache->setOption('compression', 'true');
        $cache->setOption('foo', 'bar');
        $config5->setCache($cache);
        $this->assertEquals(array('127.0.0.1', '192.168.0.1'), $config5->getCache()->getOption('servers'));
        $this->assertEquals($xml, $config5->toXml());
        $reverse = new SystemConfig($xml);
        $this->assertEquals(array('127.0.0.1', '192.168.0.1'), $reverse->getCache()->getOption('servers'));
        $this->assertEquals('true', $reverse->getCache()->getOption('compression'));
        $this->assertEquals($xml, $reverse->toXml());
    }