|
1 | 1 | <?php
|
2 | 2 |
|
| 3 | +# Requires ext_intl and pdo_sqlite3 to be activate |
| 4 | + |
3 | 5 | $serendipity['dbType'] = 'pdo-sqlite';
|
4 |
| -//@define('LANG_CHARSET', 'UTF-8'); |
5 | 6 | @define('S9Y_PEAR_PATH', dirname(__FILE__) . '/../../bundled-libs/');
|
| 7 | +@define('S9Y_INCLUDE_PATH', dirname(__FILE__) . '/../../'); |
6 | 8 | @define('PATH_SMARTY_COMPILE', dirname(__FILE__) . '/../../templates_c/');
|
7 | 9 | @define('IN_serendipity', true);
|
8 | 10 | @define('IS_installed', false);
|
| 11 | +@define('serendipity_LANG_LOADED', false); |
9 | 12 |
|
| 13 | +require_once(dirname(__FILE__) . '/../../bundled-libs/autoload.php'); |
10 | 14 | require_once dirname(__FILE__) . '/../../lang/UTF-8/serendipity_lang_en.inc.php';
|
| 15 | +require_once dirname(__FILE__) . '/../../include/compat.inc.php'; |
| 16 | +require_once dirname(__FILE__) . '/../../include/lang.inc.php'; |
11 | 17 | require_once dirname(__FILE__) . '/../../include/functions_smarty.inc.php';
|
12 | 18 |
|
13 | 19 | use PHPUnit\Framework\Attributes\Test;
|
@@ -63,5 +69,81 @@ public function test_smarty_renders()
|
63 | 69 | $result = $serendipity['smarty']->fetch('eval:' . $template_string);
|
64 | 70 | $this->assertEquals('display value here', $result);
|
65 | 71 | }
|
| 72 | + |
| 73 | + #[Test] |
| 74 | + public function test_smarty_renders_makeFilename() |
| 75 | + { |
| 76 | + global $serendipity; |
| 77 | + |
| 78 | + serendipity_smarty_init(); |
| 79 | + |
| 80 | + @define('PAT_FILENAME', '/'); |
| 81 | + |
| 82 | + $serendipity['smarty']->assign('comment', 'value'); |
| 83 | + $template_string = '{$comment|@makeFilename} {"blank"|@xhtml_target}'; |
| 84 | + $result = $serendipity['smarty']->fetch('eval:' . $template_string); |
| 85 | + $this->assertNotNull($result); |
| 86 | + } |
| 87 | + |
| 88 | + #[Test] |
| 89 | + public function test_smarty_renders_xhtml_target() |
| 90 | + { |
| 91 | + global $serendipity; |
| 92 | + |
| 93 | + serendipity_smarty_init(); |
| 94 | + |
| 95 | + $serendipity['smarty']->assign('comment', 'value'); |
| 96 | + $template_string = '{ {"blank"|@xhtml_target}'; |
| 97 | + $result = $serendipity['smarty']->fetch('eval:' . $template_string); |
| 98 | + $this->assertNotNull($result); |
| 99 | + } |
| 100 | + |
| 101 | + #[Test] |
| 102 | + public function test_smarty_renders_empty_prefix() |
| 103 | + { |
| 104 | + global $serendipity; |
| 105 | + |
| 106 | + serendipity_smarty_init(); |
| 107 | + |
| 108 | + $template_string = '{"test"|@emptyPrefix}'; |
| 109 | + $result = $serendipity['smarty']->fetch('eval:' . $template_string); |
| 110 | + $this->assertEquals(': test', $result); |
| 111 | + } |
| 112 | + |
| 113 | + #[Test] |
| 114 | + public function test_smarty_renders_formatTime() |
| 115 | + { |
| 116 | + global $serendipity; |
| 117 | + |
| 118 | + serendipity_smarty_init(); |
| 119 | + |
| 120 | + $template_string = '{946684800|@formatTime:\'%b %e. %Y\'}'; |
| 121 | + $result = $serendipity['smarty']->fetch('eval:' . $template_string); |
| 122 | + $this->assertEquals('Jan 1. 2000', $result); |
| 123 | + } |
| 124 | + |
| 125 | + #[Test] |
| 126 | + public function test_smarty_renders_utf8_encode() |
| 127 | + { |
| 128 | + global $serendipity; |
| 129 | + |
| 130 | + serendipity_smarty_init(); |
| 131 | + |
| 132 | + $template_string = '{"test"|@serendipity_utf8_encode}'; |
| 133 | + $result = $serendipity['smarty']->fetch('eval:' . $template_string); |
| 134 | + $this->assertEquals('test', $result); |
| 135 | + } |
| 136 | + |
| 137 | + #[Test] |
| 138 | + public function test_smarty_renders_ifRemember() |
| 139 | + { |
| 140 | + global $serendipity; |
| 141 | + |
| 142 | + serendipity_smarty_init(); |
| 143 | + |
| 144 | + $template_string = '{"test"|@ifRemember:no}'; |
| 145 | + $result = $serendipity['smarty']->fetch('eval:' . $template_string); |
| 146 | + $this->assertEquals(false, $result); |
| 147 | + } |
66 | 148 |
|
67 | 149 | }
|
0 commit comments