Example #1
0
 * file that was distributed with this source code.
 */
require_once dirname(__FILE__) . '/../../bootstrap/unit.php';
$t = new lime_test(29, new lime_output_color());
class ProjectConfiguration extends sfProjectConfiguration
{
}
class TestConfiguration extends sfApplicationConfiguration
{
    public function getI18NGlobalDirs()
    {
        return array(dirname(__FILE__) . '/fixtures');
    }
}
$configuration = new TestConfiguration('test', true, sfConfig::get('sf_test_cache_dir', sfToolkit::getTmpDir()));
$dispatcher = $configuration->getEventDispatcher();
$cache = new sfNoCache();
// ->initialize()
$t->diag('->initialize()');
$i18n = new sfI18N($configuration, $cache);
$dispatcher->notify(new sfEvent(null, 'user.change_culture', array('culture' => 'fr')));
$t->is($i18n->getCulture(), 'fr', '->initialize() connects to the user.change_culture event');
// ->getCulture() ->setCulture()
$t->diag('->getCulture() ->setCulture()');
$i18n = new sfI18N($configuration, $cache);
$t->is($i18n->getCulture(), 'en', '->getCulture() returns the current culture');
$i18n->setCulture('fr');
$t->is($i18n->getCulture(), 'fr', '->setCulture() sets the current culture');
// ->__()
$t->diag('->__()');
sfConfig::set('sf_charset', 'UTF-8');