Esempio n. 1
0
    public function testLoadingFilesIntoCacheAfterwards()
    {
        $cache = CacheFactory::adapterFactory('memory', array('memory_limit' => 0));

        $this->assertFalse(Adapter\ArrayAdapter::hasCache());
        Adapter\ArrayAdapter::setCache($cache);
        $this->assertTrue(Adapter\ArrayAdapter::hasCache());

        $adapter = new Adapter\ArrayAdapter(__DIR__ . '/_files/translation_en.php', 'en');
        $cache   = Adapter\ArrayAdapter::getCache();
        $this->assertTrue($cache instanceof CacheAdapter);

        $adapter->addTranslation(__DIR__ . '/_files/translation_en.php', 'ru', array('reload' => true));
        $test = $adapter->getMessages('all');
        $this->assertEquals(6, count($test['ru']));
    }
Esempio n. 2
0
 public function testLoadingFilesIntoCacheAfterwards()
 {
     $cache = Cache\Cache::factory('Core', 'File', array('lifetime' => 120, 'automatic_serialization' => true), array('cache_dir' => dirname(__FILE__) . '/_files/'));
     $this->assertFalse(Adapter\ArrayAdapter::hasCache());
     Adapter\ArrayAdapter::setCache($cache);
     $this->assertTrue(Adapter\ArrayAdapter::hasCache());
     $adapter = new Adapter\ArrayAdapter(dirname(__FILE__) . '/_files/translation_en.php', 'en');
     $cache = Adapter\ArrayAdapter::getCache();
     $this->assertTrue($cache instanceof Frontend\Core);
     $adapter->addTranslation(dirname(__FILE__) . '/_files/translation_en.php', 'ru', array('reload' => true));
     $test = $adapter->getMessages('all');
     $this->assertEquals(6, count($test['ru']));
 }
Esempio n. 3
0
 public function testLoadingFilesIntoCacheAfterwards()
 {
     $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')))));
     $this->assertFalse(Adapter\ArrayAdapter::hasCache());
     Adapter\ArrayAdapter::setCache($cache);
     $this->assertTrue(Adapter\ArrayAdapter::hasCache());
     $adapter = new Adapter\ArrayAdapter(__DIR__ . '/_files/translation_en.php', 'en');
     $cache = Adapter\ArrayAdapter::getCache();
     $this->assertTrue($cache instanceof CacheAdapter);
     $adapter->addTranslation(__DIR__ . '/_files/translation_en.php', 'ru', array('reload' => true));
     $test = $adapter->getMessages('all');
     $this->assertEquals(6, count($test['ru']));
 }