Remove skipping of tests based on ICU data version whenever possible
Many tests being skipped based on the ICU data version don't actually need it. They might be testing code paths not relying on Intl, or not performing assertions on the values depending on the ICU data and so not dependant on the exact ICU version being used.
This commit is contained in:
parent
6b02601e7b
commit
7994513e04
@ -170,9 +170,11 @@ class DateTimeToLocalizedStringTransformerTest extends DateTimeTestCase
|
|||||||
{
|
{
|
||||||
$transformer = new DateTimeToLocalizedStringTransformer();
|
$transformer = new DateTimeToLocalizedStringTransformer();
|
||||||
|
|
||||||
|
$this->markTestIncomplete('Checking for intl errors needs to be reimplemented');
|
||||||
|
|
||||||
// HOW TO REPRODUCE?
|
// HOW TO REPRODUCE?
|
||||||
|
|
||||||
//$this->setExpectedException('Symfony\Component\Form\Extension\Core\DataTransformer\Transdate_formationFailedException');
|
//$this->setExpectedException('Symfony\Component\Form\Extension\Core\DataTransformer\TransformationFailedException');
|
||||||
|
|
||||||
//$transformer->transform(1.5);
|
//$transformer->transform(1.5);
|
||||||
}
|
}
|
||||||
|
@ -20,14 +20,16 @@ class IntegerToLocalizedStringTransformerTest extends \PHPUnit_Framework_TestCas
|
|||||||
{
|
{
|
||||||
parent::setUp();
|
parent::setUp();
|
||||||
|
|
||||||
// Since we test against "de_AT", we need the full implementation
|
\Locale::setDefault('en');
|
||||||
IntlTestHelper::requireFullIntl($this);
|
|
||||||
|
|
||||||
\Locale::setDefault('de_AT');
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testReverseTransform()
|
public function testReverseTransform()
|
||||||
{
|
{
|
||||||
|
// Since we test against "de_AT", we need the full implementation
|
||||||
|
IntlTestHelper::requireFullIntl($this);
|
||||||
|
|
||||||
|
\Locale::setDefault('de_AT');
|
||||||
|
|
||||||
$transformer = new IntegerToLocalizedStringTransformer();
|
$transformer = new IntegerToLocalizedStringTransformer();
|
||||||
|
|
||||||
$this->assertEquals(1, $transformer->reverseTransform('1'));
|
$this->assertEquals(1, $transformer->reverseTransform('1'));
|
||||||
@ -45,6 +47,11 @@ class IntegerToLocalizedStringTransformerTest extends \PHPUnit_Framework_TestCas
|
|||||||
|
|
||||||
public function testReverseTransformWithGrouping()
|
public function testReverseTransformWithGrouping()
|
||||||
{
|
{
|
||||||
|
// Since we test against "de_AT", we need the full implementation
|
||||||
|
IntlTestHelper::requireFullIntl($this);
|
||||||
|
|
||||||
|
\Locale::setDefault('de_AT');
|
||||||
|
|
||||||
$transformer = new IntegerToLocalizedStringTransformer(null, true);
|
$transformer = new IntegerToLocalizedStringTransformer(null, true);
|
||||||
|
|
||||||
$this->assertEquals(1234, $transformer->reverseTransform('1.234,5'));
|
$this->assertEquals(1234, $transformer->reverseTransform('1.234,5'));
|
||||||
|
@ -16,18 +16,13 @@ use Symfony\Component\Intl\Util\IntlTestHelper;
|
|||||||
|
|
||||||
class MoneyToLocalizedStringTransformerTest extends \PHPUnit_Framework_TestCase
|
class MoneyToLocalizedStringTransformerTest extends \PHPUnit_Framework_TestCase
|
||||||
{
|
{
|
||||||
protected function setUp()
|
public function testTransform()
|
||||||
{
|
{
|
||||||
parent::setUp();
|
|
||||||
|
|
||||||
// Since we test against "de_AT", we need the full implementation
|
// Since we test against "de_AT", we need the full implementation
|
||||||
IntlTestHelper::requireFullIntl($this);
|
IntlTestHelper::requireFullIntl($this);
|
||||||
|
|
||||||
\Locale::setDefault('de_AT');
|
\Locale::setDefault('de_AT');
|
||||||
}
|
|
||||||
|
|
||||||
public function testTransform()
|
|
||||||
{
|
|
||||||
$transformer = new MoneyToLocalizedStringTransformer(null, null, null, 100);
|
$transformer = new MoneyToLocalizedStringTransformer(null, null, null, 100);
|
||||||
|
|
||||||
$this->assertEquals('1,23', $transformer->transform(123));
|
$this->assertEquals('1,23', $transformer->transform(123));
|
||||||
@ -51,6 +46,11 @@ class MoneyToLocalizedStringTransformerTest extends \PHPUnit_Framework_TestCase
|
|||||||
|
|
||||||
public function testReverseTransform()
|
public function testReverseTransform()
|
||||||
{
|
{
|
||||||
|
// Since we test against "de_AT", we need the full implementation
|
||||||
|
IntlTestHelper::requireFullIntl($this);
|
||||||
|
|
||||||
|
\Locale::setDefault('de_AT');
|
||||||
|
|
||||||
$transformer = new MoneyToLocalizedStringTransformer(null, null, null, 100);
|
$transformer = new MoneyToLocalizedStringTransformer(null, null, null, 100);
|
||||||
|
|
||||||
$this->assertEquals(123, $transformer->reverseTransform('1,23'));
|
$this->assertEquals(123, $transformer->reverseTransform('1,23'));
|
||||||
|
@ -20,10 +20,7 @@ class NumberToLocalizedStringTransformerTest extends \PHPUnit_Framework_TestCase
|
|||||||
{
|
{
|
||||||
parent::setUp();
|
parent::setUp();
|
||||||
|
|
||||||
// Since we test against "de_AT", we need the full implementation
|
\Locale::setDefault('en');
|
||||||
IntlTestHelper::requireFullIntl($this);
|
|
||||||
|
|
||||||
\Locale::setDefault('de_AT');
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function provideTransformations()
|
public function provideTransformations()
|
||||||
@ -44,6 +41,9 @@ class NumberToLocalizedStringTransformerTest extends \PHPUnit_Framework_TestCase
|
|||||||
*/
|
*/
|
||||||
public function testTransform($from, $to, $locale)
|
public function testTransform($from, $to, $locale)
|
||||||
{
|
{
|
||||||
|
// Since we test against other locales, we need the full implementation
|
||||||
|
IntlTestHelper::requireFullIntl($this);
|
||||||
|
|
||||||
\Locale::setDefault($locale);
|
\Locale::setDefault($locale);
|
||||||
|
|
||||||
$transformer = new NumberToLocalizedStringTransformer();
|
$transformer = new NumberToLocalizedStringTransformer();
|
||||||
@ -67,6 +67,9 @@ class NumberToLocalizedStringTransformerTest extends \PHPUnit_Framework_TestCase
|
|||||||
*/
|
*/
|
||||||
public function testTransformWithGrouping($from, $to, $locale)
|
public function testTransformWithGrouping($from, $to, $locale)
|
||||||
{
|
{
|
||||||
|
// Since we test against other locales, we need the full implementation
|
||||||
|
IntlTestHelper::requireFullIntl($this);
|
||||||
|
|
||||||
\Locale::setDefault($locale);
|
\Locale::setDefault($locale);
|
||||||
|
|
||||||
$transformer = new NumberToLocalizedStringTransformer(null, true);
|
$transformer = new NumberToLocalizedStringTransformer(null, true);
|
||||||
@ -76,6 +79,11 @@ class NumberToLocalizedStringTransformerTest extends \PHPUnit_Framework_TestCase
|
|||||||
|
|
||||||
public function testTransformWithPrecision()
|
public function testTransformWithPrecision()
|
||||||
{
|
{
|
||||||
|
// Since we test against "de_AT", we need the full implementation
|
||||||
|
IntlTestHelper::requireFullIntl($this);
|
||||||
|
|
||||||
|
\Locale::setDefault('de_AT');
|
||||||
|
|
||||||
$transformer = new NumberToLocalizedStringTransformer(2);
|
$transformer = new NumberToLocalizedStringTransformer(2);
|
||||||
|
|
||||||
$this->assertEquals('1234,50', $transformer->transform(1234.5));
|
$this->assertEquals('1234,50', $transformer->transform(1234.5));
|
||||||
@ -84,6 +92,11 @@ class NumberToLocalizedStringTransformerTest extends \PHPUnit_Framework_TestCase
|
|||||||
|
|
||||||
public function testTransformWithRoundingMode()
|
public function testTransformWithRoundingMode()
|
||||||
{
|
{
|
||||||
|
// Since we test against "de_AT", we need the full implementation
|
||||||
|
IntlTestHelper::requireFullIntl($this);
|
||||||
|
|
||||||
|
\Locale::setDefault('de_AT');
|
||||||
|
|
||||||
$transformer = new NumberToLocalizedStringTransformer(null, null, NumberToLocalizedStringTransformer::ROUND_DOWN);
|
$transformer = new NumberToLocalizedStringTransformer(null, null, NumberToLocalizedStringTransformer::ROUND_DOWN);
|
||||||
$this->assertEquals('1234,547', $transformer->transform(1234.547), '->transform() only applies rounding mode if precision set');
|
$this->assertEquals('1234,547', $transformer->transform(1234.547), '->transform() only applies rounding mode if precision set');
|
||||||
|
|
||||||
@ -96,6 +109,9 @@ class NumberToLocalizedStringTransformerTest extends \PHPUnit_Framework_TestCase
|
|||||||
*/
|
*/
|
||||||
public function testReverseTransform($to, $from, $locale)
|
public function testReverseTransform($to, $from, $locale)
|
||||||
{
|
{
|
||||||
|
// Since we test against other locales, we need the full implementation
|
||||||
|
IntlTestHelper::requireFullIntl($this);
|
||||||
|
|
||||||
\Locale::setDefault($locale);
|
\Locale::setDefault($locale);
|
||||||
|
|
||||||
$transformer = new NumberToLocalizedStringTransformer();
|
$transformer = new NumberToLocalizedStringTransformer();
|
||||||
@ -108,6 +124,9 @@ class NumberToLocalizedStringTransformerTest extends \PHPUnit_Framework_TestCase
|
|||||||
*/
|
*/
|
||||||
public function testReverseTransformWithGrouping($to, $from, $locale)
|
public function testReverseTransformWithGrouping($to, $from, $locale)
|
||||||
{
|
{
|
||||||
|
// Since we test against other locales, we need the full implementation
|
||||||
|
IntlTestHelper::requireFullIntl($this);
|
||||||
|
|
||||||
\Locale::setDefault($locale);
|
\Locale::setDefault($locale);
|
||||||
|
|
||||||
$transformer = new NumberToLocalizedStringTransformer(null, true);
|
$transformer = new NumberToLocalizedStringTransformer(null, true);
|
||||||
@ -122,6 +141,9 @@ class NumberToLocalizedStringTransformerTest extends \PHPUnit_Framework_TestCase
|
|||||||
$this->markTestSkipped('The "mbstring" extension is required for this test.');
|
$this->markTestSkipped('The "mbstring" extension is required for this test.');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Since we test against other locales, we need the full implementation
|
||||||
|
IntlTestHelper::requireFullIntl($this);
|
||||||
|
|
||||||
\Locale::setDefault('ru');
|
\Locale::setDefault('ru');
|
||||||
|
|
||||||
$transformer = new NumberToLocalizedStringTransformer(null, true);
|
$transformer = new NumberToLocalizedStringTransformer(null, true);
|
||||||
@ -131,6 +153,11 @@ class NumberToLocalizedStringTransformerTest extends \PHPUnit_Framework_TestCase
|
|||||||
|
|
||||||
public function testReverseTransformWithGroupingButWithoutGroupSeparator()
|
public function testReverseTransformWithGroupingButWithoutGroupSeparator()
|
||||||
{
|
{
|
||||||
|
// Since we test against "de_AT", we need the full implementation
|
||||||
|
IntlTestHelper::requireFullIntl($this);
|
||||||
|
|
||||||
|
\Locale::setDefault('de_AT');
|
||||||
|
|
||||||
$transformer = new NumberToLocalizedStringTransformer(null, true);
|
$transformer = new NumberToLocalizedStringTransformer(null, true);
|
||||||
|
|
||||||
// omit group separator
|
// omit group separator
|
||||||
@ -140,6 +167,9 @@ class NumberToLocalizedStringTransformerTest extends \PHPUnit_Framework_TestCase
|
|||||||
|
|
||||||
public function testDecimalSeparatorMayBeDotIfGroupingSeparatorIsNotDot()
|
public function testDecimalSeparatorMayBeDotIfGroupingSeparatorIsNotDot()
|
||||||
{
|
{
|
||||||
|
// Since we test against other locales, we need the full implementation
|
||||||
|
IntlTestHelper::requireFullIntl($this);
|
||||||
|
|
||||||
\Locale::setDefault('fr');
|
\Locale::setDefault('fr');
|
||||||
$transformer = new NumberToLocalizedStringTransformer(null, true);
|
$transformer = new NumberToLocalizedStringTransformer(null, true);
|
||||||
|
|
||||||
@ -157,6 +187,11 @@ class NumberToLocalizedStringTransformerTest extends \PHPUnit_Framework_TestCase
|
|||||||
*/
|
*/
|
||||||
public function testDecimalSeparatorMayNotBeDotIfGroupingSeparatorIsDot()
|
public function testDecimalSeparatorMayNotBeDotIfGroupingSeparatorIsDot()
|
||||||
{
|
{
|
||||||
|
// Since we test against "de_AT", we need the full implementation
|
||||||
|
IntlTestHelper::requireFullIntl($this);
|
||||||
|
|
||||||
|
\Locale::setDefault('de_AT');
|
||||||
|
|
||||||
$transformer = new NumberToLocalizedStringTransformer(null, true);
|
$transformer = new NumberToLocalizedStringTransformer(null, true);
|
||||||
|
|
||||||
$transformer->reverseTransform('1.234.5');
|
$transformer->reverseTransform('1.234.5');
|
||||||
@ -167,6 +202,11 @@ class NumberToLocalizedStringTransformerTest extends \PHPUnit_Framework_TestCase
|
|||||||
*/
|
*/
|
||||||
public function testDecimalSeparatorMayNotBeDotIfGroupingSeparatorIsDotWithNoGroupSep()
|
public function testDecimalSeparatorMayNotBeDotIfGroupingSeparatorIsDotWithNoGroupSep()
|
||||||
{
|
{
|
||||||
|
// Since we test against "de_AT", we need the full implementation
|
||||||
|
IntlTestHelper::requireFullIntl($this);
|
||||||
|
|
||||||
|
\Locale::setDefault('de_AT');
|
||||||
|
|
||||||
$transformer = new NumberToLocalizedStringTransformer(null, true);
|
$transformer = new NumberToLocalizedStringTransformer(null, true);
|
||||||
|
|
||||||
$transformer->reverseTransform('1234.5');
|
$transformer->reverseTransform('1234.5');
|
||||||
@ -174,6 +214,9 @@ class NumberToLocalizedStringTransformerTest extends \PHPUnit_Framework_TestCase
|
|||||||
|
|
||||||
public function testDecimalSeparatorMayBeDotIfGroupingSeparatorIsDotButNoGroupingUsed()
|
public function testDecimalSeparatorMayBeDotIfGroupingSeparatorIsDotButNoGroupingUsed()
|
||||||
{
|
{
|
||||||
|
// Since we test against other locales, we need the full implementation
|
||||||
|
IntlTestHelper::requireFullIntl($this);
|
||||||
|
|
||||||
\Locale::setDefault('fr');
|
\Locale::setDefault('fr');
|
||||||
$transformer = new NumberToLocalizedStringTransformer();
|
$transformer = new NumberToLocalizedStringTransformer();
|
||||||
|
|
||||||
@ -183,6 +226,9 @@ class NumberToLocalizedStringTransformerTest extends \PHPUnit_Framework_TestCase
|
|||||||
|
|
||||||
public function testDecimalSeparatorMayBeCommaIfGroupingSeparatorIsNotComma()
|
public function testDecimalSeparatorMayBeCommaIfGroupingSeparatorIsNotComma()
|
||||||
{
|
{
|
||||||
|
// Since we test against other locales, we need the full implementation
|
||||||
|
IntlTestHelper::requireFullIntl($this);
|
||||||
|
|
||||||
\Locale::setDefault('bg');
|
\Locale::setDefault('bg');
|
||||||
$transformer = new NumberToLocalizedStringTransformer(null, true);
|
$transformer = new NumberToLocalizedStringTransformer(null, true);
|
||||||
|
|
||||||
@ -200,7 +246,6 @@ class NumberToLocalizedStringTransformerTest extends \PHPUnit_Framework_TestCase
|
|||||||
*/
|
*/
|
||||||
public function testDecimalSeparatorMayNotBeCommaIfGroupingSeparatorIsComma()
|
public function testDecimalSeparatorMayNotBeCommaIfGroupingSeparatorIsComma()
|
||||||
{
|
{
|
||||||
\Locale::setDefault('en');
|
|
||||||
$transformer = new NumberToLocalizedStringTransformer(null, true);
|
$transformer = new NumberToLocalizedStringTransformer(null, true);
|
||||||
|
|
||||||
$transformer->reverseTransform('1,234,5');
|
$transformer->reverseTransform('1,234,5');
|
||||||
@ -211,7 +256,6 @@ class NumberToLocalizedStringTransformerTest extends \PHPUnit_Framework_TestCase
|
|||||||
*/
|
*/
|
||||||
public function testDecimalSeparatorMayNotBeCommaIfGroupingSeparatorIsCommaWithNoGroupSep()
|
public function testDecimalSeparatorMayNotBeCommaIfGroupingSeparatorIsCommaWithNoGroupSep()
|
||||||
{
|
{
|
||||||
\Locale::setDefault('en');
|
|
||||||
$transformer = new NumberToLocalizedStringTransformer(null, true);
|
$transformer = new NumberToLocalizedStringTransformer(null, true);
|
||||||
|
|
||||||
$transformer->reverseTransform('1234,5');
|
$transformer->reverseTransform('1234,5');
|
||||||
@ -219,7 +263,6 @@ class NumberToLocalizedStringTransformerTest extends \PHPUnit_Framework_TestCase
|
|||||||
|
|
||||||
public function testDecimalSeparatorMayBeCommaIfGroupingSeparatorIsCommaButNoGroupingUsed()
|
public function testDecimalSeparatorMayBeCommaIfGroupingSeparatorIsCommaButNoGroupingUsed()
|
||||||
{
|
{
|
||||||
\Locale::setDefault('en');
|
|
||||||
$transformer = new NumberToLocalizedStringTransformer();
|
$transformer = new NumberToLocalizedStringTransformer();
|
||||||
|
|
||||||
$this->assertEquals(1234.5, $transformer->reverseTransform('1234,5'));
|
$this->assertEquals(1234.5, $transformer->reverseTransform('1234,5'));
|
||||||
@ -339,6 +382,9 @@ class NumberToLocalizedStringTransformerTest extends \PHPUnit_Framework_TestCase
|
|||||||
$this->markTestSkipped('The "mbstring" extension is required for this test.');
|
$this->markTestSkipped('The "mbstring" extension is required for this test.');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Since we test against other locales, we need the full implementation
|
||||||
|
IntlTestHelper::requireFullIntl($this);
|
||||||
|
|
||||||
\Locale::setDefault('ru');
|
\Locale::setDefault('ru');
|
||||||
|
|
||||||
$transformer = new NumberToLocalizedStringTransformer(null, true);
|
$transformer = new NumberToLocalizedStringTransformer(null, true);
|
||||||
@ -356,6 +402,9 @@ class NumberToLocalizedStringTransformerTest extends \PHPUnit_Framework_TestCase
|
|||||||
$this->markTestSkipped('The "mbstring" extension is required for this test.');
|
$this->markTestSkipped('The "mbstring" extension is required for this test.');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Since we test against other locales, we need the full implementation
|
||||||
|
IntlTestHelper::requireFullIntl($this);
|
||||||
|
|
||||||
\Locale::setDefault('ru');
|
\Locale::setDefault('ru');
|
||||||
|
|
||||||
$transformer = new NumberToLocalizedStringTransformer(null, true);
|
$transformer = new NumberToLocalizedStringTransformer(null, true);
|
||||||
@ -384,6 +433,9 @@ class NumberToLocalizedStringTransformerTest extends \PHPUnit_Framework_TestCase
|
|||||||
$this->markTestSkipped('The "mbstring" extension is required for this test.');
|
$this->markTestSkipped('The "mbstring" extension is required for this test.');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Since we test against other locales, we need the full implementation
|
||||||
|
IntlTestHelper::requireFullIntl($this);
|
||||||
|
|
||||||
\Locale::setDefault('ru');
|
\Locale::setDefault('ru');
|
||||||
|
|
||||||
$transformer = new NumberToLocalizedStringTransformer(null, true);
|
$transformer = new NumberToLocalizedStringTransformer(null, true);
|
||||||
|
@ -20,10 +20,7 @@ class PercentToLocalizedStringTransformerTest extends \PHPUnit_Framework_TestCas
|
|||||||
{
|
{
|
||||||
parent::setUp();
|
parent::setUp();
|
||||||
|
|
||||||
// Since we test against "de_AT", we need the full implementation
|
\Locale::setDefault('en');
|
||||||
IntlTestHelper::requireFullIntl($this);
|
|
||||||
|
|
||||||
\Locale::setDefault('de_AT');
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testTransform()
|
public function testTransform()
|
||||||
@ -55,6 +52,11 @@ class PercentToLocalizedStringTransformerTest extends \PHPUnit_Framework_TestCas
|
|||||||
|
|
||||||
public function testTransformWithPrecision()
|
public function testTransformWithPrecision()
|
||||||
{
|
{
|
||||||
|
// Since we test against "de_AT", we need the full implementation
|
||||||
|
IntlTestHelper::requireFullIntl($this);
|
||||||
|
|
||||||
|
\Locale::setDefault('de_AT');
|
||||||
|
|
||||||
$transformer = new PercentToLocalizedStringTransformer(2);
|
$transformer = new PercentToLocalizedStringTransformer(2);
|
||||||
|
|
||||||
$this->assertEquals('12,34', $transformer->transform(0.1234));
|
$this->assertEquals('12,34', $transformer->transform(0.1234));
|
||||||
@ -89,6 +91,11 @@ class PercentToLocalizedStringTransformerTest extends \PHPUnit_Framework_TestCas
|
|||||||
|
|
||||||
public function testReverseTransformWithPrecision()
|
public function testReverseTransformWithPrecision()
|
||||||
{
|
{
|
||||||
|
// Since we test against "de_AT", we need the full implementation
|
||||||
|
IntlTestHelper::requireFullIntl($this);
|
||||||
|
|
||||||
|
\Locale::setDefault('de_AT');
|
||||||
|
|
||||||
$transformer = new PercentToLocalizedStringTransformer(2);
|
$transformer = new PercentToLocalizedStringTransformer(2);
|
||||||
|
|
||||||
$this->assertEquals(0.1234, $transformer->reverseTransform('12,34'));
|
$this->assertEquals(0.1234, $transformer->reverseTransform('12,34'));
|
||||||
|
@ -13,13 +13,12 @@ namespace Symfony\Component\Form\Tests\Extension\Core\Type;
|
|||||||
|
|
||||||
use Symfony\Component\Form\FormError;
|
use Symfony\Component\Form\FormError;
|
||||||
use Symfony\Component\Form\Test\TypeTestCase as TestCase;
|
use Symfony\Component\Form\Test\TypeTestCase as TestCase;
|
||||||
use Symfony\Component\Intl\Util\IntlTestHelper;
|
|
||||||
|
|
||||||
class DateTimeTypeTest extends TestCase
|
class DateTimeTypeTest extends TestCase
|
||||||
{
|
{
|
||||||
protected function setUp()
|
protected function setUp()
|
||||||
{
|
{
|
||||||
IntlTestHelper::requireIntl($this);
|
\Locale::setDefault('en');
|
||||||
|
|
||||||
parent::setUp();
|
parent::setUp();
|
||||||
}
|
}
|
||||||
@ -271,16 +270,6 @@ class DateTimeTypeTest extends TestCase
|
|||||||
$this->factory->create('datetime', new \DateTime());
|
$this->factory->create('datetime', new \DateTime());
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testSingleTextWidgetShouldUseTheRightInputType()
|
|
||||||
{
|
|
||||||
$form = $this->factory->create('datetime', null, array(
|
|
||||||
'widget' => 'single_text',
|
|
||||||
));
|
|
||||||
|
|
||||||
$view = $form->createView();
|
|
||||||
$this->assertEquals('datetime', $view->vars['type']);
|
|
||||||
}
|
|
||||||
|
|
||||||
public function testPassDefaultEmptyValueToViewIfNotRequired()
|
public function testPassDefaultEmptyValueToViewIfNotRequired()
|
||||||
{
|
{
|
||||||
$form = $this->factory->create('datetime', null, array(
|
$form = $this->factory->create('datetime', null, array(
|
||||||
|
@ -22,10 +22,7 @@ class DateTypeTest extends TestCase
|
|||||||
{
|
{
|
||||||
parent::setUp();
|
parent::setUp();
|
||||||
|
|
||||||
// we test against "de_AT", so we need the full implementation
|
\Locale::setDefault('en');
|
||||||
IntlTestHelper::requireFullIntl($this);
|
|
||||||
|
|
||||||
\Locale::setDefault('de_AT');
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -65,6 +62,11 @@ class DateTypeTest extends TestCase
|
|||||||
|
|
||||||
public function testSubmitFromSingleTextDateTime()
|
public function testSubmitFromSingleTextDateTime()
|
||||||
{
|
{
|
||||||
|
// we test against "de_AT", so we need the full implementation
|
||||||
|
IntlTestHelper::requireFullIntl($this);
|
||||||
|
|
||||||
|
\Locale::setDefault('de_AT');
|
||||||
|
|
||||||
$form = $this->factory->create('date', null, array(
|
$form = $this->factory->create('date', null, array(
|
||||||
'format' => \IntlDateFormatter::MEDIUM,
|
'format' => \IntlDateFormatter::MEDIUM,
|
||||||
'model_timezone' => 'UTC',
|
'model_timezone' => 'UTC',
|
||||||
@ -81,6 +83,11 @@ class DateTypeTest extends TestCase
|
|||||||
|
|
||||||
public function testSubmitFromSingleTextString()
|
public function testSubmitFromSingleTextString()
|
||||||
{
|
{
|
||||||
|
// we test against "de_AT", so we need the full implementation
|
||||||
|
IntlTestHelper::requireFullIntl($this);
|
||||||
|
|
||||||
|
\Locale::setDefault('de_AT');
|
||||||
|
|
||||||
$form = $this->factory->create('date', null, array(
|
$form = $this->factory->create('date', null, array(
|
||||||
'format' => \IntlDateFormatter::MEDIUM,
|
'format' => \IntlDateFormatter::MEDIUM,
|
||||||
'model_timezone' => 'UTC',
|
'model_timezone' => 'UTC',
|
||||||
@ -97,6 +104,11 @@ class DateTypeTest extends TestCase
|
|||||||
|
|
||||||
public function testSubmitFromSingleTextTimestamp()
|
public function testSubmitFromSingleTextTimestamp()
|
||||||
{
|
{
|
||||||
|
// we test against "de_AT", so we need the full implementation
|
||||||
|
IntlTestHelper::requireFullIntl($this);
|
||||||
|
|
||||||
|
\Locale::setDefault('de_AT');
|
||||||
|
|
||||||
$form = $this->factory->create('date', null, array(
|
$form = $this->factory->create('date', null, array(
|
||||||
'format' => \IntlDateFormatter::MEDIUM,
|
'format' => \IntlDateFormatter::MEDIUM,
|
||||||
'model_timezone' => 'UTC',
|
'model_timezone' => 'UTC',
|
||||||
@ -115,6 +127,11 @@ class DateTypeTest extends TestCase
|
|||||||
|
|
||||||
public function testSubmitFromSingleTextRaw()
|
public function testSubmitFromSingleTextRaw()
|
||||||
{
|
{
|
||||||
|
// we test against "de_AT", so we need the full implementation
|
||||||
|
IntlTestHelper::requireFullIntl($this);
|
||||||
|
|
||||||
|
\Locale::setDefault('de_AT');
|
||||||
|
|
||||||
$form = $this->factory->create('date', null, array(
|
$form = $this->factory->create('date', null, array(
|
||||||
'format' => \IntlDateFormatter::MEDIUM,
|
'format' => \IntlDateFormatter::MEDIUM,
|
||||||
'model_timezone' => 'UTC',
|
'model_timezone' => 'UTC',
|
||||||
@ -373,6 +390,11 @@ class DateTypeTest extends TestCase
|
|||||||
|
|
||||||
public function testSetDataWithDifferentTimezones()
|
public function testSetDataWithDifferentTimezones()
|
||||||
{
|
{
|
||||||
|
// we test against "de_AT", so we need the full implementation
|
||||||
|
IntlTestHelper::requireFullIntl($this);
|
||||||
|
|
||||||
|
\Locale::setDefault('de_AT');
|
||||||
|
|
||||||
$form = $this->factory->create('date', null, array(
|
$form = $this->factory->create('date', null, array(
|
||||||
'format' => \IntlDateFormatter::MEDIUM,
|
'format' => \IntlDateFormatter::MEDIUM,
|
||||||
'model_timezone' => 'America/New_York',
|
'model_timezone' => 'America/New_York',
|
||||||
@ -388,6 +410,11 @@ class DateTypeTest extends TestCase
|
|||||||
|
|
||||||
public function testSetDataWithDifferentTimezonesDateTime()
|
public function testSetDataWithDifferentTimezonesDateTime()
|
||||||
{
|
{
|
||||||
|
// we test against "de_AT", so we need the full implementation
|
||||||
|
IntlTestHelper::requireFullIntl($this);
|
||||||
|
|
||||||
|
\Locale::setDefault('de_AT');
|
||||||
|
|
||||||
$form = $this->factory->create('date', null, array(
|
$form = $this->factory->create('date', null, array(
|
||||||
'format' => \IntlDateFormatter::MEDIUM,
|
'format' => \IntlDateFormatter::MEDIUM,
|
||||||
'model_timezone' => 'America/New_York',
|
'model_timezone' => 'America/New_York',
|
||||||
@ -422,18 +449,24 @@ class DateTypeTest extends TestCase
|
|||||||
{
|
{
|
||||||
$form = $this->factory->create('date', null, array(
|
$form = $this->factory->create('date', null, array(
|
||||||
'months' => array(6, 7),
|
'months' => array(6, 7),
|
||||||
|
'format' => \IntlDateFormatter::SHORT,
|
||||||
));
|
));
|
||||||
|
|
||||||
$view = $form->createView();
|
$view = $form->createView();
|
||||||
|
|
||||||
$this->assertEquals(array(
|
$this->assertEquals(array(
|
||||||
new ChoiceView('6', '6', '06'),
|
new ChoiceView(6, '6', '06'),
|
||||||
new ChoiceView('7', '7', '07'),
|
new ChoiceView(7, '7', '07'),
|
||||||
), $view['month']->vars['choices']);
|
), $view['month']->vars['choices']);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testMonthsOptionShortFormat()
|
public function testMonthsOptionShortFormat()
|
||||||
{
|
{
|
||||||
|
// we test against "de_AT", so we need the full implementation
|
||||||
|
IntlTestHelper::requireFullIntl($this);
|
||||||
|
|
||||||
|
\Locale::setDefault('de_AT');
|
||||||
|
|
||||||
$form = $this->factory->create('date', null, array(
|
$form = $this->factory->create('date', null, array(
|
||||||
'months' => array(1, 4),
|
'months' => array(1, 4),
|
||||||
'format' => 'dd.MMM.yy',
|
'format' => 'dd.MMM.yy',
|
||||||
@ -442,13 +475,18 @@ class DateTypeTest extends TestCase
|
|||||||
$view = $form->createView();
|
$view = $form->createView();
|
||||||
|
|
||||||
$this->assertEquals(array(
|
$this->assertEquals(array(
|
||||||
new ChoiceView('1', '1', 'Jän'),
|
new ChoiceView(1, '1', 'Jän'),
|
||||||
new ChoiceView('4', '4', 'Apr.'),
|
new ChoiceView(4, '4', 'Apr.'),
|
||||||
), $view['month']->vars['choices']);
|
), $view['month']->vars['choices']);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testMonthsOptionLongFormat()
|
public function testMonthsOptionLongFormat()
|
||||||
{
|
{
|
||||||
|
// we test against "de_AT", so we need the full implementation
|
||||||
|
IntlTestHelper::requireFullIntl($this);
|
||||||
|
|
||||||
|
\Locale::setDefault('de_AT');
|
||||||
|
|
||||||
$form = $this->factory->create('date', null, array(
|
$form = $this->factory->create('date', null, array(
|
||||||
'months' => array(1, 4),
|
'months' => array(1, 4),
|
||||||
'format' => 'dd.MMMM.yy',
|
'format' => 'dd.MMMM.yy',
|
||||||
@ -457,13 +495,18 @@ class DateTypeTest extends TestCase
|
|||||||
$view = $form->createView();
|
$view = $form->createView();
|
||||||
|
|
||||||
$this->assertEquals(array(
|
$this->assertEquals(array(
|
||||||
new ChoiceView('1', '1', 'Jänner'),
|
new ChoiceView(1, '1', 'Jänner'),
|
||||||
new ChoiceView('4', '4', 'April'),
|
new ChoiceView(4, '4', 'April'),
|
||||||
), $view['month']->vars['choices']);
|
), $view['month']->vars['choices']);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testMonthsOptionLongFormatWithDifferentTimezone()
|
public function testMonthsOptionLongFormatWithDifferentTimezone()
|
||||||
{
|
{
|
||||||
|
// we test against "de_AT", so we need the full implementation
|
||||||
|
IntlTestHelper::requireFullIntl($this);
|
||||||
|
|
||||||
|
\Locale::setDefault('de_AT');
|
||||||
|
|
||||||
$form = $this->factory->create('date', null, array(
|
$form = $this->factory->create('date', null, array(
|
||||||
'months' => array(1, 4),
|
'months' => array(1, 4),
|
||||||
'format' => 'dd.MMMM.yy',
|
'format' => 'dd.MMMM.yy',
|
||||||
@ -472,8 +515,8 @@ class DateTypeTest extends TestCase
|
|||||||
$view = $form->createView();
|
$view = $form->createView();
|
||||||
|
|
||||||
$this->assertEquals(array(
|
$this->assertEquals(array(
|
||||||
new ChoiceView('1', '1', 'Jänner'),
|
new ChoiceView(1, '1', 'Jänner'),
|
||||||
new ChoiceView('4', '4', 'April'),
|
new ChoiceView(4, '4', 'April'),
|
||||||
), $view['month']->vars['choices']);
|
), $view['month']->vars['choices']);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -486,8 +529,8 @@ class DateTypeTest extends TestCase
|
|||||||
$view = $form->createView();
|
$view = $form->createView();
|
||||||
|
|
||||||
$this->assertEquals(array(
|
$this->assertEquals(array(
|
||||||
new ChoiceView('6', '6', '06'),
|
new ChoiceView(6, '6', '06'),
|
||||||
new ChoiceView('7', '7', '07'),
|
new ChoiceView(7, '7', '07'),
|
||||||
), $view['day']->vars['choices']);
|
), $view['day']->vars['choices']);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -565,6 +608,11 @@ class DateTypeTest extends TestCase
|
|||||||
|
|
||||||
public function testPassDatePatternToView()
|
public function testPassDatePatternToView()
|
||||||
{
|
{
|
||||||
|
// we test against "de_AT", so we need the full implementation
|
||||||
|
IntlTestHelper::requireFullIntl($this);
|
||||||
|
|
||||||
|
\Locale::setDefault('de_AT');
|
||||||
|
|
||||||
$form = $this->factory->create('date');
|
$form = $this->factory->create('date');
|
||||||
$view = $form->createView();
|
$view = $form->createView();
|
||||||
|
|
||||||
@ -573,6 +621,11 @@ class DateTypeTest extends TestCase
|
|||||||
|
|
||||||
public function testPassDatePatternToViewDifferentFormat()
|
public function testPassDatePatternToViewDifferentFormat()
|
||||||
{
|
{
|
||||||
|
// we test against "de_AT", so we need the full implementation
|
||||||
|
IntlTestHelper::requireFullIntl($this);
|
||||||
|
|
||||||
|
\Locale::setDefault('de_AT');
|
||||||
|
|
||||||
$form = $this->factory->create('date', null, array(
|
$form = $this->factory->create('date', null, array(
|
||||||
'format' => \IntlDateFormatter::LONG,
|
'format' => \IntlDateFormatter::LONG,
|
||||||
));
|
));
|
||||||
@ -616,6 +669,9 @@ class DateTypeTest extends TestCase
|
|||||||
|
|
||||||
public function testDatePatternFormatWithQuotedStrings()
|
public function testDatePatternFormatWithQuotedStrings()
|
||||||
{
|
{
|
||||||
|
// we test against "es_ES", so we need the full implementation
|
||||||
|
IntlTestHelper::requireFullIntl($this);
|
||||||
|
|
||||||
\Locale::setDefault('es_ES');
|
\Locale::setDefault('es_ES');
|
||||||
|
|
||||||
$form = $this->factory->create('date', null, array(
|
$form = $this->factory->create('date', null, array(
|
||||||
@ -646,16 +702,6 @@ class DateTypeTest extends TestCase
|
|||||||
$this->factory->create('date', new \DateTime());
|
$this->factory->create('date', new \DateTime());
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testSingleTextWidgetShouldUseTheRightInputType()
|
|
||||||
{
|
|
||||||
$form = $this->factory->create('date', null, array(
|
|
||||||
'widget' => 'single_text',
|
|
||||||
));
|
|
||||||
|
|
||||||
$view = $form->createView();
|
|
||||||
$this->assertEquals('date', $view->vars['type']);
|
|
||||||
}
|
|
||||||
|
|
||||||
public function testPassDefaultEmptyValueToViewIfNotRequired()
|
public function testPassDefaultEmptyValueToViewIfNotRequired()
|
||||||
{
|
{
|
||||||
$form = $this->factory->create('date', null, array(
|
$form = $this->factory->create('date', null, array(
|
||||||
|
@ -14,17 +14,9 @@ namespace Symfony\Component\Form\Tests\Extension\Core\Type;
|
|||||||
use Symfony\Component\Form\Extension\Core\View\ChoiceView;
|
use Symfony\Component\Form\Extension\Core\View\ChoiceView;
|
||||||
use Symfony\Component\Form\FormError;
|
use Symfony\Component\Form\FormError;
|
||||||
use Symfony\Component\Form\Test\TypeTestCase as TestCase;
|
use Symfony\Component\Form\Test\TypeTestCase as TestCase;
|
||||||
use Symfony\Component\Intl\Util\IntlTestHelper;
|
|
||||||
|
|
||||||
class TimeTypeTest extends TestCase
|
class TimeTypeTest extends TestCase
|
||||||
{
|
{
|
||||||
protected function setUp()
|
|
||||||
{
|
|
||||||
IntlTestHelper::requireIntl($this);
|
|
||||||
|
|
||||||
parent::setUp();
|
|
||||||
}
|
|
||||||
|
|
||||||
public function testSubmitDateTime()
|
public function testSubmitDateTime()
|
||||||
{
|
{
|
||||||
$form = $this->factory->create('time', null, array(
|
$form = $this->factory->create('time', null, array(
|
||||||
|
@ -12,7 +12,7 @@
|
|||||||
namespace Symfony\Component\Intl\Tests\Data\Bundle\Reader;
|
namespace Symfony\Component\Intl\Tests\Data\Bundle\Reader;
|
||||||
|
|
||||||
use Symfony\Component\Intl\Data\Bundle\Reader\IntlBundleReader;
|
use Symfony\Component\Intl\Data\Bundle\Reader\IntlBundleReader;
|
||||||
use Symfony\Component\Intl\Util\IntlTestHelper;
|
use Symfony\Component\Intl\Intl;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author Bernhard Schussek <bschussek@gmail.com>
|
* @author Bernhard Schussek <bschussek@gmail.com>
|
||||||
@ -26,7 +26,10 @@ class IntlBundleReaderTest extends \PHPUnit_Framework_TestCase
|
|||||||
|
|
||||||
protected function setUp()
|
protected function setUp()
|
||||||
{
|
{
|
||||||
IntlTestHelper::requireFullIntl($this);
|
// We only run tests if the intl extension is loaded...
|
||||||
|
if (!Intl::isExtensionLoaded()) {
|
||||||
|
$this->markTestSkipped('The intl extension is not available.');
|
||||||
|
}
|
||||||
|
|
||||||
$this->reader = new IntlBundleReader();
|
$this->reader = new IntlBundleReader();
|
||||||
}
|
}
|
||||||
@ -52,6 +55,14 @@ class IntlBundleReaderTest extends \PHPUnit_Framework_TestCase
|
|||||||
|
|
||||||
public function testReadDoesNotFollowFallback()
|
public function testReadDoesNotFollowFallback()
|
||||||
{
|
{
|
||||||
|
if (PHP_VERSION_ID < 50307 || PHP_VERSION_ID === 50400) {
|
||||||
|
$this->markTestSkipped('ResourceBundle handles disabling fallback properly only as of PHP 5.3.7 and 5.4.1.');
|
||||||
|
}
|
||||||
|
|
||||||
|
if (defined('HHVM_VERSION')) {
|
||||||
|
$this->markTestSkipped('ResourceBundle does not support disabling fallback properly on HHVM.');
|
||||||
|
}
|
||||||
|
|
||||||
// "ro_MD" -> "ro"
|
// "ro_MD" -> "ro"
|
||||||
$data = $this->reader->read(__DIR__.'/Fixtures/res', 'ro_MD');
|
$data = $this->reader->read(__DIR__.'/Fixtures/res', 'ro_MD');
|
||||||
|
|
||||||
@ -64,6 +75,14 @@ class IntlBundleReaderTest extends \PHPUnit_Framework_TestCase
|
|||||||
|
|
||||||
public function testReadDoesNotFollowFallbackAlias()
|
public function testReadDoesNotFollowFallbackAlias()
|
||||||
{
|
{
|
||||||
|
if (PHP_VERSION_ID < 50307 || PHP_VERSION_ID === 50400) {
|
||||||
|
$this->markTestSkipped('ResourceBundle handles disabling fallback properly only as of PHP 5.3.7 and 5.4.1.');
|
||||||
|
}
|
||||||
|
|
||||||
|
if (defined('HHVM_VERSION')) {
|
||||||
|
$this->markTestSkipped('ResourceBundle does not support disabling fallback properly on HHVM.');
|
||||||
|
}
|
||||||
|
|
||||||
// "mo" = "ro_MD" -> "ro"
|
// "mo" = "ro_MD" -> "ro"
|
||||||
$data = $this->reader->read(__DIR__.'/Fixtures/res', 'mo');
|
$data = $this->reader->read(__DIR__.'/Fixtures/res', 'mo');
|
||||||
|
|
||||||
|
@ -13,7 +13,7 @@ namespace Symfony\Component\Intl\Tests\Data\Bundle\Writer;
|
|||||||
|
|
||||||
use Symfony\Component\Filesystem\Filesystem;
|
use Symfony\Component\Filesystem\Filesystem;
|
||||||
use Symfony\Component\Intl\Data\Bundle\Writer\JsonBundleWriter;
|
use Symfony\Component\Intl\Data\Bundle\Writer\JsonBundleWriter;
|
||||||
use Symfony\Component\Intl\Util\IntlTestHelper;
|
use Symfony\Component\Intl\Intl;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author Bernhard Schussek <bschussek@gmail.com>
|
* @author Bernhard Schussek <bschussek@gmail.com>
|
||||||
@ -74,7 +74,10 @@ class JsonBundleWriterTest extends \PHPUnit_Framework_TestCase
|
|||||||
|
|
||||||
public function testWriteResourceBundle()
|
public function testWriteResourceBundle()
|
||||||
{
|
{
|
||||||
IntlTestHelper::requireFullIntl($this);
|
// We only run tests if the intl extension is loaded...
|
||||||
|
if (!Intl::isExtensionLoaded()) {
|
||||||
|
$this->markTestSkipped('The intl extension is not available.');
|
||||||
|
}
|
||||||
|
|
||||||
$bundle = new \ResourceBundle('rb', __DIR__.'/Fixtures', false);
|
$bundle = new \ResourceBundle('rb', __DIR__.'/Fixtures', false);
|
||||||
|
|
||||||
|
@ -13,7 +13,7 @@ namespace Symfony\Component\Intl\Tests\Data\Bundle\Writer;
|
|||||||
|
|
||||||
use Symfony\Component\Filesystem\Filesystem;
|
use Symfony\Component\Filesystem\Filesystem;
|
||||||
use Symfony\Component\Intl\Data\Bundle\Writer\PhpBundleWriter;
|
use Symfony\Component\Intl\Data\Bundle\Writer\PhpBundleWriter;
|
||||||
use Symfony\Component\Intl\Util\IntlTestHelper;
|
use Symfony\Component\Intl\Intl;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author Bernhard Schussek <bschussek@gmail.com>
|
* @author Bernhard Schussek <bschussek@gmail.com>
|
||||||
@ -66,7 +66,14 @@ class PhpBundleWriterTest extends \PHPUnit_Framework_TestCase
|
|||||||
|
|
||||||
public function testWriteResourceBundle()
|
public function testWriteResourceBundle()
|
||||||
{
|
{
|
||||||
IntlTestHelper::requireFullIntl($this);
|
// We only run tests if the intl extension is loaded...
|
||||||
|
if (!Intl::isExtensionLoaded()) {
|
||||||
|
$this->markTestSkipped('The intl extension is not available.');
|
||||||
|
}
|
||||||
|
|
||||||
|
if (PHP_VERSION_ID < 50315 || (PHP_VERSION_ID >= 50400 && PHP_VERSION_ID < 50404)) {
|
||||||
|
$this->markTestSkipped('ResourceBundle implements Traversable only as of PHP 5.3.15 and 5.4.4');
|
||||||
|
}
|
||||||
|
|
||||||
$bundle = new \ResourceBundle('rb', __DIR__.'/Fixtures', false);
|
$bundle = new \ResourceBundle('rb', __DIR__.'/Fixtures', false);
|
||||||
|
|
||||||
|
@ -56,8 +56,6 @@ abstract class AbstractNumberFormatterTest extends \PHPUnit_Framework_TestCase
|
|||||||
*/
|
*/
|
||||||
public function testFormatCurrencyWithCurrencyStyle($value, $currency, $expected)
|
public function testFormatCurrencyWithCurrencyStyle($value, $currency, $expected)
|
||||||
{
|
{
|
||||||
IntlTestHelper::requireFullIntl($this);
|
|
||||||
|
|
||||||
$formatter = $this->getNumberFormatter('en', NumberFormatter::CURRENCY);
|
$formatter = $this->getNumberFormatter('en', NumberFormatter::CURRENCY);
|
||||||
$this->assertEquals($expected, $formatter->formatCurrency($value, $currency));
|
$this->assertEquals($expected, $formatter->formatCurrency($value, $currency));
|
||||||
}
|
}
|
||||||
@ -84,8 +82,6 @@ abstract class AbstractNumberFormatterTest extends \PHPUnit_Framework_TestCase
|
|||||||
*/
|
*/
|
||||||
public function testFormatCurrencyWithCurrencyStyleCostaRicanColonsRounding($value, $currency, $symbol, $expected)
|
public function testFormatCurrencyWithCurrencyStyleCostaRicanColonsRounding($value, $currency, $symbol, $expected)
|
||||||
{
|
{
|
||||||
IntlTestHelper::requireFullIntl($this);
|
|
||||||
|
|
||||||
$formatter = $this->getNumberFormatter('en', NumberFormatter::CURRENCY);
|
$formatter = $this->getNumberFormatter('en', NumberFormatter::CURRENCY);
|
||||||
$this->assertEquals(sprintf($expected, $symbol), $formatter->formatCurrency($value, $currency));
|
$this->assertEquals(sprintf($expected, $symbol), $formatter->formatCurrency($value, $currency));
|
||||||
}
|
}
|
||||||
@ -104,8 +100,6 @@ abstract class AbstractNumberFormatterTest extends \PHPUnit_Framework_TestCase
|
|||||||
*/
|
*/
|
||||||
public function testFormatCurrencyWithCurrencyStyleBrazilianRealRounding($value, $currency, $symbol, $expected)
|
public function testFormatCurrencyWithCurrencyStyleBrazilianRealRounding($value, $currency, $symbol, $expected)
|
||||||
{
|
{
|
||||||
IntlTestHelper::requireFullIntl($this);
|
|
||||||
|
|
||||||
$formatter = $this->getNumberFormatter('en', NumberFormatter::CURRENCY);
|
$formatter = $this->getNumberFormatter('en', NumberFormatter::CURRENCY);
|
||||||
$this->assertEquals(sprintf($expected, $symbol), $formatter->formatCurrency($value, $currency));
|
$this->assertEquals(sprintf($expected, $symbol), $formatter->formatCurrency($value, $currency));
|
||||||
}
|
}
|
||||||
@ -133,8 +127,6 @@ abstract class AbstractNumberFormatterTest extends \PHPUnit_Framework_TestCase
|
|||||||
*/
|
*/
|
||||||
public function testFormatCurrencyWithCurrencyStyleSwissRounding($value, $currency, $symbol, $expected)
|
public function testFormatCurrencyWithCurrencyStyleSwissRounding($value, $currency, $symbol, $expected)
|
||||||
{
|
{
|
||||||
IntlTestHelper::requireFullIntl($this);
|
|
||||||
|
|
||||||
$formatter = $this->getNumberFormatter('en', NumberFormatter::CURRENCY);
|
$formatter = $this->getNumberFormatter('en', NumberFormatter::CURRENCY);
|
||||||
$this->assertEquals(sprintf($expected, $symbol), $formatter->formatCurrency($value, $currency));
|
$this->assertEquals(sprintf($expected, $symbol), $formatter->formatCurrency($value, $currency));
|
||||||
}
|
}
|
||||||
|
@ -13,7 +13,6 @@ namespace Symfony\Component\Intl\Tests\NumberFormatter;
|
|||||||
|
|
||||||
use Symfony\Component\Intl\Globals\IntlGlobals;
|
use Symfony\Component\Intl\Globals\IntlGlobals;
|
||||||
use Symfony\Component\Intl\NumberFormatter\NumberFormatter;
|
use Symfony\Component\Intl\NumberFormatter\NumberFormatter;
|
||||||
use Symfony\Component\Intl\Util\IntlTestHelper;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Note that there are some values written like -2147483647 - 1. This is the lower 32bit int max and is a known
|
* Note that there are some values written like -2147483647 - 1. This is the lower 32bit int max and is a known
|
||||||
@ -21,13 +20,6 @@ use Symfony\Component\Intl\Util\IntlTestHelper;
|
|||||||
*/
|
*/
|
||||||
class NumberFormatterTest extends AbstractNumberFormatterTest
|
class NumberFormatterTest extends AbstractNumberFormatterTest
|
||||||
{
|
{
|
||||||
protected function setUp()
|
|
||||||
{
|
|
||||||
IntlTestHelper::requireIntl($this);
|
|
||||||
|
|
||||||
parent::setUp();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @expectedException \Symfony\Component\Intl\Exception\MethodArgumentValueNotImplementedException
|
* @expectedException \Symfony\Component\Intl\Exception\MethodArgumentValueNotImplementedException
|
||||||
*/
|
*/
|
||||||
|
@ -11,7 +11,6 @@
|
|||||||
|
|
||||||
namespace Symfony\Component\Locale\Tests;
|
namespace Symfony\Component\Locale\Tests;
|
||||||
|
|
||||||
use Symfony\Component\Intl\Util\IntlTestHelper;
|
|
||||||
use Symfony\Component\Locale\Locale;
|
use Symfony\Component\Locale\Locale;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -25,8 +24,7 @@ class LocaleTest extends \PHPUnit_Framework_TestCase
|
|||||||
{
|
{
|
||||||
$this->iniSet('error_reporting', -1 & ~E_USER_DEPRECATED);
|
$this->iniSet('error_reporting', -1 & ~E_USER_DEPRECATED);
|
||||||
|
|
||||||
// Locale extends \Locale, so intl must be present
|
\Locale::setDefault('en');
|
||||||
IntlTestHelper::requireIntl($this);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testGetDisplayCountries()
|
public function testGetDisplayCountries()
|
||||||
|
@ -11,7 +11,6 @@
|
|||||||
|
|
||||||
namespace Symfony\Component\Locale\Tests\Stub;
|
namespace Symfony\Component\Locale\Tests\Stub;
|
||||||
|
|
||||||
use Symfony\Component\Intl\Util\IntlTestHelper;
|
|
||||||
use Symfony\Component\Locale\Stub\StubLocale;
|
use Symfony\Component\Locale\Stub\StubLocale;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -22,9 +21,6 @@ class StubLocaleTest extends \PHPUnit_Framework_TestCase
|
|||||||
protected function setUp()
|
protected function setUp()
|
||||||
{
|
{
|
||||||
$this->iniSet('error_reporting', -1 & ~E_USER_DEPRECATED);
|
$this->iniSet('error_reporting', -1 & ~E_USER_DEPRECATED);
|
||||||
|
|
||||||
// Locale extends \Locale, so intl must be present
|
|
||||||
IntlTestHelper::requireIntl($this);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testGetCurrenciesData()
|
public function testGetCurrenciesData()
|
||||||
|
@ -17,13 +17,6 @@ use Symfony\Component\Validator\Constraints\CountryValidator;
|
|||||||
|
|
||||||
class CountryValidatorTest extends AbstractConstraintValidatorTest
|
class CountryValidatorTest extends AbstractConstraintValidatorTest
|
||||||
{
|
{
|
||||||
protected function setUp()
|
|
||||||
{
|
|
||||||
IntlTestHelper::requireFullIntl($this);
|
|
||||||
|
|
||||||
parent::setUp();
|
|
||||||
}
|
|
||||||
|
|
||||||
protected function createValidator()
|
protected function createValidator()
|
||||||
{
|
{
|
||||||
return new CountryValidator();
|
return new CountryValidator();
|
||||||
|
@ -17,13 +17,6 @@ use Symfony\Component\Validator\Constraints\CurrencyValidator;
|
|||||||
|
|
||||||
class CurrencyValidatorTest extends AbstractConstraintValidatorTest
|
class CurrencyValidatorTest extends AbstractConstraintValidatorTest
|
||||||
{
|
{
|
||||||
protected function setUp()
|
|
||||||
{
|
|
||||||
IntlTestHelper::requireFullIntl($this);
|
|
||||||
|
|
||||||
parent::setUp();
|
|
||||||
}
|
|
||||||
|
|
||||||
protected function createValidator()
|
protected function createValidator()
|
||||||
{
|
{
|
||||||
return new CurrencyValidator();
|
return new CurrencyValidator();
|
||||||
@ -66,6 +59,8 @@ class CurrencyValidatorTest extends AbstractConstraintValidatorTest
|
|||||||
**/
|
**/
|
||||||
public function testValidCurrenciesWithCountrySpecificLocale($currency)
|
public function testValidCurrenciesWithCountrySpecificLocale($currency)
|
||||||
{
|
{
|
||||||
|
IntlTestHelper::requireFullIntl($this);
|
||||||
|
|
||||||
\Locale::setDefault('en_GB');
|
\Locale::setDefault('en_GB');
|
||||||
|
|
||||||
$this->validator->validate($currency, new Currency());
|
$this->validator->validate($currency, new Currency());
|
||||||
|
@ -22,13 +22,6 @@ class LanguageValidatorTest extends AbstractConstraintValidatorTest
|
|||||||
return new LanguageValidator();
|
return new LanguageValidator();
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function setUp()
|
|
||||||
{
|
|
||||||
IntlTestHelper::requireFullIntl($this);
|
|
||||||
|
|
||||||
parent::setUp();
|
|
||||||
}
|
|
||||||
|
|
||||||
public function testNullIsValid()
|
public function testNullIsValid()
|
||||||
{
|
{
|
||||||
$this->validator->validate(null, new Language());
|
$this->validator->validate(null, new Language());
|
||||||
@ -96,6 +89,8 @@ class LanguageValidatorTest extends AbstractConstraintValidatorTest
|
|||||||
|
|
||||||
public function testValidateUsingCountrySpecificLocale()
|
public function testValidateUsingCountrySpecificLocale()
|
||||||
{
|
{
|
||||||
|
IntlTestHelper::requireFullIntl($this);
|
||||||
|
|
||||||
\Locale::setDefault('fr_FR');
|
\Locale::setDefault('fr_FR');
|
||||||
$existingLanguage = 'en';
|
$existingLanguage = 'en';
|
||||||
|
|
||||||
|
@ -11,7 +11,6 @@
|
|||||||
|
|
||||||
namespace Symfony\Component\Validator\Tests\Constraints;
|
namespace Symfony\Component\Validator\Tests\Constraints;
|
||||||
|
|
||||||
use Symfony\Component\Intl\Util\IntlTestHelper;
|
|
||||||
use Symfony\Component\Validator\Constraints\Locale;
|
use Symfony\Component\Validator\Constraints\Locale;
|
||||||
use Symfony\Component\Validator\Constraints\LocaleValidator;
|
use Symfony\Component\Validator\Constraints\LocaleValidator;
|
||||||
|
|
||||||
@ -22,13 +21,6 @@ class LocaleValidatorTest extends AbstractConstraintValidatorTest
|
|||||||
return new LocaleValidator();
|
return new LocaleValidator();
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function setUp()
|
|
||||||
{
|
|
||||||
IntlTestHelper::requireIntl($this);
|
|
||||||
|
|
||||||
parent::setUp();
|
|
||||||
}
|
|
||||||
|
|
||||||
public function testNullIsValid()
|
public function testNullIsValid()
|
||||||
{
|
{
|
||||||
$this->validator->validate(null, new Locale());
|
$this->validator->validate(null, new Locale());
|
||||||
|
Reference in New Issue
Block a user