Skip to content

Commit 97af309

Browse files
[Form] Fix declaration of legacy tests
1 parent 0b0214f commit 97af309

12 files changed

+71
-147
lines changed

Tests/AbstractLayoutTest.php

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -131,10 +131,8 @@ abstract protected function setTheme(FormView $view, array $themes);
131131
/**
132132
* @group legacy
133133
*/
134-
public function testLegacyEnctype()
134+
public function testEnctype()
135135
{
136-
$this->iniSet('error_reporting', -1 & ~E_USER_DEPRECATED);
137-
138136
$form = $this->factory->createNamedBuilder('name', 'form')
139137
->add('file', 'file')
140138
->getForm();
@@ -145,10 +143,8 @@ public function testLegacyEnctype()
145143
/**
146144
* @group legacy
147145
*/
148-
public function testLegacyNoEnctype()
146+
public function testNoEnctype()
149147
{
150-
$this->iniSet('error_reporting', -1 & ~E_USER_DEPRECATED);
151-
152148
$form = $this->factory->createNamedBuilder('name', 'form')
153149
->add('text', 'text')
154150
->getForm();

Tests/CompoundFormTest.php

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -810,10 +810,8 @@ public function testSubmitGetRequestWithEmptyRootFormName()
810810
/**
811811
* @group legacy
812812
*/
813-
public function testLegacyGetErrorsAsStringDeep()
813+
public function testGetErrorsAsStringDeep()
814814
{
815-
$this->iniSet('error_reporting', -1 & ~E_USER_DEPRECATED);
816-
817815
$parent = $this->getBuilder()
818816
->setCompound(true)
819817
->setDataMapper($this->getDataMapper())
@@ -834,10 +832,8 @@ public function testLegacyGetErrorsAsStringDeep()
834832
/**
835833
* @group legacy
836834
*/
837-
public function testLegacyGetErrorsAsStringDeepWithIndentation()
835+
public function testGetErrorsAsStringDeepWithIndentation()
838836
{
839-
$this->iniSet('error_reporting', -1 & ~E_USER_DEPRECATED);
840-
841837
$parent = $this->getBuilder()
842838
->setCompound(true)
843839
->setDataMapper($this->getDataMapper())

Tests/Extension/Core/ChoiceList/AbstractChoiceListTest.php

Lines changed: 24 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@
1313

1414
/**
1515
* @author Bernhard Schussek <[email protected]>
16+
*
17+
* @group legacy
1618
*/
1719
abstract class AbstractChoiceListTest extends \PHPUnit_Framework_TestCase
1820
{
@@ -123,8 +125,6 @@ abstract class AbstractChoiceListTest extends \PHPUnit_Framework_TestCase
123125

124126
protected function setUp()
125127
{
126-
$this->iniSet('error_reporting', -1 & ~E_USER_DEPRECATED);
127-
128128
parent::setUp();
129129

130130
$this->list = $this->createChoiceList();
@@ -153,151 +153,131 @@ protected function setUp()
153153
}
154154
}
155155

156-
public function testLegacyGetChoices()
156+
public function testGetChoices()
157157
{
158158
$this->assertSame($this->choices, $this->list->getChoices());
159159
}
160160

161-
public function testLegacyGetValues()
161+
public function testGetValues()
162162
{
163163
$this->assertSame($this->values, $this->list->getValues());
164164
}
165165

166-
public function testLegacyGetIndicesForChoices()
166+
public function testGetIndicesForChoices()
167167
{
168-
$this->iniSet('error_reporting', -1 & ~E_USER_DEPRECATED);
169-
170168
$choices = array($this->choice1, $this->choice2);
171169
$this->assertSame(array($this->index1, $this->index2), $this->list->getIndicesForChoices($choices));
172170
}
173171

174-
public function testLegacyGetIndicesForChoicesPreservesKeys()
172+
public function testGetIndicesForChoicesPreservesKeys()
175173
{
176-
$this->iniSet('error_reporting', -1 & ~E_USER_DEPRECATED);
177-
178174
$choices = array(5 => $this->choice1, 8 => $this->choice2);
179175
$this->assertSame(array(5 => $this->index1, 8 => $this->index2), $this->list->getIndicesForChoices($choices));
180176
}
181177

182-
public function testLegacyGetIndicesForChoicesPreservesOrder()
178+
public function testGetIndicesForChoicesPreservesOrder()
183179
{
184-
$this->iniSet('error_reporting', -1 & ~E_USER_DEPRECATED);
185-
186180
$choices = array($this->choice2, $this->choice1);
187181
$this->assertSame(array($this->index2, $this->index1), $this->list->getIndicesForChoices($choices));
188182
}
189183

190-
public function testLegacyGetIndicesForChoicesIgnoresNonExistingChoices()
184+
public function testGetIndicesForChoicesIgnoresNonExistingChoices()
191185
{
192-
$this->iniSet('error_reporting', -1 & ~E_USER_DEPRECATED);
193-
194186
$choices = array($this->choice1, $this->choice2, 'foobar');
195187
$this->assertSame(array($this->index1, $this->index2), $this->list->getIndicesForChoices($choices));
196188
}
197189

198-
public function testLegacyGetIndicesForChoicesEmpty()
190+
public function testGetIndicesForChoicesEmpty()
199191
{
200-
$this->iniSet('error_reporting', -1 & ~E_USER_DEPRECATED);
201-
202192
$this->assertSame(array(), $this->list->getIndicesForChoices(array()));
203193
}
204194

205-
public function testLegacyGetIndicesForValues()
195+
public function testGetIndicesForValues()
206196
{
207-
$this->iniSet('error_reporting', -1 & ~E_USER_DEPRECATED);
208-
209197
// values and indices are always the same
210198
$values = array($this->value1, $this->value2);
211199
$this->assertSame(array($this->index1, $this->index2), $this->list->getIndicesForValues($values));
212200
}
213201

214-
public function testLegacyGetIndicesForValuesPreservesKeys()
202+
public function testGetIndicesForValuesPreservesKeys()
215203
{
216-
$this->iniSet('error_reporting', -1 & ~E_USER_DEPRECATED);
217-
218204
// values and indices are always the same
219205
$values = array(5 => $this->value1, 8 => $this->value2);
220206
$this->assertSame(array(5 => $this->index1, 8 => $this->index2), $this->list->getIndicesForValues($values));
221207
}
222208

223-
public function testLegacyGetIndicesForValuesPreservesOrder()
209+
public function testGetIndicesForValuesPreservesOrder()
224210
{
225-
$this->iniSet('error_reporting', -1 & ~E_USER_DEPRECATED);
226-
227211
$values = array($this->value2, $this->value1);
228212
$this->assertSame(array($this->index2, $this->index1), $this->list->getIndicesForValues($values));
229213
}
230214

231-
public function testLegacyGetIndicesForValuesIgnoresNonExistingValues()
215+
public function testGetIndicesForValuesIgnoresNonExistingValues()
232216
{
233-
$this->iniSet('error_reporting', -1 & ~E_USER_DEPRECATED);
234-
235217
$values = array($this->value1, $this->value2, 'foobar');
236218
$this->assertSame(array($this->index1, $this->index2), $this->list->getIndicesForValues($values));
237219
}
238220

239-
public function testLegacyGetIndicesForValuesEmpty()
221+
public function testGetIndicesForValuesEmpty()
240222
{
241-
$this->iniSet('error_reporting', -1 & ~E_USER_DEPRECATED);
242-
243223
$this->assertSame(array(), $this->list->getIndicesForValues(array()));
244224
}
245225

246-
public function testLegacyGetChoicesForValues()
226+
public function testGetChoicesForValues()
247227
{
248228
$values = array($this->value1, $this->value2);
249229
$this->assertSame(array($this->choice1, $this->choice2), $this->list->getChoicesForValues($values));
250230
}
251231

252-
public function testLegacyGetChoicesForValuesPreservesKeys()
232+
public function testGetChoicesForValuesPreservesKeys()
253233
{
254234
$values = array(5 => $this->value1, 8 => $this->value2);
255235
$this->assertSame(array(5 => $this->choice1, 8 => $this->choice2), $this->list->getChoicesForValues($values));
256236
}
257237

258-
public function testLegacyGetChoicesForValuesPreservesOrder()
238+
public function testGetChoicesForValuesPreservesOrder()
259239
{
260240
$values = array($this->value2, $this->value1);
261241
$this->assertSame(array($this->choice2, $this->choice1), $this->list->getChoicesForValues($values));
262242
}
263243

264-
public function testLegacyGetChoicesForValuesIgnoresNonExistingValues()
244+
public function testGetChoicesForValuesIgnoresNonExistingValues()
265245
{
266246
$values = array($this->value1, $this->value2, 'foobar');
267247
$this->assertSame(array($this->choice1, $this->choice2), $this->list->getChoicesForValues($values));
268248
}
269249

270250
// https://github.com/symfony/symfony/issues/3446
271-
public function testLegacyGetChoicesForValuesEmpty()
251+
public function testGetChoicesForValuesEmpty()
272252
{
273253
$this->assertSame(array(), $this->list->getChoicesForValues(array()));
274254
}
275255

276-
public function testLegacyGetValuesForChoices()
256+
public function testGetValuesForChoices()
277257
{
278258
$choices = array($this->choice1, $this->choice2);
279259
$this->assertSame(array($this->value1, $this->value2), $this->list->getValuesForChoices($choices));
280260
}
281261

282-
public function testLegacyGetValuesForChoicesPreservesKeys()
262+
public function testGetValuesForChoicesPreservesKeys()
283263
{
284264
$choices = array(5 => $this->choice1, 8 => $this->choice2);
285265
$this->assertSame(array(5 => $this->value1, 8 => $this->value2), $this->list->getValuesForChoices($choices));
286266
}
287267

288-
public function testLegacyGetValuesForChoicesPreservesOrder()
268+
public function testGetValuesForChoicesPreservesOrder()
289269
{
290270
$choices = array($this->choice2, $this->choice1);
291271
$this->assertSame(array($this->value2, $this->value1), $this->list->getValuesForChoices($choices));
292272
}
293273

294-
public function testLegacyGetValuesForChoicesIgnoresNonExistingChoices()
274+
public function testGetValuesForChoicesIgnoresNonExistingChoices()
295275
{
296276
$choices = array($this->choice1, $this->choice2, 'foobar');
297277
$this->assertSame(array($this->value1, $this->value2), $this->list->getValuesForChoices($choices));
298278
}
299279

300-
public function testLegacyGetValuesForChoicesEmpty()
280+
public function testGetValuesForChoicesEmpty()
301281
{
302282
$this->assertSame(array(), $this->list->getValuesForChoices(array()));
303283
}

Tests/Extension/Core/ChoiceList/ChoiceListTest.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ protected function setUp()
3737
parent::setUp();
3838
}
3939

40-
public function testLegacyInitArray()
40+
public function testInitArray()
4141
{
4242
$this->list = new ChoiceList(
4343
array($this->obj1, $this->obj2, $this->obj3, $this->obj4),
@@ -56,7 +56,7 @@ public function testLegacyInitArray()
5656
* choices parameter. A choice itself that is an object implementing \Traversable
5757
* is not treated as hierarchical structure, but as-is.
5858
*/
59-
public function testLegacyInitNestedTraversable()
59+
public function testInitNestedTraversable()
6060
{
6161
$traversableChoice = new \ArrayIterator(array($this->obj3, $this->obj4));
6262

@@ -83,7 +83,7 @@ public function testLegacyInitNestedTraversable()
8383
), $this->list->getRemainingViews());
8484
}
8585

86-
public function testLegacyInitNestedArray()
86+
public function testInitNestedArray()
8787
{
8888
$this->assertSame(array($this->obj1, $this->obj2, $this->obj3, $this->obj4), $this->list->getChoices());
8989
$this->assertSame(array('0', '1', '2', '3'), $this->list->getValues());
@@ -100,15 +100,15 @@ public function testLegacyInitNestedArray()
100100
/**
101101
* @expectedException \InvalidArgumentException
102102
*/
103-
public function testLegacyInitWithInsufficientLabels()
103+
public function testInitWithInsufficientLabels()
104104
{
105105
$this->list = new ChoiceList(
106106
array($this->obj1, $this->obj2),
107107
array('A')
108108
);
109109
}
110110

111-
public function testLegacyInitWithLabelsContainingNull()
111+
public function testInitWithLabelsContainingNull()
112112
{
113113
$this->list = new ChoiceList(
114114
array($this->obj1, $this->obj2),

Tests/Extension/Core/ChoiceList/LazyChoiceListTest.php

Lines changed: 9 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -43,55 +43,45 @@ protected function tearDown()
4343
$this->list = null;
4444
}
4545

46-
public function testLegacyGetChoices()
46+
public function testGetChoices()
4747
{
4848
$this->assertSame(array(0 => 'a', 1 => 'b', 2 => 'c'), $this->list->getChoices());
4949
}
5050

51-
public function testLegacyGetValues()
51+
public function testGetValues()
5252
{
5353
$this->assertSame(array(0 => 'a', 1 => 'b', 2 => 'c'), $this->list->getValues());
5454
}
5555

56-
public function testLegacyGetPreferredViews()
56+
public function testGetPreferredViews()
5757
{
5858
$this->assertEquals(array(1 => new ChoiceView('b', 'b', 'B')), $this->list->getPreferredViews());
5959
}
6060

61-
public function testLegacyGetRemainingViews()
61+
public function testGetRemainingViews()
6262
{
6363
$this->assertEquals(array(0 => new ChoiceView('a', 'a', 'A'), 2 => new ChoiceView('c', 'c', 'C')), $this->list->getRemainingViews());
6464
}
6565

66-
/**
67-
* @group legacy
68-
*/
69-
public function testLegacyGetIndicesForChoices()
66+
public function testGetIndicesForChoices()
7067
{
71-
$this->iniSet('error_reporting', -1 & ~E_USER_DEPRECATED);
72-
7368
$choices = array('b', 'c');
7469
$this->assertSame(array(1, 2), $this->list->getIndicesForChoices($choices));
7570
}
7671

77-
/**
78-
* @group legacy
79-
*/
80-
public function testLegacyGetIndicesForValues()
72+
public function testGetIndicesForValues()
8173
{
82-
$this->iniSet('error_reporting', -1 & ~E_USER_DEPRECATED);
83-
8474
$values = array('b', 'c');
8575
$this->assertSame(array(1, 2), $this->list->getIndicesForValues($values));
8676
}
8777

88-
public function testLegacyGetChoicesForValues()
78+
public function testGetChoicesForValues()
8979
{
9080
$values = array('b', 'c');
9181
$this->assertSame(array('b', 'c'), $this->list->getChoicesForValues($values));
9282
}
9383

94-
public function testLegacyGetValuesForChoices()
84+
public function testGetValuesForChoices()
9585
{
9686
$choices = array('b', 'c');
9787
$this->assertSame(array('b', 'c'), $this->list->getValuesForChoices($choices));
@@ -100,7 +90,7 @@ public function testLegacyGetValuesForChoices()
10090
/**
10191
* @expectedException \Symfony\Component\Form\Exception\InvalidArgumentException
10292
*/
103-
public function testLegacyLoadChoiceListShouldReturnChoiceList()
93+
public function testLoadChoiceListShouldReturnChoiceList()
10494
{
10595
$list = new LazyChoiceListTest_InvalidImpl();
10696

0 commit comments

Comments
 (0)