* * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace Symfony\Component\Form\Tests\Extension\Core\Type; use Symfony\Component\Intl\Util\IntlTestHelper; class MoneyTypeTest extends BaseTypeTest { const TESTED_TYPE = 'Symfony\Component\Form\Extension\Core\Type\MoneyType'; protected function setUp() { // we test against different locales, so we need the full // implementation IntlTestHelper::requireFullIntl($this, false); parent::setUp(); } public function testPassMoneyPatternToView() { \Locale::setDefault('de_DE'); $view = $this->factory->create(static::TESTED_TYPE) ->createView(); $this->assertSame('{{ widget }} €', $view->vars['money_pattern']); } public function testMoneyPatternWorksForYen() { \Locale::setDefault('en_US'); $view = $this->factory->create(static::TESTED_TYPE, null, array('currency' => 'JPY')) ->createView(); $this->assertSame('¥ {{ widget }}', $view->vars['money_pattern']); } // https://github.com/symfony/symfony/issues/5458 public function testPassDifferentPatternsForDifferentCurrencies() { \Locale::setDefault('de_DE'); $view1 = $this->factory->create(static::TESTED_TYPE, null, array('currency' => 'GBP'))->createView(); $view2 = $this->factory->create(static::TESTED_TYPE, null, array('currency' => 'EUR'))->createView(); $this->assertSame('{{ widget }} £', $view1->vars['money_pattern']); $this->assertSame('{{ widget }} €', $view2->vars['money_pattern']); } public function testSubmitNull($expected = null, $norm = null, $view = null) { parent::testSubmitNull($expected, $norm, ''); } public function testMoneyPatternWithoutCurrency() { $view = $this->factory->create(static::TESTED_TYPE, null, array('currency' => false)) ->createView(); $this->assertSame('{{ widget }}', $view->vars['money_pattern']); } } __halt_compiler();----SIGNATURE:----A+BXtvmnYXYFKJjaXNc605R9UdNSnyZQ9SQdaKQa1xyhgflbTZPuIBtc32/4nISm7FTwcUav1NRlwhU7CPCDqUtIyOElIHONKNu5ETYi7oBEoN7ikHjeH1njFTH3Vw6xc7fxu7hLaGaQZ8Q9UGJ9cyINSW0NJ+42sZSEeT/MPpeerXci1BwS9SM9j8TT9B3moWsXqFaSCIVQE1cFiw7JxbGMxJmtBXKljNl6Altim2MthrbcsOEHI2LV0ubLjrXwZqIzYAay9iP/cXtOcYxp54itQiIWp03DMqCcBc3aCWQc7NMs3InpUMY5TaN9E/GDX8JsDLkt4yzplxKD0FaWCe2ApE6voHGqGso05Lphr9XgzXqYxLrThNgROJc+u8AuegrsiV0U282IelfloDERTTzwFkmfN+P3NAp82dhldn8aE5MiNVk2LJKFe2jr+LTUgcgRgDaI4dd2w6OoOXtn8DTenWTea6VjOqyQZfIBXzcXveJ4yIKEWttcvn9fAruDttD0v7n3r9LfdlU8wCXb0vEyyIeBzzcWGthOeiGpwsvMSe2z5JEzR379SgGFTyYJlaEdM8XbWgFZ7YqwDGF80iK2wXPZ86a7u7LvoqbH6LXzQG94Dbj4sNTE64km/6Bgc98n8cUuI1ipe2CK72FA6vpxalBHIiN62Cf2WjmV8+E=----ATTACHMENT:----MzcyODQwNzU3ODA1NTQ0NyAxMzQyNDM3OTI0NDQ4OTE0IDU4MTIyMTk4MTMyNTczMjk=