Skip to content

Commit 12d8261

Browse files
committed
Merge branch '2.5' into 2.6
* 2.5: [2.5] cleanup deprecated uses
2 parents 9d4bab0 + 22885d8 commit 12d8261

File tree

44 files changed

+272
-200
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

44 files changed

+272
-200
lines changed

src/Symfony/Bridge/Doctrine/Tests/Form/ChoiceList/GenericEntityChoiceListTest.php

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -265,6 +265,23 @@ public function testInitShorthandEntityName()
265265
);
266266

267267
$this->assertEquals(array(1, 2), $choiceList->getValuesForChoices(array($item1, $item2)));
268+
}
269+
270+
public function testLegacyInitShorthandEntityName()
271+
{
272+
$this->iniSet('error_reporting', -1 & E_USER_DEPRECATED);
273+
274+
$item1 = new SingleIntIdEntity(1, 'Foo');
275+
$item2 = new SingleIntIdEntity(2, 'Bar');
276+
277+
$this->em->persist($item1);
278+
$this->em->persist($item2);
279+
280+
$choiceList = new EntityChoiceList(
281+
$this->em,
282+
'SymfonyTestsDoctrine:SingleIntIdEntity'
283+
);
284+
268285
$this->assertEquals(array(1, 2), $choiceList->getIndicesForChoices(array($item1, $item2)));
269286
}
270287
}

src/Symfony/Bridge/Doctrine/Tests/Form/ChoiceList/UnloadedEntityChoiceListSingleIntIdTest.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,4 +20,9 @@ public function testGetIndicesForValuesIgnoresNonExistingValues()
2020
{
2121
$this->markTestSkipped('Non-existing values are not detected for unloaded choice lists.');
2222
}
23+
24+
public function testLegacyGetIndicesForValuesIgnoresNonExistingValues()
25+
{
26+
$this->markTestSkipped('Non-existing values are not detected for unloaded choice lists.');
27+
}
2328
}

src/Symfony/Bridge/Doctrine/Tests/Validator/Constraints/UniqueEntityValidatorTest.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@
2323
use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntityValidator;
2424
use Symfony\Component\Validator\Tests\Constraints\AbstractConstraintValidatorTest;
2525
use Symfony\Component\Validator\Validation;
26-
use Symfony\Component\Validator\Validator;
2726
use Doctrine\ORM\Tools\SchemaTool;
2827

