8000 Remove skipping of tests based on ICU data version whenever possible by stof · Pull Request #15412 · symfony/symfony · GitHub
[go: up one dir, main page]

Skip to content

Remove skipping of tests based on ICU data version whenever possible #15412

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Aug 1, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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.
  • Loading branch information
stof committed Jul 30, 2015
commit 7994513e0433bd33a78466154849208c383aab5a
Original file line number Diff line number Diff line change
Expand Up @@ -170,9 +170,11 @@ public function testTransformWrapsIntlErrors()
{
$transformer = new DateTimeToLocalizedStringTransformer();

$this->markTestIncomplete('Checking for intl errors needs to be reimplemented');

// 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);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,14 +20,16 @@ protected function setUp()
{
parent::setUp();

\Locale::setDefault('en');
}

public function testReverseTransform()
{
// Since we test against "de_AT", we need the full implementation
IntlTestHelper::requireFullIntl($this);

\Locale::setDefault('de_AT');
}

public function testReverseTransform()
{
$transformer = new IntegerToLocalizedStringTransformer();

$this->assertEquals(1, $transformer->reverseTransform('1'));
Expand All @@ -45,6 +47,11 @@ public function testReverseTransformEmpty()

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);

$this->assertEquals(1234, $transformer->reverseTransform('1.234,5'));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,18 +16,13 @@

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
IntlTestHelper::requireFullIntl($this);

\Locale::setDefault('de_AT');
}

public function testTransform()
{
$transformer = new MoneyToLocalizedStringTransformer(null, null, null, 100);

$this->assertEquals('1,23', $transformer->transform(123));
Expand All @@ -51,6 +46,11 @@ public function testTransformEmpty()

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);

$this->assertEquals(123, $transformer->reverseTransform('1,23'));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,7 @@ protected function setUp()
{
parent::setUp();

// Since we test against "de_AT", we need the full implementation
IntlTestHelper::requireFullIntl($this);

\Locale::setDefault('de_AT');
\Locale::setDefault('en');
}

public function provideTransformations()
Expand All @@ -44,6 +41,9 @@ public function provideTransformations()
*/
public function testTransform($from, $to, $locale)
{
// Since we test against other locales, we need the full implementation
IntlTestHelper::requireFullIntl($this);

\Locale::setDefault($locale);

$transformer = new NumberToLocalizedStringTransformer();
Expand All @@ -67,6 +67,9 @@ public function provideTransformationsWithGrouping()
*/
public function testTransformWithGrouping($from, $to, $locale)
{
// Since we test against other locales, we need the full implementation
IntlTestHelper::requireFullIntl($this);

\Locale::setDefault($locale);

$transformer = new NumberToLocalizedStringTransformer(null, true);
Expand All @@ -76,6 +79,11 @@ public function testTransformWithGrouping($from, $to, $locale)

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);

$this->assertEquals('1234,50', $transformer->transform(1234.5));
Expand All @@ -84,6 +92,11 @@ public function testTransformWithPrecision()

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);
$this->assertEquals('1234,547', $transformer->transform(1234.547), '->transform() only applies rounding mode if precision set');

Expand All @@ -96,6 +109,9 @@ public function testTransformWithRoundingMode()
*/
public function testReverseTransform($to, $from, $locale)
{
// Since we test against other locales, we need the full implementation
IntlTestHelper::requireFullIntl($this);

\Locale::setDefault($locale);

$transformer = new NumberToLocalizedStringTransformer();
Expand All @@ -108,6 +124,9 @@ public function testReverseTransform($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);

$transformer = new NumberToLocalizedStringTransformer(null, true);
Expand All @@ -122,6 +141,9 @@ public function testReverseTransformWithGroupingAndFixedSpaces()
$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');

$transformer = new NumberToLocalizedStringTransformer(null, true);
Expand All @@ -131,6 +153,11 @@ public function testReverseTransformWithGroupingAndFixedSpaces()

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);

// omit group separator
Expand All @@ -140,6 +167,9 @@ public function testReverseTransformWithGroupingButWithoutGroupSeparator()

