Skip to content

Commit b430298

Browse files
[2.3] Cleanup deprecations
1 parent 300ecf4 commit b430298

File tree

4 files changed

+30
-13
lines changed

4 files changed

+30
-13
lines changed

ButtonBuilder.php

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -386,6 +386,9 @@ public function setByReference($byReference)
386386
* @param bool $virtual
387387
*
388388
* @throws BadMethodCallException
389+
*
390+
* @deprecated since version 2.3, to be removed in 3.0. Use
391+
* {@link setInheritData()} instead.
389392
*/
390393
public function setVirtual($virtual)
391394
{
@@ -588,6 +591,9 @@ public function getByReference()
588591
* Unsupported method.
589592
*
590593
* @return bool Always returns false.
594+
*
595+
* @deprecated since version 2.3, to be removed in 3.0. Use
596+
* {@link getInheritData()} instead.
591597
*/
592598
public function getVirtual()
593599
{

Test/DeprecationErrorHandler.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,9 @@
1313

1414
use Symfony\Component\Form\FormEvent;
1515

16+
/**
17+
* @deprecated since version 2.3, to be removed in 3.0.
18+
*/
1619
class DeprecationErrorHandler
1720
{
1821
public static function handle($errorNumber, $message, $file, $line, $context)

Tests/AbstractLayoutTest.php

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,10 @@ protected function assertWidgetMatchesXpath(FormView $view, array $vars, $xpath)
101101

102102
abstract protected function renderForm(FormView $view, array $vars = array());
103103

104-
abstract protected function renderEnctype(FormView $view);
104+
protected function renderEnctype(FormView $view)
105+
{
106+
$this->markTestSkipped(sprintf('Legacy %s::renderEnctype() is not implemented.', get_class($this)));
107+
}
105108

106109
abstract protected function renderLabel(FormView $view, $label = null, array $vars = array());
107110

@@ -119,17 +122,21 @@ abstract protected function renderEnd(FormView $view, array $vars = array());
119122

120123
abstract protected function setTheme(FormView $view, array $themes);
121124

122-
public function testEnctype()
125+
public function testLegacyEnctype()
123126
{
127+
$this->iniSet('error_reporting', -1 & ~E_USER_DEPRECATED);
128+
124129
$form = $this->factory->createNamedBuilder('name', 'form')
125130
->add('file', 'file')
126131
->getForm();
127132

128133
$this->assertEquals('enctype="multipart/form-data"', $this->renderEnctype($form->createView()));
129134
}
130135

131-
public function testNoEnctype()
136+
public function testLegacyNoEnctype()
132137
{
138+
$this->iniSet('error_reporting', -1 & ~E_USER_DEPRECATED);
139+
133140
$form = $this->factory->createNamedBuilder('name', 'form')
134141
->add('text', 'text')
135142
->getForm();

Tests/Extension/HttpFoundation/EventListener/BindRequestListenerTest.php renamed to Tests/Extension/HttpFoundation/EventListener/LegacyBindRequestListenerTest.php

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -15,14 +15,13 @@
1515
use Symfony\Component\Form\Form;
1616
use Symfony\Component\Form\FormConfigBuilder;
1717
use Symfony\Component\Form\FormEvent;
18-
use Symfony\Component\Form\Test\DeprecationErrorHandler;
1918
use Symfony\Component\HttpFoundation\Request;
2019
use Symfony\Component\HttpFoundation\File\UploadedFile;
2120

2221
/**
2322
* @author Bernhard Schussek <[email protected]>
2423
*/
25-
class BindRequestListenerTest extends \PHPUnit_Framework_TestCase
24+
class LegacyBindRequestListenerTest extends \PHPUnit_Framework_TestCase
2625
{
2726
private $values;
2827

@@ -37,6 +36,8 @@ class BindRequestListenerTest extends \PHPUnit_Framework_TestCase
3736

3837
protected function setUp()
3938
{
39+
$this->iniSet('error_reporting', -1 & ~E_USER_DEPRECATED);
40+
4041
$path = tempnam(sys_get_temp_dir(), 'sf2');
4142
touch($path);
4243

@@ -102,7 +103,7 @@ public function testSubmitRequest($method)
102103
$event = new FormEvent($form, $request);
103104

104105
$listener = new BindRequestListener();
105-
DeprecationErrorHandler::preBind($listener, $event);
106+
$listener->preBind($event);
106107

107108
$this->assertEquals(array(
108109
'name' => 'Bernhard',
@@ -129,7 +130,7 @@ public function testSubmitRequestWithEmptyName($method)
129130
$event = new FormEvent($form, $request);
130131

131132
$listener = new BindRequestListener();
132-
DeprecationErrorHandler::preBind($listener, $event);
133+
$listener->preBind($event);
133134

134135
$this->assertEquals(array(
135136
'name' => 'Bernhard',
@@ -158,7 +159,7 @@ public function testSubmitEmptyRequestToCompoundForm($method)
158159
$event = new FormEvent($form, $request);
159160

160161
$listener = new BindRequestListener();
161-
DeprecationErrorHandler::preBind($listener, $event);
162+
$listener->preBind($event);
162163

163164
// Default to empty array
164165
$this->assertEquals(array(), $event->getData());
@@ -184,7 +185,7 @@ public function testSubmitEmptyRequestToSimpleForm($method)
184185
$event = new FormEvent($form, $request);
185186

186187
$listener = new BindRequestListener();
187-
DeprecationErrorHandler::preBind($listener, $event);
188+
$listener->preBind($event);
188189

189190
// Default to null
190191
$this->assertNull($event->getData());
@@ -207,7 +208,7 @@ public function testSubmitGetRequest()
207208
$event = new FormEvent($form, $request);
208209

209210
$listener = new BindRequestListener();
210-
DeprecationErrorHandler::preBind($listener, $event);
211+
$listener->preBind($event);
211212

212213
$this->assertEquals(array(
213214
'name' => 'Bernhard',
@@ -231,7 +232,7 @@ public function testSubmitGetRequestWithEmptyName()
231232
$event = new FormEvent($form, $request);
232233

233234
$listener = new BindRequestListener();
234-
DeprecationErrorHandler::preBind($listener, $event);
235+
$listener->preBind($event);
235236

236237
$this->assertEquals(array(
237238
'name' => 'Bernhard',
@@ -257,7 +258,7 @@ public function testSubmitEmptyGetRequestToCompoundForm()
257258
$event = new FormEvent($form, $request);
258259

259260
$listener = new BindRequestListener();
260-
DeprecationErrorHandler::preBind($listener, $event);
261+
$listener->preBind($event);
261262

262263
$this->assertEquals(array(), $event->getData());
263264
}
@@ -279,7 +280,7 @@ public function testSubmitEmptyGetRequestToSimpleForm()
279280
$event = new FormEvent($form, $request);
280281

281282
$listener = new BindRequestListener();
282-
DeprecationErrorHandler::preBind($listener, $event);
283+
$listener->preBind($event);
283284

284285
$this->assertNull($event->getData());
285286
}

0 commit comments

Comments
 (0)