Skip to content

Commit 2298f1d

Browse files
committed
Merge branch '2.3' into 2.5
* 2.3: Updated generateSql tool Fix the implementation of deprecated Locale classes Fix phpdoc and coding standards Replace usages of the deprecated TypeTestCase by the new one Remove usages of deprecated constants Update functional tests to use the PSR NullLogger Make fabbot happy Clean up testing [DomCrawler] fixed bug #12143 Conflicts: src/Symfony/Bridge/Doctrine/Tests/Validator/Constraints/UniqueEntityValidatorTest.php src/Symfony/Bundle/FrameworkBundle/Tests/Templating/TimedPhpEngineTest.php src/Symfony/Bundle/TwigBundle/Tests/Loader/FilesystemLoaderTest.php src/Symfony/Component/Console/Application.php src/Symfony/Component/DomCrawler/Crawler.php src/Symfony/Component/Form/Tests/Extension/Core/Type/CollectionTypeTest.php src/Symfony/Component/Form/Tests/Extension/Csrf/Type/FormTypeCsrfExtensionTest.php src/Symfony/Component/HttpKernel/Tests/Bundle/BundleTest.php src/Symfony/Component/Serializer/Encoder/EncoderInterface.php src/Symfony/Component/Serializer/Encoder/XmlEncoder.php src/Symfony/Component/Validator/Tests/Mapping/ClassMetadataFactoryTest.php
2 parents bac8659 + 6b7e8f3 commit 2298f1d

24 files changed

+62
-36
lines changed

Extension/HttpFoundation/EventListener/BindRequestListener.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ class BindRequestListener implements EventSubscriberInterface
2727
public static function getSubscribedEvents()
2828
{
2929
// High priority in order to supersede other listeners
30-
return array(FormEvents::PRE_BIND => array('preBind', 128));
30+
return array(FormEvents::PRE_SUBMIT => array('preBind', 128));
3131
}
3232

3333
public function preBind(FormEvent $event)

