public function setUp() { if (Zend_Translate::hasCache()) { Zend_Translate::removeCache(); } require_once 'Zend/Translate/Adapter/Array.php'; if (Zend_Translate_Adapter_Array::hasCache()) { Zend_Translate_Adapter_Array::removeCache(); } }
public function testLoadingFilesIntoCacheAfterwards() { require_once 'Zend/Cache.php'; $cache = Zend_Cache::factory('Core', 'File', array('lifetime' => 120, 'automatic_serialization' => true), array('cache_dir' => dirname(__FILE__) . '/_files/')); $this->assertFalse(Zend_Translate_Adapter_Array::hasCache()); Zend_Translate_Adapter_Array::setCache($cache); $this->assertTrue(Zend_Translate_Adapter_Array::hasCache()); $adapter = new Zend_Translate_Adapter_Array(dirname(__FILE__) . '/_files/translation_en.php', 'en'); $cache = Zend_Translate_Adapter_Array::getCache(); $this->assertTrue($cache instanceof Zend_Cache_Core); $adapter->addTranslation(dirname(__FILE__) . '/_files/translation_en.php', 'ru', array('reload' => true)); $test = $adapter->getMessages('all'); $this->assertEquals(6, count($test['ru'])); }