/** * Set up manifest before each test */ public function setUp() { parent::setUp(); // Fake project root $this->base = dirname(__FILE__) . '/fixtures/templatemanifest'; // New ThemeManifest for that root $this->manifest = new ThemeManifest($this->base, 'myproject', false, true); // New Loader for that root $this->loader = new ThemeResourceLoader($this->base); $this->loader->addSet('$default', $this->manifest); }
public function setUp() { parent::setUp(); $this->alternateBasePath = $this->getCurrentAbsolutePath() . DIRECTORY_SEPARATOR . "_fakewebroot"; $this->alternateBaseSavePath = TEMP_FOLDER . DIRECTORY_SEPARATOR . 'i18nTextCollectorTest_webroot'; FileSystem::makeFolder($this->alternateBaseSavePath); Config::inst()->update('Director', 'alternate_base_folder', $this->alternateBasePath); // Replace old template loader with new one with alternate base path $this->_oldLoader = ThemeResourceLoader::instance(); ThemeResourceLoader::set_instance($loader = new ThemeResourceLoader($this->alternateBasePath)); $loader->addSet('$default', new ThemeManifest($this->alternateBasePath, project(), false, true)); $this->_oldTheme = Config::inst()->get('SSViewer', 'theme'); Config::inst()->update('SSViewer', 'theme', 'testtheme1'); $this->originalLocale = i18n::get_locale(); // Override default adapter to avoid cached translations between tests. // Emulates behaviour in i18n::get_translators() $this->origAdapter = i18n::get_translator('core'); $adapter = new Zend_Translate(array('adapter' => 'i18nRailsYamlAdapter', 'locale' => i18n::default_locale(), 'disableNotices' => true)); i18n::register_translator($adapter, 'core'); $adapter->removeCache(); i18n::include_by_locale('en'); }