Exemplo n.º 1
0
 /**
  * Tests if cached options are read from the cache for a new instance
  */
 public function testGetOptionsFromCache()
 {
     $cache = CacheFactory::factory(array('adapter' => array('name' => 'Filesystem', 'options' => array('ttl' => 120, 'cache_dir' => $this->_cacheDir)), 'plugins' => array(array('name' => 'serializer', 'options' => array('serializer' => 'php_serialize')))));
     Translator\Translator::setCache($cache);
     $lang = new Translator\Translator(Translator\Translator::AN_CSV, __DIR__ . '/Adapter/_files', 'en', array('delimiter' => ','));
     $lang->setOptions(array('logMessage' => 'test'));
     $this->assertEquals('test', $lang->getOptions('logMessage'));
     unset($lang);
     $lang2 = new Translator\Translator(Translator\Translator::AN_CSV, __DIR__ . '/Adapter/_files', 'en', array('delimiter' => ','));
     $this->assertEquals('test', $lang2->getOptions('logMessage'));
 }
Exemplo n.º 2
0
 /**
  * Tests if cached options are read from the cache for a new instance
  */
 public function testGetOptionsFromCache()
 {
     $cache = Cache\Cache::factory('Core', 'File', array('lifetime' => 120, 'automatic_serialization' => true), array('cache_dir' => __DIR__ . '/../_files/'));
     Translator\Translator::setCache($cache);
     $lang = new Translator\Translator(Translator\Translator::AN_CSV, __DIR__ . '/Adapter/_files', 'en', array('delimiter' => ','));
     $lang->setOptions(array('logMessage' => 'test'));
     $this->assertEquals('test', $lang->getOptions('logMessage'));
     unset($lang);
     $lang2 = new Translator\Translator(Translator\Translator::AN_CSV, __DIR__ . '/Adapter/_files', 'en', array('delimiter' => ','));
     $this->assertEquals('test', $lang2->getOptions('logMessage'));
 }
Exemplo n.º 3
0
    /**
     * Tests if cached options are read from the cache for a new instance
     */
    public function testGetOptionsFromCache()
    {
        $cache = CacheFactory::adapterFactory('memory', array('memory_limit' => 0));
        Translator\Translator::setCache($cache);

        $lang = new Translator\Translator(Translator\Translator::AN_CSV, __DIR__ . '/Adapter/_files', 'en', array('delimiter' => ','));
        $lang->setOptions(array('logMessage' => 'test'));
        $this->assertEquals('test', $lang->getOptions('logMessage'));
        unset($lang);

        $lang2 = new Translator\Translator(Translator\Translator::AN_CSV, __DIR__ . '/Adapter/_files', 'en', array('delimiter' => ','));
        $this->assertEquals('test', $lang2->getOptions('logMessage'));
    }