2928
/**

src/Symfony/Bridge/Propel1/Tests/Form/ChoiceList/ModelChoiceListTest.php

Lines changed: 48 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -183,7 +183,6 @@ public function testGetValuesForChoices()
183183
);
184184

185185
$this->assertEquals(array(1, 2), $choiceList->getValuesForChoices(array($item1, $item2)));
186-
$this->assertEquals(array(1, 2), $choiceList->getIndicesForChoices(array($item1, $item2)));
187186
}
188187

189188
public function testDifferentEqualObjectsAreChoosen()
@@ -202,12 +201,58 @@ public function testDifferentEqualObjectsAreChoosen()
202201

203202
$choosenItem = new Item(1, 'Foo');
204203

205-
$this->assertEquals(array(1), $choiceList->getIndicesForChoices(array($choosenItem)));
206204
$this->assertEquals(array('1'), $choiceList->getValuesForChoices(array($choosenItem)));
207205
}
208206

209-
public function testGetIndicesForNullChoices()
207+
public function testLegacygetIndicesForChoices()
208+
{
209+
$this->iniSet('error_reporting', -1 & E_USER_DEPRECATED);
210+
211+
$item1 = new Item(1, 'Foo');
212+
$item2 = new Item(2, 'Bar');
213+
214+
ItemQuery::$result = array(
215+
$item1,
216+
$item2,
217+
);
218+
219+
$choiceList = new ModelChoiceList(
220+
self::ITEM_CLASS,
221+
'value',
222+
null,
223+
null,
224+
null,
225+
null
226+
);
227+
228+
$this->assertEquals(array(1, 2), $choiceList->getIndicesForChoices(array($item1, $item2)));
229+
}
230+
231+
public function testLegacyDifferentEqualObjectsAreChoosen()
232+
{
233+
$this->iniSet('error_reporting', -1 & E_USER_DEPRECATED);
234+
235+
$item = new Item(1, 'Foo');
236+
237+
ItemQuery::$result = array(
238+
$item,
239+
);
240+
241+
$choiceList = new ModelChoiceList(
242+
self::ITEM_CLASS,
243+
'value',
244+
array($item)
245+
);
246+
247+
$choosenItem = new Item(1, 'Foo');
248+
249+
$this->assertEquals(array(1), $choiceList->getIndicesForChoices(array($choosenItem)));
250+
}
251+
252+
public function testLegacyGetIndicesForNullChoices()
210253
{
254+
$this->iniSet('error_reporting', -1 & E_USER_DEPRECATED);
255+
211256
$item = new Item(1, 'Foo');
212257
$choiceList = new ModelChoiceList(
213258
self::ITEM_CLASS,

src/Symfony/Bridge/Twig/Tests/Extension/FormExtensionDivLayoutTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ protected function setUp()
3636
'form_div_layout.html.twig',
3737
'custom_widgets.html.twig',
3838
));
39-
$renderer = new TwigRenderer($rendererEngine, $this->getMock('Symfony\Component\Form\Extension\Csrf\CsrfProvider\CsrfProviderInterface'));
39+
$renderer = new TwigRenderer($rendererEngine, $this->getMock('Symfony\Component\Security\Csrf\CsrfTokenManagerInterface'));
4040

4141
$this->extension = new FormExtension($renderer);
4242

src/Symfony/Bridge/Twig/Tests/Extension/FormExtensionTableLayoutTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ protected function setUp()
3535
'form_table_layout.html.twig',
3636
'custom_widgets.html.twig',
3737
));
38-
$renderer = new TwigRenderer($rendererEngine, $this->getMock('Symfony\Component\Form\Extension\Csrf\CsrfProvider\CsrfProviderInterface'));
38+
$renderer = new TwigRenderer($rendererEngine, $this->getMock('Symfony\Component\Security\Csrf\CsrfTokenManagerInterface'));
3939

4040
$this->extension = new FormExtension($renderer);
4141

src/Symfony/Bundle/FrameworkBundle/Tests/Templating/Helper/SessionHelperTest.php

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -12,33 +12,37 @@
1212
namespace Symfony\Bundle\FrameworkBundle\Tests\Templating\Helper;
1313

1414
use Symfony\Component\HttpFoundation\Request;
15+
use Symfony\Component\HttpFoundation\RequestStack;
1516
use Symfony\Component\HttpFoundation\Session\Session;
1617
use Symfony\Component\HttpFoundation\Session\Storage\MockArraySessionStorage;
1718
use Symfony\Bundle\FrameworkBundle\Templating\Helper\SessionHelper;
1819

1920
class SessionHelperTest extends \PHPUnit_Framework_TestCase
2021
{
21-
protected $request;
22+
protected $requestStack;
2223

2324
protected function setUp()
2425
{
25-
$this->request = new Request();
26+
$request = new Request();
2627

2728
$session = new Session(new MockArraySessionStorage());
2829
$session->set('foobar', 'bar');
2930
$session->getFlashBag()->set('notice', 'bar');
3031

31-
$this->request->setSession($session);
32+
$request->setSession($session);
33+
34+
$this->requestStack = new RequestStack();
35+
$this->requestStack->push($request);
3236
}
3337

3438
protected function tearDown()
3539
{
36-
$this->request = null;
40+
$this->requestStack = null;
3741
}
3842

3943
public function testFlash()
4044
{
41-
$helper = new SessionHelper($this->request);
45+
$helper = new SessionHelper($this->requestStack);
4246

4347
$this->assertTrue($helper->hasFlash('notice'));
4448

@@ -47,13 +51,13 @@ public function testFlash()
4751

4852
public function testGetFlashes()
4953
{
50-
$helper = new SessionHelper($this->request);
54+
$helper = new SessionHelper($this->requestStack);
5155
$this->assertEquals(array('notice' => array('bar')), $helper->getFlashes());
5256
}
5357

5458
public function testGet()
5559
{
56-
$helper = new SessionHelper($this->request);
60+
$helper = new SessionHelper($this->requestStack);
5761

5862
$this->assertEquals('bar', $helper->get('foobar'));
5963
$this->assertEquals('foo', $helper->get('bar', 'foo'));
@@ -63,7 +67,7 @@ public function testGet()
6367

6468
public function testGetName()
6569
{
66-
$helper = new SessionHelper($this->request);
70+
$helper = new SessionHelper($this->requestStack);
6771

6872
$this->assertEquals('session', $helper->getName());
6973
}

src/Symfony/Bundle/TwigBundle/Tests/TokenParser/RenderTokenParserTest.php renamed to src/Symfony/Bundle/TwigBundle/Tests/TokenParser/LegacyRenderTokenParserTest.php

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,13 @@
1515
use Symfony\Bundle\TwigBundle\TokenParser\RenderTokenParser;
1616
use Symfony\Bundle\TwigBundle\Node\RenderNode;
1717

18-
class RenderTokenParserTest extends TestCase
18+
class LegacyRenderTokenParserTest extends TestCase
1919
{
20+
public function setUp()
21+
{
22+
$this->iniSet('error_reporting', -1 & ~E_USER_DEPRECATED);
23+
}
24+
2025
/**
2126
* @dataProvider getTestsForRender
2227
*/

src/Symfony/Component/ClassLoader/Tests/ApcUniversalClassLoaderTest.php renamed to src/Symfony/Component/ClassLoader/Tests/LegacyApcUniversalClassLoaderTest.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,12 @@
1313

1414
use Symfony\Component\ClassLoader\ApcUniversalClassLoader;
1515

16-
class ApcUniversalClassLoaderTest extends \PHPUnit_Framework_TestCase
16+
class LegacyApcUniversalClassLoaderTest extends \PHPUnit_Framework_TestCase
1717
{
1818
protected function setUp()
1919
{
20+
$this->iniSet('error_reporting', -1 & ~E_USER_DEPRECATED);
21+
2022
if (!extension_loaded('apc')) {
2123
$this->markTestSkipped('The apc extension is not available.');
2224
}

src/Symfony/Component/ClassLoader/Tests/UniversalClassLoaderTest.php renamed to src/Symfony/Component/ClassLoader/Tests/LegacyUniversalClassLoaderTest.php

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,13 @@
1313

1414
use Symfony\Component\ClassLoader\UniversalClassLoader;
1515

16-
class UniversalClassLoaderTest extends \PHPUnit_Framework_TestCase
16+
class LegacyUniversalClassLoaderTest extends \PHPUnit_Framework_TestCase
1717
{
18+
public function setUp()
19+
{
20+
$this->iniSet('error_reporting', -1 & ~E_USER_DEPRECATED);
21+
}
22+
1823
/**
1924
* @dataProvider getLoadClassTests
2025
*/

0 commit comments

Comments
 (0)