4 * This file is part of Twig.
8 * For the full copyright and license information, please view the LICENSE
9 * file that was distributed with this source code.
12 class Twig_Tests_CompilerTest
extends PHPUnit_Framework_TestCase
14 public function testReprNumericValueWithLocale()
16 $compiler = new Twig_Compiler(new Twig_Environment());
18 $locale = setlocale(LC_NUMERIC
, 0);
19 if (false === $locale) {
20 $this->markTestSkipped('Your platform does not support locales.');
23 $required_locales = array('fr_FR.UTF-8', 'fr_FR.UTF8', 'fr_FR.utf-8', 'fr_FR.utf8', 'French_France.1252');
24 if (false === setlocale(LC_ALL
, $required_locales)) {
25 $this->markTestSkipped('Could not set any of required locales: ' . implode(", ", $required_locales));
28 $this->assertEquals('1.2', $compiler->repr(1.2)->getSource());
29 $this->assertContains('fr', strtolower(setlocale(LC_NUMERIC
, 0)));
31 setlocale(LC_ALL
, $locale);