|
|
@@ -56,7 +56,7 @@ class DecimalTypeTest extends TestCase
|
|
|
public function setUp(): void
|
|
|
{
|
|
|
parent::setUp();
|
|
|
- $this->type = TypeFactory::build('decimal');
|
|
|
+ $this->type = new DecimalType();
|
|
|
$this->driver = $this->getMockBuilder(Driver::class)->getMock();
|
|
|
$this->localeString = I18n::getLocale();
|
|
|
$this->numberClass = DecimalType::$numberClass;
|
|
|
@@ -214,23 +214,24 @@ class DecimalTypeTest extends TestCase
|
|
|
*/
|
|
|
public function testMarshalWithLocaleParsing()
|
|
|
{
|
|
|
- I18n::setLocale('de_DE');
|
|
|
$this->type->useLocaleParser();
|
|
|
+
|
|
|
+ I18n::setLocale('de_DE');
|
|
|
$expected = 1234.53;
|
|
|
$result = $this->type->marshal('1.234,53');
|
|
|
$this->assertEquals($expected, $result);
|
|
|
|
|
|
I18n::setLocale('en_US');
|
|
|
- $this->type->useLocaleParser();
|
|
|
$expected = 1234;
|
|
|
$result = $this->type->marshal('1,234');
|
|
|
$this->assertEquals($expected, $result);
|
|
|
|
|
|
I18n::setLocale('pt_BR');
|
|
|
- $this->type->useLocaleParser();
|
|
|
$expected = 5987123.231;
|
|
|
$result = $this->type->marshal('5.987.123,231');
|
|
|
$this->assertEquals($expected, $result);
|
|
|
+
|
|
|
+ $this->type->useLocaleParser(false);
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
@@ -240,12 +241,14 @@ class DecimalTypeTest extends TestCase
|
|
|
*/
|
|
|
public function testMarshalWithLocaleParsingDanish()
|
|
|
{
|
|
|
- I18n::setLocale('da_DK');
|
|
|
-
|
|
|
$this->type->useLocaleParser();
|
|
|
+
|
|
|
+ I18n::setLocale('da_DK');
|
|
|
$expected = '47500';
|
|
|
$result = $this->type->marshal('47.500');
|
|
|
$this->assertSame($expected, $result);
|
|
|
+
|
|
|
+ $this->type->useLocaleParser(false);
|
|
|
}
|
|
|
|
|
|
/**
|