コード例 #1
0
 public function testDefaultWithoutMbstring()
 {
     Smarty::$_MBSTRING = false;
     $tpl = $this->smarty->createTemplate('eval:{"Infertility unlikely to\\nbe passed on, experts say."|regex_replace:"/[\\r\\t\\n]/":" "}');
     $this->assertEquals("Infertility unlikely to be passed on, experts say.", $this->smarty->fetch($tpl));
     Smarty::$_MBSTRING = true;
 }
コード例 #2
0
 public function testUmlautsWithoutMbstring()
 {
     Smarty::$_MBSTRING = false;
     $result = "two convicts eväde nööse, jury hung.";
     $tpl = $this->smarty->createTemplate('eval:{"Two Convicts Eväde NöÖse, Jury Hung."|lower}');
     $this->assertNotEquals($result, $this->smarty->fetch($tpl));
     Smarty::$_MBSTRING = true;
 }
コード例 #3
0
 public function testUmlautsWithoutMbstring()
 {
     Smarty::$_MBSTRING = false;
     $result = "7";
     $tpl = $this->smarty->createTemplate('eval:{"Dealers Will Hear Cär Talk at Nöön."|count_words}');
     $this->assertNotEquals($result, $this->smarty->fetch($tpl));
     Smarty::$_MBSTRING = true;
 }
コード例 #4
0
 public function testUmlautsWithoutMbstring()
 {
     Smarty::$_MBSTRING = false;
     $result = "IF STRIKE ISN'T SÄTTLED ÜQUICKLY IT MAY LAST A WHILE.";
     $tpl = $this->smarty->createTemplate('eval:{"If Strike isn\'t Sättled ÜQuickly it may Last a While."|upper}');
     $this->assertNotEquals($result, $this->smarty->fetch($tpl));
     Smarty::$_MBSTRING = true;
 }
コード例 #5
0
 public function testUmlautsSpacesWithoutMbstring()
 {
     Smarty::$_MBSTRING = false;
     $result = "33";
     $tpl = $this->smarty->createTemplate('eval:{"Cold Wäve Linked tö Temperatures."|count_characters:true}');
     $this->assertNotEquals($result, $this->smarty->fetch($tpl));
     Smarty::$_MBSTRING = true;
 }
コード例 #6
0
 public function testHtmlallWithoutMbstring()
 {
     Smarty::$_MBSTRING = false;
     $encoded = "aäЗдра><&ääвсствуйте";
     $result = "aテ、ミ厘エム�ミー><&amp;テ、テ、ミイム?ム?ムひイムσケムひオ";
     $tpl = $this->smarty->createTemplate('eval:{"' . $encoded . '"|unescape:"htmlall"}');
     $this->assertEquals($result, $this->smarty->fetch($tpl));
     Smarty::$_MBSTRING = true;
 }
コード例 #7
0
 public function testToUtf32leWithoutMbstring()
 {
     Smarty::$_MBSTRING = false;
     $encoded = "hällö wörld 8";
     $result = mb_convert_encoding($encoded, "UTF-32LE", "UTF-8");
     $tpl = $this->smarty->createTemplate('eval:{"' . $encoded . '"|to_charset:"UTF-32LE"}');
     $this->assertEquals($encoded, $tpl->fetch());
     Smarty::$_MBSTRING = true;
 }
コード例 #8
0
 public function testDefaultWithoutMbstring()
 {
     Smarty::$_MBSTRING = false;
     $tpl = $this->smarty->createTemplate('eval:{"hello world."|count_sentences}');
     $this->assertEquals("1", $this->smarty->fetch($tpl));
     $tpl = $this->smarty->createTemplate('eval:{"hello world. I\'m another? Sentence!"|count_sentences}');
     $this->assertEquals("3", $this->smarty->fetch($tpl));
     $tpl = $this->smarty->createTemplate('eval:{"hello world.wrong"|count_sentences}');
     $this->assertEquals("0", $this->smarty->fetch($tpl));
     Smarty::$_MBSTRING = true;
 }
コード例 #9
0
 public function testNonstdWithoutMbstring()
 {
     Smarty::$_MBSTRING = false;
     $tpl = $this->smarty->createTemplate('eval:{"' . utf8_decode('sma\'rty@»example«.com') . '"|escape:"nonstd"}');
     $this->assertEquals("sma'rty@&#187;example&#171;.com", $this->smarty->fetch($tpl));
     Smarty::$_MBSTRING = true;
 }
コード例 #10
0
 public function testUmlautsWithoutMbstring()
 {
     Smarty::$_MBSTRING = false;
     $result = '<a href="mailto:me+smtpext@example.com?cc=you@example.com,they@example.com&subject=h%C3%A4llo%20w%C3%B6rld" >me+smtpext@example.com</a>';
     $tpl = $this->smarty->createTemplate('eval:{mailto address="*****@*****.**" cc="you@example.com,they@example.com" subject="hällo wörld"}');
     $this->assertEquals($result, $this->smarty->fetch($tpl));
     Smarty::$_MBSTRING = true;
 }
コード例 #11
0
 public function testLinebreaks2WithoutMbstring()
 {
     Smarty::$_MBSTRING = false;
     $tpl = $this->smarty->createTemplate('eval:{"Blind woman
         gets 
         new kidney from dad she hasn\'t seen in years."|wordwrap:30}');
     $this->assertEquals("Blind woman\n            gets \n            new kidney from\ndad she hasn't seen in years.", $this->smarty->fetch($tpl));
     Smarty::$_MBSTRING = true;
 }
コード例 #12
0
 public function testQuotesBeginningWithoutMbstring()
 {
     Smarty::$_MBSTRING = false;
     $tpl = $this->smarty->createTemplate('eval:{"\\"delayed. umlauts\\" foo."|capitalize}');
     $this->assertEquals("\"Delayed. Umlauts\" Foo.", $this->smarty->fetch($tpl));
     $tpl = $this->smarty->createTemplate('eval:{"\'delayed. umlauts\' foo."|capitalize}');
     $this->assertEquals("'Delayed. Umlauts' Foo.", $this->smarty->fetch($tpl));
     Smarty::$_MBSTRING = true;
 }
コード例 #13
0
 public function testMiddleWithoutMbstring()
 {
     Smarty::$_MBSTRING = false;
     $result = 'Two Sisters Re..ckout Counter.';
     $tpl = $this->smarty->createTemplate('eval:{"Two Sisters Reunite after Eighteen Years at Checkout Counter."|truncate:30:"..":true:true}');
     $this->assertEquals($result, $this->smarty->fetch($tpl));
     Smarty::$_MBSTRING = true;
 }
コード例 #14
0
 public function testStyleEmailWithoutMbstring()
 {
     Smarty::$_MBSTRING = false;
     $result = "\n\nThis is foo. This is foo. This is foo. This is foo. This is foo. This is\nfoo.\n\nThis is bar.\n\nbar foo bar foo foo. bar foo bar foo foo. bar foo bar foo foo. bar foo\nbar foo foo. bar foo bar foo foo. bar foo bar foo foo. bar foo bar foo\nfoo.\n\n";
     $tpl = $this->smarty->createTemplate('eval:{textformat style="email"}' . $this->string . '{/textformat}');
     $this->assertEquals($result, $this->smarty->fetch($tpl));
     Smarty::$_MBSTRING = true;
 }