From: Fabien Potencier Date: Sat, 28 Jan 2012 16:12:21 +0000 (+0100) Subject: added some unit tests for the reverse filter when charset is not UTF-8 X-Git-Url: http://git.silmor.de/gitweb/?a=commitdiff_plain;h=0eadacf6bac9b86cc77a56fd6f76ff6ac919919a;p=web%2Fkonrad%2Ftwig.git added some unit tests for the reverse filter when charset is not UTF-8 --- diff --git a/test/Twig/Tests/Extension/CoreTest.php b/test/Twig/Tests/Extension/CoreTest.php index 45f90bb..ac27dff 100644 --- a/test/Twig/Tests/Extension/CoreTest.php +++ b/test/Twig/Tests/Extension/CoreTest.php @@ -92,4 +92,15 @@ class Twig_Tests_Extension_CoreTest extends PHPUnit_Framework_TestCase $this->assertTrue(in_array(twig_convert_encoding($rand, 'UTF-8', 'ISO-8859-1'), array('Ä', 'é'), true)); } } + + public function testReverseFilterOnNonUTF8String() + { + $twig = new Twig_Environment(); + $twig->setCharset('ISO-8859-1'); + + $input = twig_convert_encoding('Äé', 'ISO-8859-1', 'UTF-8'); + $output = twig_convert_encoding(twig_reverse_filter($twig, $input), 'UTF-8', 'ISO-8859-1'); + + $this->assertEquals($output, 'éÄ'); + } }