function setUp() { parent::setUp(); $this->alternateBasePath = $this->getCurrentAbsolutePath() . "/_fakewebroot"; $this->alternateBaseSavePath = TEMP_FOLDER . '/i18nTextCollectorTest_webroot'; FileSystem::makeFolder($this->alternateBaseSavePath); Director::setBaseFolder($this->alternateBasePath); // Push a template loader running from the fake webroot onto the stack. $templateManifest = new SS_TemplateManifest($this->alternateBasePath, false, true); $templateManifest->regenerate(false); SS_TemplateLoader::instance()->pushManifest($templateManifest); $this->_oldTheme = SSViewer::current_theme(); SSViewer::set_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'); }
function setUp() { parent::setUp(); $this->alternateBasePath = Director::baseFolder() . "/sapphire/tests/i18n/_fakewebroot"; $this->alternateBaseSavePath = TEMP_FOLDER . '/i18nTextCollectorTest_webroot'; FileSystem::makeFolder($this->alternateBaseSavePath); // SSViewer and ManifestBuilder don't support different webroots, hence we set the paths manually global $_CLASS_MANIFEST; $_CLASS_MANIFEST['i18nTestModule'] = $this->alternateBasePath . '/i18ntestmodule/code/i18nTestModule.php'; $_CLASS_MANIFEST['i18nTestModule_Addition'] = $this->alternateBasePath . '/i18ntestmodule/code/i18nTestModule.php'; $_CLASS_MANIFEST['i18nTestModuleDecorator'] = $this->alternateBasePath . '/i18nothermodule/code/i18nTestModuleDecorator.php'; global $_ALL_CLASSES; $_ALL_CLASSES['parents']['i18nTestModule'] = array('DataObject'=>'DataObject','Object'=>'Object'); $_ALL_CLASSES['parents']['i18nTestModule_Addition'] = array('Object'=>'Object'); $_ALL_CLASSES['parents']['i18nTestModuleDecorator'] = array('DataObjectDecorator'=>'DataObjectDecorator','Object'=>'Object'); global $_TEMPLATE_MANIFEST; $_TEMPLATE_MANIFEST['i18nTestModule.ss'] = array( 'main' => $this->alternateBasePath . '/i18ntestmodule/templates/i18nTestModule.ss', 'Layout' => $this->alternateBasePath . '/i18ntestmodule/templates/Layout/i18nTestModule.ss', ); $_TEMPLATE_MANIFEST['i18nTestModuleInclude.ss'] = array( 'Includes' => $this->alternateBasePath . '/i18ntestmodule/templates/Includes/i18nTestModuleInclude.ss', ); $_TEMPLATE_MANIFEST['i18nTestModule.ss'] = array( 'main' => $this->alternateBasePath . '/i18ntestmodule/templates/i18nTestModule.ss', 'Layout' => $this->alternateBasePath . '/i18ntestmodule/templates/Layout/i18nTestModule.ss', ); }
function setUp() { parent::setUp(); $this->alternateBasePath = $this->getCurrentAbsolutePath() . "/_fakewebroot"; $this->alternateBaseSavePath = TEMP_FOLDER . '/i18nTextCollectorTest_webroot'; FileSystem::makeFolder($this->alternateBaseSavePath); // Push a template loader running from the fake webroot onto the stack. $manifest = new SS_TemplateManifest($this->alternateBasePath, false, true); $manifest->regenerate(false); SS_TemplateLoader::instance()->pushManifest($manifest); $this->originalLocale = i18n::get_locale(); }
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'); }