mirror of
https://github.com/php-flasher/php-flasher.git
synced 2026-03-31 15:07:47 +01:00
469e826007
wip wip
41 lines
1.0 KiB
PHP
41 lines
1.0 KiB
PHP
<?php
|
|
|
|
/*
|
|
* This file is part of the PHPFlasher package.
|
|
* (c) Younes KHOUBZA <younes.khoubza@gmail.com>
|
|
*/
|
|
|
|
namespace Flasher\Tests\Symfony;
|
|
|
|
use Flasher\Symfony\Translation\Translator;
|
|
|
|
class TranslatorTest extends TestCase
|
|
{
|
|
/**
|
|
* @return void
|
|
*/
|
|
public function testInitialState()
|
|
{
|
|
$translator = $this->getTranslator();
|
|
|
|
$this->assertEquals('en', $translator->getLocale());
|
|
}
|
|
|
|
/**
|
|
* @return Translator
|
|
*/
|
|
private function getTranslator()
|
|
{
|
|
$messageFormatter = null;
|
|
if (class_exists('Symfony\Component\Translation\Formatter\MessageFormatter')) {
|
|
$messageFormatter = new \Symfony\Component\Translation\Formatter\MessageFormatter();
|
|
} elseif (class_exists('Symfony\Component\Translation\MessageSelector')) {
|
|
$messageFormatter = new \Symfony\Component\Translation\MessageSelector();
|
|
}
|
|
|
|
$symfonyTranslator = new \Symfony\Component\Translation\Translator('en', $messageFormatter);
|
|
|
|
return new Translator($symfonyTranslator);
|
|
}
|
|
}
|