Skip to content

Commit 767be63

Browse files
Merge branch '4.0'
* 4.0: (25 commits) [Form] fix how form type is referenced in test fix merge [Console] Fix console tests by adding the missing condition [Translation] Fix InvalidArgumentException when using untranslated plural forms from .po files Fixed exit code with non-integer throwable code [HttpFoundation] Support 0 bit netmask in IPv6 () [DI] Impossible to set an environment variable and then an array as container parameter [Process] remove false-positive BC breaking exception on Windows Tweaking class not found autowiring error [LDAP] added missing dots at the end of some exception messages. [TwigBridge] Add missing dev requirement for workflow fixed #25440 empty lines don't count for indent detection Set `width: auto` on WebProfiler toolbar's reset. [Lock] Fix incorrect phpdoc [Process] Dont rely on putenv(), it fails on ZTS PHP [HttpKernel] detect deprecations thrown by container initialization during tests [HttpKernel] Fix logging of post-terminate errors/exceptions [DI] Add context to service-not-found exceptions thrown by service locators [Debug] Fix catching fatal errors in case of nested error handlers ...
2 parents e4cf458 + 8e67f1b commit 767be63

File tree

2 files changed

+28
-1
lines changed

2 files changed

+28
-1
lines changed

Tests/AbstractBootstrap3LayoutTest.php

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1914,6 +1914,25 @@ public function testMoney()
19141914
);
19151915
}
19161916

1917+
public function testMoneyWithoutCurrency()
1918+
{
1919+
$form = $this->factory->createNamed('name', 'Symfony\Component\Form\Extension\Core\Type\MoneyType', 1234.56, array(
1920+
'currency' => false,
1921+
));
1922+
1923+
$this->assertWidgetMatchesXpath($form->createView(), array('id' => 'my&id', 'attr' => array('class' => 'my&class')),
1924+
'/input
1925+
[@id="my&id"]
1926+
[@type="text"]
1927+
[@name="name"]
1928+
[@class="my&class form-control"]
1929+
[@value="1234.56"]
1930+
[not(preceding-sibling::*)]
1931+
[not(following-sibling::*)]
1932+
'
1933+
);
1934+
}
1935+
19171936
public function testNumber()
19181937
{
19191938
$form = $this->factory->createNamed('name', 'Symfony\Component\Form\Extension\Core\Type\NumberType', 1234.56);

Tests/Extension/Core/Type/MoneyTypeTest.php

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ public function testMoneyPatternWorksForYen()
4343
$view = $this->factory->create(static::TESTED_TYPE, null, array('currency' => 'JPY'))
4444
->createView();
4545

46-
$this->assertTrue((bool) strstr($view->vars['money_pattern'], '¥'));
46+
$this->assertSame('¥ {{ widget }}', $view->vars['money_pattern']);
4747
}
4848

4949
// https://github.com/symfony/symfony/issues/5458
@@ -62,4 +62,12 @@ public function testSubmitNull($expected = null, $norm = null, $view = null)
6262
{
6363
parent::testSubmitNull($expected, $norm, '');
6464
}
65+
66+
public function testMoneyPatternWithoutCurrency()
67+
{
68+
$view = $this->factory->create(static::TESTED_TYPE, null, array('currency' => false))
69+
->createView();
70+
71+
$this->assertSame('{{ widget }}', $view->vars['money_pattern']);
72+
}
6573
}

0 commit comments

Comments
 (0)