Skip to content

Instantly share code, notes, and snippets.

@manuelkiessling
Created January 23, 2012 10:42
Show Gist options
  • Save manuelkiessling/1662418 to your computer and use it in GitHub Desktop.
Save manuelkiessling/1662418 to your computer and use it in GitHub Desktop.
Symfony issue #3124
<?php
/*
* This file is part of the Symfony package.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Symfony\Tests\Component\Form\Extension\Core\Type;
require_once __DIR__ . '/LocalizedTestCase.php';
require_once __DIR__ . '/../../../../../../../../src/Symfony/Component/Form/Extension/Core/Type/MoneyType.php';
class MoneyTypeTest extends LocalizedTestCase
{
public function testPassMoneyPatternToView()
{
\Locale::setDefault('de_DE');
$form = $this->factory->create('money');
$view = $form->createView();
$this->assertSame('{{ widget }} €', $view->get('money_pattern'));
}
public function testPatternMatchesAllMoneyFormats()
{
\Locale::setDefault('en_US');
$currencies = require_once __DIR__ . '/../../../../../../../../src/Symfony/Component/Locale/Resources/data/stub/curr/en.php';
foreach ($currencies as $currencyISO => $currency) {
$form = $this->factory->create('money', null, array('currency' => $currencyISO));
$view = $form->createView();
$this->assertTrue((bool)strstr($view->get('money_pattern'), $currency['symbol']));
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment