Skip to content

Commit 124a114

Browse files
committed
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.
1 parent 10d41a4 commit 124a114

8 files changed

+160
-65
lines changed

Tests/Extension/Core/DataTransformer/DateTimeToLocalizedStringTransformerTest.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -170,9 +170,11 @@ public function testTransformWrapsIntlErrors()
170170
{
171171
$transformer = new DateTimeToLocalizedStringTransformer();
172172

173+
$this->markTestIncomplete('Checking for intl errors needs to be reimplemented');
174+
173175
// HOW TO REPRODUCE?
174176
175-
//$this->setExpectedException('Symfony\Component\Form\Extension\Core\DataTransformer\Transdate_formationFailedException');
177+
//$this->setExpectedException('Symfony\Component\Form\Extension\Core\DataTransformer\TransformationFailedException');
176178

177179
//$transformer->transform(1.5);
178180
}

Tests/Extension/Core/DataTransformer/IntegerToLocalizedStringTransformerTest.php

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,14 +20,16 @@ protected function setUp()
2020
{
2121
parent::setUp();
2222

23+
\Locale::setDefault('en');
24+
}
25+
26+
public function testReverseTransform()
27+
{
2328
// Since we test against "de_AT", we need the full implementation
2429
IntlTestHelper::requireFullIntl($this);
2530

2631
\Locale::setDefault('de_AT');
27-
}
2832

29-
public function testReverseTransform()
30-
{
3133
$transformer = new IntegerToLocalizedStringTransformer();
3234

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

4648
public function testReverseTransformWithGrouping()
4749
{
50+
// Since we test against "de_AT", we need the full implementation
51+
IntlTestHelper::requireFullIntl($this);
52+
53+
\Locale::setDefault('de_AT');
54+
4855
$transformer = new IntegerToLocalizedStringTransformer(null, true);
4956

5057
$this->assertEquals(1234, $transformer->reverseTransform('1.234,5'));

Tests/Extension/Core/DataTransformer/MoneyToLocalizedStringTransformerTest.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -16,18 +16,13 @@
1616

1717
class MoneyToLocalizedStringTransformerTest extends \PHPUnit_Framework_TestCase
1818
{
19-
protected function setUp()
19+
public function testTransform()
2020
{
21-
parent::setUp();
22-
2321
// Since we test against "de_AT", we need the full implementation
2422
IntlTestHelper::requireFullIntl($this);
2523

2624
\Locale::setDefault('de_AT');
27-
}
2825

29-
public function testTransform()
30-
{
3126
$transformer = new MoneyToLocalizedStringTransformer(null, null, null, 100);
3227

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

5247
public function testReverseTransform()
5348
{
49+
// Since we test against "de_AT", we need the full implementation
50+
IntlTestHelper::requireFullIntl($this);
51+
52+
\Locale::setDefault('de_AT');
53+
5454
$transformer = new MoneyToLocalizedStringTransformer(null, null, null, 100);
5555

5656
$this->assertEquals(123, $transformer->reverseTransform('1,23'));

Tests/Extension/Core/DataTransformer/NumberToLocalizedStringTransformerTest.php

Lines changed: 59 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,7 @@ protected function setUp()
2020
{
2121
parent::setUp();
2222

23-
// Since we test against "de_AT", we need the full implementation
24-
IntlTestHelper::requireFullIntl($this);
25-
26-
\Locale::setDefault('de_AT');
23+
\Locale::setDefault('en');
2724
}
2825

2926
public function provideTransformations()
@@ -44,6 +41,9 @@ public function provideTransformations()
4441
*/
4542
public function testTransform($from, $to, $locale)
4643
{
44+
// Since we test against other locales, we need the full implementation
45+
IntlTestHelper::requireFullIntl($this);
46+
4747
\Locale::setDefault($locale);
4848

4949
$transformer = new NumberToLocalizedStringTransformer();
@@ -67,6 +67,9 @@ public function provideTransformationsWithGrouping()
6767
*/
6868
public function testTransformWithGrouping($from, $to, $locale)
6969
{
70+
// Since we test against other locales, we need the full implementation
71+
IntlTestHelper::requireFullIntl($this);
72+
7073
\Locale::setDefault($locale);
7174

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

7780
public function testTransformWithPrecision()
7881
{
82+
// Since we test against "de_AT", we need the full implementation
83+
IntlTestHelper::requireFullIntl($this);
84+
85+
\Locale::setDefault('de_AT');
86+
7987
$transformer = new NumberToLocalizedStringTransformer(2);
8088

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

8593
public function testTransformWithRoundingMode()
8694
{
95+
// Since we test against "de_AT", we need the full implementation
96+
IntlTestHelper::requireFullIntl($this);
97+
98+
\Locale::setDefault('de_AT');
99+
87100
$transformer = new NumberToLocalizedStringTransformer(null, null, NumberToLocalizedStringTransformer::ROUND_DOWN);
88101
$this->assertEquals('1234,547', $transformer->transform(1234.547), '->transform() only applies rounding mode if precision set');
89102

@@ -96,6 +109,9 @@ public function testTransformWithRoundingMode()
96109
*/
97110
public function testReverseTransform($to, $from, $locale)
98111
{
112+
// Since we test against other locales, we need the full implementation
113+
IntlTestHelper::requireFullIntl($this);
114+
99115
\Locale::setDefault($locale);
100116

101117
$transformer = new NumberToLocalizedStringTransformer();
@@ -108,6 +124,9 @@ public function testReverseTransform($to, $from, $locale)
108124
*/
109125
public function testReverseTransformWithGrouping($to, $from, $locale)
110126
{
127+
// Since we test against other locales, we need the full implementation
128+
IntlTestHelper::requireFullIntl($this);
129+
111130
\Locale::setDefault($locale);
112131

113132
$transformer = new NumberToLocalizedStringTransformer(null, true);
@@ -122,6 +141,9 @@ public function testReverseTransformWithGroupingAndFixedSpaces()
122141
$this->markTestSkipped('The "mbstring" extension is required for this test.');
123142
}
124143

144+
// Since we test against other locales, we need the full implementation
145+
IntlTestHelper::requireFullIntl($this);
146+
125147
\Locale::setDefault('ru');
126148

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

132154
public function testReverseTransformWithGroupingButWithoutGroupSeparator()
133155
{
156+
// Since we test against "de_AT", we need the full implementation
157+
IntlTestHelper::requireFullIntl($this);
158+
159+
\Locale::setDefault('de_AT');
160+
134161
$transformer = new NumberToLocalizedStringTransformer(null, true);
135162

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

141168
public function testDecimalSeparatorMayBeDotIfGroupingSeparatorIsNotDot()
142169
{
170+
// Since we test against other locales, we need the full implementation
171+
IntlTestHelper::requireFullIntl($this);
172+
143173
\Locale::setDefault('fr');
144174
$transformer = new NumberToLocalizedStringTransformer(null, true);
145175

@@ -157,6 +187,11 @@ public function testDecimalSeparatorMayBeDotIfGroupingSeparatorIsNotDot()
157187
*/
158188
public function testDecimalSeparatorMayNotBeDotIfGroupingSeparatorIsDot()
159189
{
190+
// Since we test against "de_AT", we need the full implementation
191+
IntlTestHelper::requireFullIntl($this);
192+
193+
\Locale::setDefault('de_AT');
194+
160195
$transformer = new NumberToLocalizedStringTransformer(null, true);
161196

162197
$transformer->reverseTransform('1.234.5');
@@ -167,13 +202,21 @@ public function testDecimalSeparatorMayNotBeDotIfGroupingSeparatorIsDot()
167202
*/
168203
public function testDecimalSeparatorMayNotBeDotIfGroupingSeparatorIsDotWithNoGroupSep()
169204
{
205+
// Since we test against "de_AT", we need the full implementation
206+
IntlTestHelper::requireFullIntl($this);
207+
208+
\Locale::setDefault('de_AT');
209+
170210
$transformer = new NumberToLocalizedStringTransformer(null, true);
171211

172212
$transformer->reverseTransform('1234.5');
173213
}
174214

175215
public function testDecimalSeparatorMayBeDotIfGroupingSeparatorIsDotButNoGroupingUsed()
176216
{
217+
// Since we test against other locales, we need the full implementation
218+
IntlTestHelper::requireFullIntl($this);
219+
177220
\Locale::setDefault('fr');
178221
$transformer = new NumberToLocalizedStringTransformer();
179222

@@ -183,6 +226,9 @@ public function testDecimalSeparatorMayBeDotIfGroupingSeparatorIsDotButNoGroupin
183226

184227
public function testDecimalSeparatorMayBeCommaIfGroupingSeparatorIsNotComma()
185228
{
229+
// Since we test against other locales, we need the full implementation
230+
IntlTestHelper::requireFullIntl($this);
231+
186232
\Locale::setDefault('bg');
187233
$transformer = new NumberToLocalizedStringTransformer(null, true);
188234

@@ -200,7 +246,6 @@ public function testDecimalSeparatorMayBeCommaIfGroupingSeparatorIsNotComma()
200246
*/
201247
public function testDecimalSeparatorMayNotBeCommaIfGroupingSeparatorIsComma()
202248
{
203-
\Locale::setDefault('en');
204249
$transformer = new NumberToLocalizedStringTransformer(null, true);
205250

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

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

220264
public function testDecimalSeparatorMayBeCommaIfGroupingSeparatorIsCommaButNoGroupingUsed()
221265
{
222-
\Locale::setDefault('en');
223266
$transformer = new NumberToLocalizedStringTransformer();
224267

225268
$this->assertEquals(1234.5, $transformer->reverseTransform('1234,5'));
@@ -339,6 +382,9 @@ public function testReverseTransformDisallowsCenteredExtraCharactersMultibyte()
339382
$this->markTestSkipped('The "mbstring" extension is required for this test.');
340383
}
341384

385+
// Since we test against other locales, we need the full implementation
386+
IntlTestHelper::requireFullIntl($this);
387+
342388
\Locale::setDefault('ru');
343389

344390
$transformer = new NumberToLocalizedStringTransformer(null, true);
@@ -356,6 +402,9 @@ public function testReverseTransformIgnoresTrailingSpacesInExceptionMessage()
356402
$this->markTestSkipped('The "mbstring" extension is required for this test.');
357403
}
358404

405+
// Since we test against other locales, we need the full implementation
406+
IntlTestHelper::requireFullIntl($this);
407+
359408
\Locale::setDefault('ru');
360409

361410
$transformer = new NumberToLocalizedStringTransformer(null, true);
@@ -384,6 +433,9 @@ public function testReverseTransformDisallowsTrailingExtraCharactersMultibyte()
384433
$this->markTestSkipped('The "mbstring" extension is required for this test.');
385434
}
386435

436+
// Since we test against other locales, we need the full implementation
437+
IntlTestHelper::requireFullIntl($this);
438+
387439
\Locale::setDefault('ru');
388440

389441
$transformer = new NumberToLocalizedStringTransformer(null, true);

Tests/Extension/Core/DataTransformer/PercentToLocalizedStringTransformerTest.php

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,7 @@ protected function setUp()
2020
{
2121
parent::setUp();
2222

23-
// Since we test against "de_AT", we need the full implementation
24-
IntlTestHelper::requireFullIntl($this);
25-
26-
\Locale::setDefault('de_AT');
23+
\Locale::setDefault('en');
2724
}
2825

2926
public function testTransform()
@@ -55,6 +52,11 @@ public function testTransformWithInteger()
5552

5653
public function testTransformWithPrecision()
5754
{
55+
// Since we test against "de_AT", we need the full implementation
56+
IntlTestHelper::requireFullIntl($this);
57+
58+
\Locale::setDefault('de_AT');
59+
5860
$transformer = new PercentToLocalizedStringTransformer(2);
5961

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

9092
public function testReverseTransformWithPrecision()
9193
{
94+
// Since we test against "de_AT", we need the full implementation
95+
IntlTestHelper::requireFullIntl($this);
96+
97+
\Locale::setDefault('de_AT');
98+
9299
$transformer = new PercentToLocalizedStringTransformer(2);
93100

94101
$this->assertEquals(0.1234, $transformer->reverseTransform('12,34'));

Tests/Extension/Core/Type/DateTimeTypeTest.php

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -13,13 +13,12 @@
1313

1414
use Symfony\Component\Form\FormError;
1515
use Symfony\Component\Form\Test\TypeTestCase as TestCase;
16-
use Symfony\Component\Intl\Util\IntlTestHelper;
1716

1817
class DateTimeTypeTest extends TestCase
1918
{
2019
protected function setUp()
2120
{
22-
IntlTestHelper::requireIntl($this);
21+
\Locale::setDefault('en');
2322

2423
parent::setUp();
2524
}
@@ -271,16 +270,6 @@ public function testInitializeWithDateTime()
271270
$this->factory->create('datetime', new \DateTime());
272271
}
273272

274-
public function testSingleTextWidgetShouldUseTheRightInputType()
275-
{
276-
$form = $this->factory->create('datetime', null, array(
277-
'widget' => 'single_text',
278-
));
279-
280-
$view = $form->createView();
281-
$this->assertEquals('datetime', $view->vars['type']);
282-
}
283-
284273
public function testPassDefaultEmptyValueToViewIfNotRequired()
285274
{
286275
$form = $this->factory->create('datetime', null, array(

0 commit comments

Comments
 (0)