public function testDecimalSeparatorMayBeDotIfGroupingSeparatorIsNotDot()
{
// Since we test against other locales, we need the full implementation
IntlTestHelper::requireFullIntl($this);

\Locale::setDefault('fr');
$transformer = new NumberToLocalizedStringTransformer(null, true);

Expand All @@ -157,6 +187,11 @@ public function testDecimalSeparatorMayBeDotIfGroupingSeparatorIsNotDot()
*/
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->reverseTransform('1.234.5');
Expand All @@ -167,13 +202,21 @@ public function testDecimalSeparatorMayNotBeDotIfGroupingSeparatorIsDot()
*/
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->reverseTransform('1234.5');
}

public function testDecimalSeparatorMayBeDotIfGroupingSeparatorIsDotButNoGroupingUsed()
{
// Since we test against other locales, we need the full implementation
IntlTestHelper::requireFullIntl($this);

\Locale::setDefault('fr');
$transformer = new NumberToLocalizedStringTransformer();

Expand All @@ -183,6 +226,9 @@ public function testDecimalSeparatorMayBeDotIfGroupingSeparatorIsDotButNoGroupin

public function testDecimalSeparatorMayBeCommaIfGroupingSeparatorIsNotComma()
{
// Since we test against other locales, we need the full implementation
IntlTestHelper::requireFullIntl($this);

\Locale::setDefault('bg');
$transformer = new NumberToLocalizedStringTransformer(null, true);
10000
Expand All @@ -200,7 +246,6 @@ public function testDecimalSeparatorMayBeCommaIfGroupingSeparatorIsNotComma()
*/
public function testDecimalSeparatorMayNotBeCommaIfGroupingSeparatorIsComma()
{
\Locale::setDefault('en');
$transformer = new NumberToLocalizedStringTransformer(null, true);

$transformer->reverseTransform('1,234,5');
Expand All @@ -211,15 +256,13 @@ public function testDecimalSeparatorMayNotBeCommaIfGroupingSeparatorIsComma()
*/
public function testDecimalSeparatorMayNotBeCommaIfGroupingSeparatorIsCommaWithNoGroupSep()
{
\Locale::setDefault('en');
$transformer = new NumberToLocalizedStringTransformer(null, true);

$transformer->reverseTransform('1234,5');
}

public function testDecimalSeparatorMayBeCommaIfGroupingSeparatorIsCommaButNoGroupingUsed()
{
\Locale::setDefault('en');
$transformer = new NumberToLocalizedStringTransformer();

$this->assertEquals(1234.5, $transformer->reverseTransform('1234,5'));
Expand Down Expand Up @@ -339,6 +382,9 @@ public function testReverseTransformDisallowsCenteredExtraCharactersMultibyte()
$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');

$transformer = new NumberToLocalizedStringTransformer(null, true);
Expand All @@ -356,6 +402,9 @@ public function testReverseTransformIgnoresTrailingSpacesInExceptionMessage()
$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');

$transformer = new NumberToLocalizedStringTransformer(null, true);
Expand Down Expand Up @@ -384,6 +433,9 @@ public function testReverseTransformDisallowsTrailingExtraCharactersMultibyte()
$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');

$transformer = new NumberToLocalizedStringTransformer(null, true);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,7 @@ protected function setUp()
{
parent::setUp();

// Since we test against "de_AT", we need the full implementation
IntlTestHelper::requireFullIntl($this);

\Locale::setDefault('de_AT');
\Locale::setDefault('en');
}

public function testTransform()
Expand Down Expand Up @@ -55,6 +52,11 @@ public function testTransformWithInteger()

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);

$this->assertEquals('12,34', $transformer->transform(0.1234));
Expand Down Expand Up @@ -89,6 +91,11 @@ public function testReverseTransformWithInteger()

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);

$this->assertEquals(0.1234, $transformer->reverseTransform('12,34'));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,12 @@

use Symfony\Component\Form\FormError;
use Symfony\Component\Form\Test\TypeTestCase as TestCase;
use Symfony\Component\Intl\Util\IntlTestHelper;

class DateTimeTypeTest extends TestCase
{
protected function setUp()
{
IntlTestHelper::requireIntl($this);
\Locale::setDefault('en');

parent::setUp();
}
Expand Down Expand Up @@ -271,16 +270,6 @@ public function testInitializeWithDateTime()
$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()
{
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this test is actually a duplicate of another one

$form = $this->factory->create('datetime', null, array(
Expand Down
Loading
0