Tests/CompoundFormPerformanceTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
/**
1515
* @author Bernhard Schussek <[email protected]>
1616
*/
17-
class CompoundFormPerformanceTest extends \Symfony\Component\Form\Tests\FormPerformanceTestCase
17+
class CompoundFormPerformanceTest extends \Symfony\Component\Form\Test\FormPerformanceTestCase
1818
{
1919
/**
2020
* Create a compound form multiple times, as happens in a collection form.

Tests/Extension/Core/DataTransformer/BooleanToStringTransformerTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ class BooleanToStringTransformerTest extends \PHPUnit_Framework_TestCase
1818
const TRUE_VALUE = '1';
1919

2020
/**
21-
* @var boolToStringTransformer
21+
* @var BooleanToStringTransformer
2222
*/
2323
protected $transformer;
2424

Tests/Extension/Core/Type/CountryTypeTest.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,10 @@
1212
namespace Symfony\Component\Form\Tests\Extension\Core\Type;
1313

1414
use Symfony\Component\Form\Extension\Core\View\ChoiceView;
15+
use Symfony\Component\Form\Test\TypeTestCase as TestCase;
1516
use Symfony\Component\Intl\Util\IntlTestHelper;
1617

17-
class CountryTypeTest extends TypeTestCase
18+
class CountryTypeTest extends TestCase
1819
{
1920
protected function setUp()
2021
{

Tests/Extension/Core/Type/CurrencyTypeTest.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,10 @@
1212
namespace Symfony\Component\Form\Tests\Extension\Core\Type;
1313

1414
use Symfony\Component\Form\Extension\Core\View\ChoiceView;
15+
use Symfony\Component\Form\Test\TypeTestCase as TestCase;
1516
use Symfony\Component\Intl\Util\IntlTestHelper;
1617

17-
class CurrencyTypeTest extends TypeTestCase
18+
class CurrencyTypeTest extends TestCase
1819
{
1920
protected function setUp()
2021
{

Tests/Extension/Core/Type/DateTimeTypeTest.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,10 @@
1212
namespace Symfony\Component\Form\Tests\Extension\Core\Type;
1313

1414
use Symfony\Component\Form\FormError;
15+
use Symfony\Component\Form\Test\TypeTestCase as TestCase;
1516
use Symfony\Component\Intl\Util\IntlTestHelper;
1617

17-
class DateTimeTypeTest extends TypeTestCase
18+
class DateTimeTypeTest extends TestCase
1819
{
1920
protected function setUp()
2021
{

Tests/Extension/Core/Type/DateTypeTest.php

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

1414
use Symfony\Component\Form\Extension\Core\View\ChoiceView;
1515
use Symfony\Component\Form\FormError;
16+
use Symfony\Component\Form\Test\TypeTestCase as TestCase;
1617
use Symfony\Component\Intl\Util\IntlTestHelper;
1718

18-
class DateTypeTest extends TypeTestCase
19+
class DateTypeTest extends TestCase
1920
{
2021
protected function setUp()
2122
{

Tests/Extension/Core/Type/FormTypeTest.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@
1212
namespace Symfony\Component\Form\Tests\Extension\Core\Type;
1313

1414
use Symfony\Component\PropertyAccess\PropertyPath;
15-
use Symfony\Component\Form\Form;
1615
use Symfony\Component\Form\CallbackTransformer;
1716
use Symfony\Component\Form\Tests\Fixtures\Author;
1817
use Symfony\Component\Form\Tests\Fixtures\FixedDataTransformer;

Tests/Extension/Core/Type/IntegerTypeTest.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,10 @@
1111

1212
namespace Symfony\Component\Form\Tests\Extension\Core\Type;
1313

14+
use Symfony\Component\Form\Test\TypeTestCase as TestCase;
1415
use Symfony\Component\Intl\Util\IntlTestHelper;
1516

16-
class IntegerTypeTest extends TypeTestCase
17+
class IntegerTypeTest extends TestCase
1718
{
1819
protected function setUp()
1920
{

Tests/Extension/Core/Type/LanguageTypeTest.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,10 @@
1212
namespace Symfony\Component\Form\Tests\Extension\Core\Type;
1313

1414
use Symfony\Component\Form\Extension\Core\View\ChoiceView;
15+
use Symfony\Component\Form\Test\TypeTestCase as TestCase;
1516
use Symfony\Component\Intl\Util\IntlTestHelper;
1617

17-
class LanguageTypeTest extends TypeTestCase
18+
class LanguageTypeTest extends TestCase
1819
{
1920
protected function setUp()
2021
{

Tests/Extension/Core/Type/LocaleTypeTest.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,10 @@
1212
namespace Symfony\Component\Form\Tests\Extension\Core\Type;
1313

1414
use Symfony\Component\Form\Extension\Core\View\ChoiceView;
15+
use Symfony\Component\Form\Test\TypeTestCase as TestCase;
1516
use Symfony\Component\Intl\Util\IntlTestHelper;
1617

17-
class LocaleTypeTest extends TypeTestCase
18+
class LocaleTypeTest extends TestCase
1819
{
1920
protected function setUp()
2021
{

Tests/Extension/Core/Type/MoneyTypeTest.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,10 @@
1111

1212
namespace Symfony\Component\Form\Tests\Extension\Core\Type;
1313

14+
use Symfony\Component\Form\Test\TypeTestCase as TestCase;
1415
use Symfony\Component\Intl\Util\IntlTestHelper;
1516

16-
class MoneyTypeTest extends TypeTestCase
17+
class MoneyTypeTest extends TestCase
1718
{
1819
protected function setUp()
1920
{

Tests/Extension/Core/Type/NumberTypeTest.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,10 @@
1111

1212
namespace Symfony\Component\Form\Tests\Extension\Core\Type;
1313

14+
use Symfony\Component\Form\Test\TypeTestCase as TestCase;
1415
use Symfony\Component\Intl\Util\IntlTestHelper;
1516

16-
class NumberTypeTest extends TypeTestCase
17+
class NumberTypeTest extends TestCase
1718
{
1819
protected function setUp()
1920
{

Tests/Extension/Core/Type/SubmitTypeTest.php

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

1212
namespace Symfony\Component\Form\Tests\Extension\Core\Type;
1313

14+
use Symfony\Component\Form\Test\TypeTestCase as TestCase;
15+
1416
/**
1517
* @author Bernhard Schussek <[email protected]>
1618
*/
17-
class SubmitTypeTest extends TypeTestCase
19+
class SubmitTypeTest extends TestCase
1820
{
1921
public function testCreateSubmitButtonInstances()
2022
{

Tests/Extension/Core/Type/TimeTypeTest.php

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

1414
use Symfony\Component\Form\Extension\Core\View\ChoiceView;
1515
use Symfony\Component\Form\FormError;
16+
use Symfony\Component\Form\Test\TypeTestCase as TestCase;
1617
use Symfony\Component\Intl\Util\IntlTestHelper;
1718

18-
class TimeTypeTest extends TypeTestCase
19+
class TimeTypeTest extends TestCase
1920
{
2021
protected function setUp()
2122
{

Tests/Extension/Core/Type/UrlTypeTest.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,9 @@
1111

1212
namespace Symfony\Component\Form\Tests\Extension\Core\Type;
1313

14-
class UrlTypeTest extends TypeTestCase
14+
use Symfony\Component\Form\Test\TypeTestCase as TestCase;
15+
16+
class UrlTypeTest extends TestCase
1517
{
1618
public function testSubmitAddsDefaultProtocolIfNoneIsIncluded()
1719
{

Tests/Extension/Csrf/Type/FormTypeCsrfExtensionTest.php

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -279,6 +279,37 @@ public function testValidateTokenOnSubmitIfRootAndCompoundUsesTypeClassAsIntenti
279279
$this->assertSame($valid, $form->isValid());
280280
}
281281

282+
/**
283+
* @dataProvider provideBoolean
284+
*/
285+
public function testValidateTokenOnBindIfRootAndCompoundUsesTypeClassAsIntentionIfEmptyFormName($valid)
286+
{
287+
$this->csrfProvider->expects($this->once())
288+
->method('isCsrfTokenValid')
289+
->with('Symfony\Component\Form\Extension\Core\Type\FormType', 'token')
290+
->will($this->returnValue($valid));
291+
292+
$form = $this->factory
293+
->createNamedBuilder('', 'form', null, array(
294+
'csrf_field_name' => 'csrf',
295+
'csrf_provider' => $this->csrfProvider,
296+
'compound' => true,
297+
))
298+
->add('child', 'text')
299+
->getForm();
300+
301+
$form->submit(array(
302+
'child' => 'foobar',
303+
'csrf' => 'token',
304+
));
305+
306+
// Remove token from data
307+
$this->assertSame(array('child' => 'foobar'), $form->getData());
308+
309+
// Validate accordingly
310+
$this->assertSame($valid, $form->isValid());
311+
}
312+
282313
public function testFailIfRootAndCompoundAndTokenMissing()
283314
{
284315
$this->tokenManager->expects($this->never())

Tests/Extension/Validator/Constraints/FormValidatorTest.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@
1818
use Symfony\Component\Form\Extension\Validator\Constraints\Form;
1919
use Symfony\Component\Form\Extension\Validator\Constraints\FormValidator;
2020
use Symfony\Component\Form\SubmitButtonBuilder;
21-
use Symfony\Component\Validator\Constraint;
2221
use Symfony\Component\Validator\Constraints\NotNull;
2322
use Symfony\Component\Validator\Constraints\NotBlank;
2423
use Symfony\Component\Validator\Tests\Constraints\AbstractConstraintValidatorTest;

Tests/Fixtures/FooSubType.php

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,6 @@
1212
namespace Symfony\Component\Form\Tests\Fixtures;
1313

1414
use Symfony\Component\Form\AbstractType;
15-
use Symfony\Component\Form\FormBuilder;
16-
use Symfony\Component\Form\FormBuilderInterface;
17-
use Symfony\Component\Form\FormFactoryInterface;
18-
use Symfony\Component\EventDispatcher\EventDispatcher;
19-
use Symfony\Component\OptionsResolver\OptionsResolverInterface;
2015

2116
class FooSubType extends AbstractType
2217
{

Tests/Fixtures/FooSubTypeWithParentInstance.php

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,6 @@
1212
namespace Symfony\Component\Form\Tests\Fixtures;
1313

1414
use Symfony\Component\Form\AbstractType;
15-
use Symfony\Component\Form\FormBuilder;
16-
use Symfony\Component\Form\FormBuilderInterface;
17-
use Symfony\Component\Form\FormFactoryInterface;
18-
use Symfony\Component\EventDispatcher\EventDispatcher;
19-
use Symfony\Component\OptionsResolver\OptionsResolverInterface;
2015

2116
class FooSubTypeWithParentInstance extends AbstractType
2217
{

Tests/Fixtures/FooType.php

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,6 @@
1212
namespace Symfony\Component\Form\Tests\Fixtures;
1313

1414
use Symfony\Component\Form\AbstractType;
15-
use Symfony\Component\Form\FormBuilder;
16-
use Symfony\Component\Form\FormBuilderInterface;
17-
use Symfony\Component\Form\FormFactoryInterface;
18-
use Symfony\Component\EventDispatcher\EventDispatcher;
19-
use Symfony\Component\OptionsResolver\OptionsResolverInterface;
2015

2116
class FooType extends AbstractType
2217
{

Tests/FormFactoryTest.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@
1616
use Symfony\Component\Form\Guess\Guess;
1717
use Symfony\Component\Form\Guess\ValueGuess;
1818
use Symfony\Component\Form\Guess\TypeGuess;
19-
use Symfony\Component\Form\Tests\Fixtures\Author;
2019
use Symfony\Component\Form\Tests\Fixtures\FooType;
2120
use Symfony\Component\Form\Tests\Fixtures\FooSubType;
2221
use Symfony\Component\Form\Tests\Fixtures\FooSubTypeWithParentInstance;

Tests/ResolvedFormTypeTest.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@
1414
use Symfony\Component\Form\ResolvedFormType;
1515
use Symfony\Component\Form\FormView;
1616
use Symfony\Component\Form\FormBuilder;
17-
use Symfony\Component\Form\Form;
1817
use Symfony\Component\OptionsResolver\OptionsResolverInterface;
1918

2019
/**

Tests/SimpleFormTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -109,10 +109,10 @@ public function testFalseIsConvertedToNull()
109109
}));
110110

111111
$config = new FormConfigBuilder('name', null, $this->dispatcher);
112-
$config->addEventListener(FormEvents::PRE_BIND, array($mock, 'preBind'));
112+
$config->addEventListener(FormEvents::PRE_SUBMIT, array($mock, 'preBind'));
113113
$form = new Form($config);
114114

115-
$form->bind(false);
115+
$form->submit(false);
116116

117117
$this->assertTrue($form->isValid());
118118
$this->assertNull($form->getData());

0 commit comments

Comments
 (0)