tests/CompilerTest.php
90931b0a
 <?php
 
2119e60c
 namespace Twig\Tests;
 
90931b0a
 /*
  * This file is part of Twig.
  *
  * (c) Fabien Potencier
  *
  * For the full copyright and license information, please view the LICENSE
  * file that was distributed with this source code.
  */
 
34bdab4d
 use PHPUnit\Framework\TestCase;
90d579e4
 use Twig\Compiler;
 use Twig\Environment;
 use Twig\Loader\LoaderInterface;
 
34bdab4d
 class CompilerTest extends TestCase
90931b0a
 {
     public function testReprNumericValueWithLocale()
     {
656c295e
         $compiler = new Compiler(new Environment($this->createMock(LoaderInterface::class)));
90931b0a
 
         $locale = setlocale(LC_NUMERIC, 0);
         if (false === $locale) {
             $this->markTestSkipped('Your platform does not support locales.');
         }
 
5c55243d
         $required_locales = ['fr_FR.UTF-8', 'fr_FR.UTF8', 'fr_FR.utf-8', 'fr_FR.utf8', 'French_France.1252'];
3e4c6ab3
         if (false === setlocale(LC_NUMERIC, $required_locales)) {
b0c41d42
             $this->markTestSkipped('Could not set any of required locales: '.implode(', ', $required_locales));
90931b0a
         }
 
         $this->assertEquals('1.2', $compiler->repr(1.2)->getSource());
b776e41f
         $this->assertStringContainsString('fr', strtolower(setlocale(LC_NUMERIC, 0)));
90931b0a
 
3e4c6ab3
         setlocale(LC_NUMERIC, $locale);
90931b0a
     }
 }