getLocaleAsArray(); \CoreLibs\Language\L10n::loadFunctions(); _setlocale(LC_MESSAGES, $locale['locale']); _textdomain($locale['domain']); _bindtextdomain($locale['domain'], $locale['path']); _bind_textdomain_codeset($locale['domain'], $locale['encoding']); $template_name = "test.full.tpl"; $CACHE_ID = 'SmartyV5PHPUnit'; $COMPILE_ID = 'SmartyV5PHPUnit'; $CONTENT_DATA = [ 'BASE' => BASE, // 'TEST_INSTALL' => $smarty->testInstall(), 'HTML_TITLE' => 'Smarty v5 tst', // smarty test 'SMARTY_TEST' => 'Test Data', 'TRANSLATE_TEST' => $l10n->__('Are we translated?'), 'TRANSLATE_TEST_FUNCTION' => _gettext('Are we translated?'), 'TRANSLATE_TEST_SMARTY' => $l10n->__('Are we translated?'), 'replace' => 'Replaced', // variable variables 'test' => 'foo', 'foo' => 'bar', // loop 'loop_start' => 5, // drop down test with optgroups 'drop_down_test' => [ 'foo' => 'Foo', 'bar' => 'Bar', 'foobar' => 'Foo Bar', ], 'drop_down_test_selected' => 'bar', 'drop_down_test_nested' => [ '' => '選択してください', '4/25(木)' => [ '4/25(木) 11:00-11:50' => '4/25(木) 11:00-11:50', '4/25(木) 12:20-13:00' => '4/25(木) 12:20-13:00' ], '4/26(金)' => [ '4/26(金) 11:00-11:50' => '4/26(金) 11:00-11:50', '4/26(金) 12:20-13:00' => '4/26(金) 12:20-13:00' ], '4/27(土)' => [ '4/27(土) 11:00-11:50' => '4/27(土) 11:00-11:50', '4/27(土) 12:20-13:00' => '4/27(土) 12:20-13:00' ], ], 'drop_down_test_nested_selected' => '', 'radio_test' => [ '0' => 'On', '1' => 'Off', '-1' => 'Undefined' ], 'radio_test_selected' => -1, 'checkbox_test' => [ '0' => 'On', '1' => 'Off', '-1' => 'Undefined' ], 'checkbox_test_pos' => [ '0' => 'A', '1' => 'B' ], 'checkbox_test_selected' => ['1', '-1'], 'checkbox_test_pos_selected' => ['0', '-1'], ]; $smarty = new \Smarty\Smarty(); $smarty->setTemplateDir(BASE . 'includes/templates/frontend'); $smarty->setConfigDir(BASE . 'configs'); $smarty->setCompileDir(BASE . 'templates_c'); $smarty->setCacheDir(BASE . 'cache'); $smarty->setEscapeHtml(true); // get var test $smarty->registerPlugin(\Smarty\Smarty::PLUGIN_MODIFIER, 'getvar', [&$smarty, 'getTemplateVars']); // for testing plugin tyoes require 'plugins/block.t.php'; $smarty->registerPlugin(\Smarty\Smarty::PLUGIN_BLOCK, 'tp', 'smarty_block_t'); require 'plugins/function.popup_init.php'; require 'plugins/function.popup.php'; $smarty->registerPlugin(\Smarty\Smarty::PLUGIN_FUNCTION, 'popinit', 'smarty_function_popup_init'); $smarty->registerPlugin(\Smarty\Smarty::PLUGIN_FUNCTION, 'pop', 'smarty_function_popup'); foreach ($CONTENT_DATA as $key => $value) { $smarty->assign($key, $value); } // the data as it should look like // base created by running the index.php and copy the data from the tmp folder for the template // eg "test.full.tpl" is "tmp/test.full.tpl.html" $compare_smarty_compiled = << Smarty v5 tst BASE: /storage/var/www/html/developers/clemens/core_data/composer-packages/Smarty-Extended/test/

SMARTY_TEST: Test Data
TEST INSTALL
MERGE DATA:
This is a test for Smarty 5
POPUP HERE (hover mouse)
POPUP PLUGIN HERE (hover mouse)
Outside translation test
TRANSLATION CLASS (OUT): Are we translated?
TRANSLATION CLASS (OUT FUNCTION): Are we translated?
TRANSLATION CLASS (SMARTY): Are we translated?
Translate Test with replace:
ORIGINAL: Original with string: %1 (Replaced)
TRANSLATED: Translated with string: Replaced
TRANSLATED (escape): Translated with string: on
Capture test: INPUT TEST
Plural test 0: multi
Plural test 1: single
Plural test 2: multi
Plugin Test:
ORIGINAL: Original with string: %1 (Replaced)
TRANSLATED: Translated with string: Replaced
Variable variables:
Test: foo
Foo: bar
vFoo (\$test = \$foo = bar): bar
vFoo (\$bar = \$test = foo): foo
Some content here or asdfasdfasf
TRANSLATION SMARTY: I should be translated
LOOP TEST
LOOP OUTPUT: 1
LOOP OUTPUT: 2
LOOP OUTPUT: 3
LOOP OUTPUT: 4
LOOP OUTPUT: 5
HTML; $this->assertEquals( $compare_smarty_compiled, trim($smarty->fetch( $template_name, $CACHE_ID, $COMPILE_ID )) ); } } // __END__