prefix
stringlengths
512
512
suffix
stringlengths
256
256
middle
stringlengths
14
229
meta
dict
ent\EventDispatcher\EventDispatcher; use Symfony\Component\Form\AbstractType; use Symfony\Component\Form\Extension\Csrf\CsrfExtension; use Symfony\Component\Form\Extension\Validator\ViolationMapper\ViolationMapperInterface; use Symfony\Component\Form\FormBuilderInterface; use Symfony\Component\Form\FormError; use Symfo...
tion by // default $builder->add('name', 'Symfony\Component\Form\Extension\Core\Type\TextType'); } } class FormTypeCsrfExtensionTest extends TypeTestCase { protected MockObject&CsrfTokenManagerInterface $tokenManager; protecte
nslator; class FormTypeCsrfExtensionTest_ChildType extends AbstractType { public function buildForm(FormBuilderInterface $builder, array $options): void { // The form needs a child in order to trigger CSRF protec
{ "filepath": "src/Symfony/Component/Form/Tests/Extension/Csrf/Type/FormTypeCsrfExtensionTest.php", "language": "php", "file_size": 13623, "cut_index": 921, "middle_length": 229 }
buted with this source code. */ namespace Symfony\Component\Form\Tests\Extension\Validator; use PHPUnit\Framework\Attributes\DataProvider; use PHPUnit\Framework\TestCase; use Symfony\Component\Form\Extension\Core\Type\CheckboxType; use Symfony\Component\Form\Extension\Core\Type\CollectionType; use Symfony\Component\...
Component\Validator\Constraint; use Symfony\Component\Validator\Constraints\Email; use Symfony\Component\Validator\Constraints\File; use Symfony\Component\Validator\Constraints\IsTrue; use Symfony\Component\Validator\Constraints\Length; use Symfony\Compone
ore\Type\TextType; use Symfony\Component\Form\Extension\Validator\ValidatorTypeGuesser; use Symfony\Component\Form\Guess\Guess; use Symfony\Component\Form\Guess\TypeGuess; use Symfony\Component\Form\Guess\ValueGuess; use Symfony\
{ "filepath": "src/Symfony/Component/Form/Tests/Extension/Validator/ValidatorTypeGuesserTest.php", "language": "php", "file_size": 8493, "cut_index": 716, "middle_length": 229 }
* * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace Symfony\Component\Form\Tests\Extension\Validator\Type; use Symfony\Component\EventDispatcher\EventDispatcher; use Symfony\Component\Form\Extension\Validator\ValidatorExtensi...
{ protected function setUp(): void { $this->dispatcher = new EventDispatcher(); parent::setUp(); } public function testValidationGroupNullByDefault() { $form = $this->createForm(); $this->assertNull($
mfony\Component\Validator\Constraints\GroupSequence; use Symfony\Component\Validator\ValidatorBuilder; /** * @author Bernhard Schussek <bschussek@gmail.com> */ abstract class BaseValidatorExtensionTestCase extends TypeTestCase
{ "filepath": "src/Symfony/Component/Form/Tests/Extension/Validator/Type/BaseValidatorExtensionTestCase.php", "language": "php", "file_size": 3134, "cut_index": 614, "middle_length": 229 }
/* * This file is part of the Symfony package. * * (c) Fabien Potencier <fabien@symfony.com> * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace Symfony\Component\Form\Tests\Extension\Validator\Type; use Symfony\Component...
factory->create(CheckboxType::class, null, $options); } public function testInvalidMessage() { $form = $this->createForm(); $this->assertSame('The checkbox has an invalid value.', $form->getConfig()->getOption('invalid_message
return $this->
{ "filepath": "src/Symfony/Component/Form/Tests/Extension/Validator/Type/CheckboxTypeValidatorExtensionTest.php", "language": "php", "file_size": 800, "cut_index": 517, "middle_length": 14 }
buted with this source code. */ namespace Symfony\Component\Form\Tests; use PHPUnit\Framework\TestCase; use Symfony\Component\Form\Exception\InvalidArgumentException; use Symfony\Component\Form\Exception\LogicException; use Symfony\Component\Form\FormRegistry; use Symfony\Component\Form\FormTypeGuesserChain; use Sym...
eParentType; use Symfony\Component\Form\Tests\Fixtures\NullFormTypeGuesser; use Symfony\Component\Form\Tests\Fixtures\RecursiveFormTypeBar; use Symfony\Component\Form\Tests\Fixtures\RecursiveFormTypeBaz; use Symfony\Component\Form\Tests\Fixtures\RecursiveF
se Symfony\Component\Form\Tests\Fixtures\FooType; use Symfony\Component\Form\Tests\Fixtures\FooTypeBarExtension; use Symfony\Component\Form\Tests\Fixtures\FooTypeBazExtension; use Symfony\Component\Form\Tests\Fixtures\FormWithSam
{ "filepath": "src/Symfony/Component/Form/Tests/FormRegistryTest.php", "language": "php", "file_size": 7057, "cut_index": 716, "middle_length": 229 }
buted with this source code. */ namespace Symfony\Component\Form\Tests; use PHPUnit\Framework\Attributes\DataProvider; use PHPUnit\Framework\TestCase; use Symfony\Component\EventDispatcher\EventDispatcher; use Symfony\Component\Form\AbstractType; use Symfony\Component\Form\AbstractTypeExtension; use Symfony\Componen...
res\ConfigurableFormType; use Symfony\Component\OptionsResolver\Exception\MissingOptionsException; use Symfony\Component\OptionsResolver\OptionsResolver; /** * @author Bernhard Schussek <bschussek@gmail.com> */ class ResolvedFormTypeTest extends TestCas
\FormInterface; use Symfony\Component\Form\FormRegistry; use Symfony\Component\Form\FormView; use Symfony\Component\Form\ResolvedFormType; use Symfony\Component\Form\ResolvedFormTypeFactory; use Symfony\Component\Form\Tests\Fixtu
{ "filepath": "src/Symfony/Component/Form/Tests/ResolvedFormTypeTest.php", "language": "php", "file_size": 8479, "cut_index": 716, "middle_length": 229 }
This file is part of the Symfony package. * * (c) Fabien Potencier <fabien@symfony.com> * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace Symfony\Component\Form\Tests\Flow\Type; use PHPUnit\Framework\TestCase; use Symfony...
form = $this->factory->create(NavigatorFlowType::class); self::assertTrue($form->has('previous')); self::assertTrue($form->has('next')); self::assertTrue($form->has('finish')); self::assertFalse($form->has('reset')); }
FactoryInterface $factory; protected function setUp(): void { $this->factory = Forms::createFormFactoryBuilder()->getFormFactory(); } public function testDefaultOptionsDoNotIncludeReset() { $
{ "filepath": "src/Symfony/Component/Form/Tests/Flow/Type/NavigatorFlowTypeTest.php", "language": "php", "file_size": 1392, "cut_index": 524, "middle_length": 229 }
nterface; use Symfony\Component\Form\FormRegistry; use Symfony\Component\Form\FormView; use Symfony\Component\Form\ResolvedFormTypeFactory; class FormDataCollectorTest extends TestCase { private FormDataCollector $dataCollector; private FormFactory $factory; private FormInterface $form; private FormInt...
d'); $this->view = new FormView(); $this->childView = new FormView(); } public function testBuildPreliminaryFormTree() { $this->form->add($this->childForm); $this->dataCollector->collectConfiguration($this->for
ractor()); $this->factory = new FormFactory(new FormRegistry([new CoreExtension()], new ResolvedFormTypeFactory())); $this->form = $this->createForm('name'); $this->childForm = $this->createChildForm('chil
{ "filepath": "src/Symfony/Component/Form/Tests/Extension/DataCollector/FormDataCollectorTest.php", "language": "php", "file_size": 21326, "cut_index": 1331, "middle_length": 229 }
buted with this source code. */ namespace Symfony\Component\Form\Tests\Extension\PasswordHasher\Type; use PHPUnit\Framework\Attributes\DataProvider; use Symfony\Component\EventDispatcher\EventDispatcher; use Symfony\Component\Form\Exception\InvalidConfigurationException; use Symfony\Component\Form\Extension\Core\Typ...
\TypeTestCase; use Symfony\Component\Form\Tests\Fixtures\RepeatedPasswordField; use Symfony\Component\Form\Tests\Fixtures\User; use Symfony\Component\PasswordHasher\Hasher\MessageDigestPasswordHasher; use Symfony\Component\PasswordHasher\Hasher\PasswordHas
istener\PasswordHasherListener; use Symfony\Component\Form\Extension\PasswordHasher\PasswordHasherExtension; use Symfony\Component\Form\Extension\Validator\ViolationMapper\ViolationMapperInterface; use Symfony\Component\Form\Test
{ "filepath": "src/Symfony/Component/Form/Tests/Extension/PasswordHasher/Type/PasswordTypePasswordHasherExtensionTest.php", "language": "php", "file_size": 8133, "cut_index": 716, "middle_length": 229 }
ge. * * (c) Fabien Potencier <fabien@symfony.com> * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace Symfony\Component\Form\Tests; use PHPUnit\Framework\Attributes\DataProvider; use PHPUnit\Framework\TestCase; use Symfony\C...
indByCodesProvider')] public function testFindByCodes($code, $violationsCount) { $formBuilder = new FormBuilder( 'form', null, new EventDispatcher(), new FormFactory(new FormRegistry([], new R
\FormFactory; use Symfony\Component\Form\FormRegistry; use Symfony\Component\Form\ResolvedFormTypeFactory; use Symfony\Component\Validator\ConstraintViolation; class FormErrorIteratorTest extends TestCase { #[DataProvider('f
{ "filepath": "src/Symfony/Component/Form/Tests/FormErrorIteratorTest.php", "language": "php", "file_size": 2105, "cut_index": 563, "middle_length": 229 }
* * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace Symfony\Component\Form\Tests; use PHPUnit\Framework\TestCase; use Symfony\Component\EventDispatcher\EventDispatcher; use Symfony\Component\Form\Extension\Core\DataMapper\Dat...
parent', ['false_values' => [false]]) ->setCompound(true) ->setDataMapper(new DataMapper()) ->add($this->createBuilder('child', ['false_values' => [null]])) ->getForm(); $this->assertSame(['child' =>
ponent\Form\ResolvedFormTypeFactory; class MissingDataHandlerTest extends TestCase { public function testFalseValuesMatchIsStrict() { $handler = new MissingDataHandler(); $parent = $this->createBuilder('
{ "filepath": "src/Symfony/Component/Form/Tests/MissingDataHandlerTest.php", "language": "php", "file_size": 3553, "cut_index": 614, "middle_length": 229 }
* * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace Symfony\Component\Form\Tests\Flow\DataStorage; use PHPUnit\Framework\TestCase; use Symfony\Component\Form\Flow\DataStorage\SessionDataStorage; use Symfony\Component\HttpFoun...
torage()); $request = new Request(); $request->setSession($this->session); $requestStack = new RequestStack(); $requestStack->push($request); $this->storage = new SessionDataStorage('test_key', $requestStack);
orage; class SessionDataStorageTest extends TestCase { private SessionDataStorage $storage; private Session $session; protected function setUp(): void { $this->session = new Session(new MockArraySessionS
{ "filepath": "src/Symfony/Component/Form/Tests/Flow/DataStorage/SessionDataStorageTest.php", "language": "php", "file_size": 3184, "cut_index": 614, "middle_length": 229 }
\FormFactoryBuilder; use Symfony\Component\Form\FormFactoryInterface; use Symfony\Component\Form\FormInterface; use Symfony\Component\Form\SubmitButtonBuilder; use Symfony\Component\Translation\IdentityTranslator; use Symfony\Component\Validator\Constraint; use Symfony\Component\Validator\Constraints\GroupSequence; use...
mail.com> */ class FormValidatorTest extends ConstraintValidatorTestCase { private EventDispatcher $dispatcher; private FormFactoryInterface $factory; protected function setUp(): void { $this->dispatcher = new EventDispatcher();
traints\Valid; use Symfony\Component\Validator\Context\ExecutionContext; use Symfony\Component\Validator\Test\ConstraintValidatorTestCase; use Symfony\Component\Validator\Validation; /** * @author Bernhard Schussek <bschussek@g
{ "filepath": "src/Symfony/Component/Form/Tests/Extension/Validator/Constraints/FormValidatorTest.php", "language": "php", "file_size": 24247, "cut_index": 1331, "middle_length": 229 }
buted with this source code. */ namespace Symfony\Component\Form\Tests\Flow; use PHPUnit\Framework\TestCase; use Symfony\Component\Form\Exception\InvalidArgumentException; use Symfony\Component\Form\Flow\FormFlowCursor; class FormFlowCursorTest extends TestCase { private static array $steps = ['personal', 'prof...
xpectExceptionMessage('Step "invalid" does not exist. Available steps are: "personal", "professional", "account".'); new FormFlowCursor(self::$steps, 'invalid'); } public function testGetSteps() { $cursor = new FormFlowCursor(
r->getSteps()); $this->assertSame('personal', $cursor->getCurrentStep()); } public function testConstructorWithInvalidStep() { $this->expectException(InvalidArgumentException::class); $this->e
{ "filepath": "src/Symfony/Component/Form/Tests/Flow/FormFlowCursorTest.php", "language": "php", "file_size": 6736, "cut_index": 716, "middle_length": 229 }
part of the Symfony package. * * (c) Fabien Potencier <fabien@symfony.com> * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace Symfony\Component\Form\Tests; use PHPUnit\Framework\TestCase; use Symfony\Component\Form\FormFac...
tory->getProperty('registry'); $this->type = new FooType(); } public function testAddType() { $factoryBuilder = new FormFactoryBuilder(); $factoryBuilder->addType($this->type); $factory = $factoryBuilder->getF
Test extends TestCase { private \ReflectionProperty $registry; private FooType $type; protected function setUp(): void { $factory = new \ReflectionClass(FormFactory::class); $this->registry = $fac
{ "filepath": "src/Symfony/Component/Form/Tests/FormFactoryBuilderTest.php", "language": "php", "file_size": 1774, "cut_index": 537, "middle_length": 229 }
; use Symfony\Component\Form\FormError; use Symfony\Component\Form\FormInterface; class DateIntervalTypeTest extends BaseTypeTestCase { public const TESTED_TYPE = DateIntervalType::class; public function testSubmitDateInterval() { $form = $this->factory->create(static::TESTED_TYPE, null, ['input' ...
'7', 'months' => '6', 'days' => '5', ]); $this->assertSame('P7Y6M5D', $form->getData()); } public function testSubmitArray() { $form = $this->factory->create(static::TESTED_TYPE, null, ['input'
Interval('P7Y6M5D'), $form->getData()); } public function testSubmitString() { $form = $this->factory->create(static::TESTED_TYPE, null, ['input' => 'string']); $form->submit([ 'years' =>
{ "filepath": "src/Symfony/Component/Form/Tests/Extension/Core/Type/DateIntervalTypeTest.php", "language": "php", "file_size": 15646, "cut_index": 921, "middle_length": 229 }
ge. * * (c) Fabien Potencier <fabien@symfony.com> * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace Symfony\Component\Form\Tests\Extension\Core\Type; use Symfony\Component\Form\Extension\Core\Type\UrlType; use Symfony\Comp...
'ftp://www.domain.com', $form->getData()); $this->assertSame('ftp://www.domain.com', $form->getViewData()); } public function testSubmitAddsNoDefaultProtocolIfEmpty() { $form = $this->factory->create(static::TESTED_TYPE, null,
otocolIfAlreadyIncluded() { $form = $this->factory->create(static::TESTED_TYPE, null, [ 'default_protocol' => 'http', ]); $form->submit('ftp://www.domain.com'); $this->assertSame(
{ "filepath": "src/Symfony/Component/Form/Tests/Extension/Core/Type/UrlTypeTest.php", "language": "php", "file_size": 2815, "cut_index": 563, "middle_length": 229 }
buted with this source code. */ namespace Symfony\Component\Form\Tests\Extension\Core\Type; use PHPUnit\Framework\Attributes\DataProvider; use Symfony\Component\Form\Extension\Core\Type\RepeatedType; use Symfony\Component\Form\Extension\Core\Type\TextType; use Symfony\Component\Form\Form; use Symfony\Component\Form\...
YPE, ]); } public function testSetData() { $this->form->setData('foobar'); $this->assertSame('foobar', $this->form['first']->getData()); $this->assertSame('foobar', $this->form['second']->getData()); }
dType::class; protected Form $form; protected function setUp(): void { parent::setUp(); $this->form = $this->factory->create(static::TESTED_TYPE, null, [ 'type' => TextTypeTest::TESTED_T
{ "filepath": "src/Symfony/Component/Form/Tests/Extension/Core/Type/RepeatedTypeTest.php", "language": "php", "file_size": 8849, "cut_index": 716, "middle_length": 229 }
/* * This file is part of the Symfony package. * * (c) Fabien Potencier <fabien@symfony.com> * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace Symfony\Component\Form\Tests\Extension\Core\Type; use Symfony\Component\Form\...
()->vars['value']); } public function testSubmitNullUsesDefaultEmptyData($emptyData = '', $expectedData = null) { $form = $this->factory->create(static::TESTED_TYPE, null, [ 'empty_data' => $emptyData, ]); $
UuidToView() { $uuid = '123e4567-e89b-12d3-a456-426655440000'; $form = $this->factory->create(static::TESTED_TYPE); $form->setData(new Uuid($uuid)); $this->assertSame($uuid, $form->createView
{ "filepath": "src/Symfony/Component/Form/Tests/Extension/Core/Type/UuidTypeTest.php", "language": "php", "file_size": 1220, "cut_index": 518, "middle_length": 229 }
mfony\Component\Form\FormError; class WeekTypeTest extends BaseTypeTestCase { public const TESTED_TYPE = WeekType::class; public function testSubmitArray() { $form = $this->factory->create(static::TESTED_TYPE, null, [ 'widget' => 'choice', 'input' => 'array', ]); ...
([ 'year' => '2019', 'week' => '1', ]); $this->assertEquals('2019-W01', $form->getData()); } public function testSubmitStringSingleText() { $form = $this->factory->create(static::TESTED_TYPE, nu
ion testSubmitString() { $form = $this->factory->create(static::TESTED_TYPE, null, [ 'years' => [2019], 'input' => 'string', 'widget' => 'choice', ]); $form->submit
{ "filepath": "src/Symfony/Component/Form/Tests/Extension/Core/Type/WeekTypeTest.php", "language": "php", "file_size": 9941, "cut_index": 921, "middle_length": 229 }
ge. * * (c) Fabien Potencier <fabien@symfony.com> * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace Symfony\Component\Form\Tests\Extension\Core\EventListener; use PHPUnit\Framework\Attributes\DataProvider; use PHPUnit\Fram...
ew Form(new FormConfigBuilder('name', null, new EventDispatcher())); $event = new FormEvent($form, $data); $filter = new FixUrlProtocolListener('http'); $filter->onSubmit($event); $this->assertSame('http://'.$data, $event-
ony\Component\Form\FormConfigBuilder; use Symfony\Component\Form\FormEvent; class FixUrlProtocolListenerTest extends TestCase { #[DataProvider('provideUrlToFix')] public function testFixUrl($data) { $form = n
{ "filepath": "src/Symfony/Component/Form/Tests/Extension/Core/EventListener/FixUrlProtocolListenerTest.php", "language": "php", "file_size": 2200, "cut_index": 563, "middle_length": 229 }
he Symfony package. * * (c) Fabien Potencier <fabien@symfony.com> * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace Symfony\Component\Form\Tests\Extension\Core\EventListener; use Symfony\Component\EventDispatcher\EventDisp...
d function getData(array $data) { return new \ArrayObject($data); } protected function getBuilder($name = 'name'): FormBuilderInterface { return new FormBuilder($name, \ArrayObject::class, new EventDispatcher(), (new FormFa
tends MergeCollectionListenerTestCase { protecte
{ "filepath": "src/Symfony/Component/Form/Tests/Extension/Core/EventListener/MergeCollectionListenerArrayObjectTest.php", "language": "php", "file_size": 899, "cut_index": 547, "middle_length": 52 }
file is part of the Symfony package. * * (c) Fabien Potencier <fabien@symfony.com> * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace Symfony\Component\Form\Tests\Extension\Core\EventListener; use Symfony\Component\EventDi...
protected function getData(array $data) { return $data; } protected function getBuilder($name = 'name'): FormBuilderInterface { return new FormBuilder($name, null, new EventDispatcher(), (new FormFactoryBuilder())->getF
ArrayTest extends MergeCollectionListenerTestCase {
{ "filepath": "src/Symfony/Component/Form/Tests/Extension/Core/EventListener/MergeCollectionListenerArrayTest.php", "language": "php", "file_size": 860, "cut_index": 529, "middle_length": 52 }
<?php /* * This file is part of the Symfony package. * * (c) Fabien Potencier <fabien@symfony.com> * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace Symfony\Component\Form\Tests\Extension\Core\EventListener; use Symfony\...
$data); } protected function getBuilder($name = 'name'): FormBuilderInterface { return new FormBuilder($name, 'Symfony\Component\Form\Tests\Fixtures\CustomArrayObject', new EventDispatcher(), (new FormFactoryBuilder())->getFormFactory(
omponent\Form\Tests\Fixtures\CustomArrayObject; class MergeCollectionListenerCustomArrayObjectTest extends MergeCollectionListenerTestCase { protected function getData(array $data) { return new CustomArrayObject(
{ "filepath": "src/Symfony/Component/Form/Tests/Extension/Core/EventListener/MergeCollectionListenerCustomArrayObjectTest.php", "language": "php", "file_size": 1009, "cut_index": 512, "middle_length": 229 }
buted with this source code. */ namespace Symfony\Component\Form\Tests\Extension\Core\EventListener; use PHPUnit\Framework\Attributes\DataProvider; use PHPUnit\Framework\TestCase; use Symfony\Component\Form\Exception\UnexpectedTypeException; use Symfony\Component\Form\Extension\Core\EventListener\MergeCollectionList...
protected function getForm($name = 'name', $propertyPath = null) { $propertyPath ??= $name; return $this->getBuilder($name)->setAttribute('property_path', $propertyPath)->getForm(); } public static function getBooleanMatrix1()
estCase { protected FormInterface $form; protected function setUp(): void { $this->form = $this->getForm('axes'); } abstract protected function getBuilder($name = 'name'): FormBuilderInterface;
{ "filepath": "src/Symfony/Component/Form/Tests/Extension/Core/EventListener/MergeCollectionListenerTestCase.php", "language": "php", "file_size": 7217, "cut_index": 716, "middle_length": 229 }
t\EventDispatcher\EventDispatcher; use Symfony\Component\Form\AbstractType; use Symfony\Component\Form\Event\PostSetDataEvent; use Symfony\Component\Form\Exception\UnexpectedTypeException; use Symfony\Component\Form\Extension\Core\DataMapper\DataMapper; use Symfony\Component\Form\Extension\Core\EventListener\ResizeForm...
er; protected function setUp(): void { $this->factory = (new FormFactoryBuilder())->getFormFactory(); $this->builder = $this->getBuilder() ->setCompound(true) ->setDataMapper(new DataMapper()); } pr
; use Symfony\Component\Form\FormFactoryBuilder; use Symfony\Component\Form\FormFactoryInterface; class ResizeFormListenerTest extends TestCase { private FormFactoryInterface $factory; private FormBuilderInterface $build
{ "filepath": "src/Symfony/Component/Form/Tests/Extension/Core/EventListener/ResizeFormListenerTest.php", "language": "php", "file_size": 11016, "cut_index": 921, "middle_length": 229 }
This file is part of the Symfony package. * * (c) Fabien Potencier <fabien@symfony.com> * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace Symfony\Component\Form\Tests\Extension\Core\EventListener; use PHPUnit\Framework\Te...
EventDispatcher())); $event = new FormEvent($form, $data); $filter = new TrimListener(); $filter->preSubmit($event); $this->assertEquals('Foo!', $event->getData()); } public function testTrimSkipNonStrings() {
\FormConfigBuilder; use Symfony\Component\Form\FormEvent; class TrimListenerTest extends TestCase { public function testTrim() { $data = ' Foo! '; $form = new Form(new FormConfigBuilder('name', null, new
{ "filepath": "src/Symfony/Component/Form/Tests/Extension/Core/EventListener/TrimListenerTest.php", "language": "php", "file_size": 1300, "cut_index": 524, "middle_length": 229 }
* * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace Symfony\Component\Form\Tests\Extension\Core\DataTransformer; use PHPUnit\Framework\TestCase; use Symfony\Component\Form\Exception\TransformationFailedException; use Symfony\...
$input = [ 'a' => '1', 'b' => '2', 'c' => '3', 'd' => '4', 'e' => '5', 'f' => '6', ]; $output = [ 'first' => [ 'a' => '1',
nction setUp(): void { $this->transformer = new ArrayToPartsTransformer([ 'first' => ['a', 'b', 'c'], 'second' => ['d', 'e', 'f'], ]); } public function testTransform() {
{ "filepath": "src/Symfony/Component/Form/Tests/Extension/Core/DataTransformer/ArrayToPartsTransformerTest.php", "language": "php", "file_size": 3408, "cut_index": 614, "middle_length": 229 }
This file is part of the Symfony package. * * (c) Fabien Potencier <fabien@symfony.com> * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace Symfony\Component\Form\Tests\Extension\Core\DataTransformer; use PHPUnit\Framework\...
exist'); $this->createDateTimeTransformer('this_timezone_does_not_exist'); } public function testConstructFailsIfOutputTimezoneIsInvalid() { $this->expectException(InvalidArgumentException::class); $this->expectExceptio
merTestCase extends TestCase { public function testConstructFailsIfInputTimezoneIsInvalid() { $this->expectException(InvalidArgumentException::class); $this->expectExceptionMessage('this_timezone_does_not_
{ "filepath": "src/Symfony/Component/Form/Tests/Extension/Core/DataTransformer/BaseDateTimeTransformerTestCase.php", "language": "php", "file_size": 1287, "cut_index": 524, "middle_length": 229 }
ge. * * (c) Fabien Potencier <fabien@symfony.com> * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace Symfony\Component\Form\Tests\Extension\Core\DataTransformer; use PHPUnit\Framework\TestCase; use Symfony\Component\Form\Ex...
ToStringTransformer(self::TRUE_VALUE); } public function testTransform() { $this->assertEquals(self::TRUE_VALUE, $this->transformer->transform(true)); $this->assertNull($this->transformer->transform(false)); } // https
ss BooleanToStringTransformerTest extends TestCase { private const TRUE_VALUE = '1'; protected BooleanToStringTransformer $transformer; protected function setUp(): void { $this->transformer = new Boolean
{ "filepath": "src/Symfony/Component/Form/Tests/Extension/Core/DataTransformer/BooleanToStringTransformerTest.php", "language": "php", "file_size": 2757, "cut_index": 563, "middle_length": 229 }
ge. * * (c) Fabien Potencier <fabien@symfony.com> * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace Symfony\Component\Form\Tests\Extension\Core\DataTransformer; use PHPUnit\Framework\Attributes\DataProvider; use PHPUnit\Fr...
Up(): void { $list = new ArrayChoiceList(['', false, 'X', true]); $listWithNull = new ArrayChoiceList(['', false, 'X', null]); $this->transformer = new ChoiceToValueTransformer($list); $this->transformerWithNull = new C
former\ChoiceToValueTransformer; class ChoiceToValueTransformerTest extends TestCase { protected ChoiceToValueTransformer $transformer; protected ChoiceToValueTransformer $transformerWithNull; protected function set
{ "filepath": "src/Symfony/Component/Form/Tests/Extension/Core/DataTransformer/ChoiceToValueTransformerTest.php", "language": "php", "file_size": 2798, "cut_index": 563, "middle_length": 229 }
ge. * * (c) Fabien Potencier <fabien@symfony.com> * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace Symfony\Component\Form\Tests\Extension\Core\DataTransformer; use PHPUnit\Framework\TestCase; use Symfony\Component\Form\Ch...
rayChoiceList(['', false, 'X']); $listWithNull = new ArrayChoiceList(['', false, 'X', null]); $this->transformer = new ChoicesToValuesTransformer($list); $this->transformerWithNull = new ChoicesToValuesTransformer($listWithNull);
esToValuesTransformerTest extends TestCase { protected ChoicesToValuesTransformer $transformer; protected ChoicesToValuesTransformer $transformerWithNull; protected function setUp(): void { $list = new Ar
{ "filepath": "src/Symfony/Component/Form/Tests/Extension/Core/DataTransformer/ChoicesToValuesTransformerTest.php", "language": "php", "file_size": 2598, "cut_index": 563, "middle_length": 229 }
hp /* * This file is part of the Symfony package. * * (c) Fabien Potencier <fabien@symfony.com> * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace Symfony\Component\Form\Tests\Extension\Core\DataTransformer; use PHPUnit\F...
); $this->assertEquals('baz', $chain->transform('foo')); } public function testReverseTransform() { $chain = new DataTransformerChain([ new FixedDataTransformer(['baz' => 'bar']), new FixedDataTransform
st extends TestCase { public function testTransform() { $chain = new DataTransformerChain([ new FixedDataTransformer(['foo' => 'bar']), new FixedDataTransformer(['bar' => 'baz']), ]
{ "filepath": "src/Symfony/Component/Form/Tests/Extension/Core/DataTransformer/DataTransformerChainTest.php", "language": "php", "file_size": 1112, "cut_index": 515, "middle_length": 229 }
buted with this source code. */ namespace Symfony\Component\Form\Tests\Extension\Core\DataTransformer; use Symfony\Component\Form\Exception\TransformationFailedException; use Symfony\Component\Form\Exception\UnexpectedTypeException; use Symfony\Component\Form\Extension\Core\DataTransformer\DateIntervalToArrayTransfo...
'hours' => '4', 'minutes' => '5', 'seconds' => '6', 'invert' => false, ]; $this->assertSame($output, $transformer->transform($input)); } public function testTransformEmpty() { $trans
$transformer = new DateIntervalToArrayTransformer(); $input = new \DateInterval('P1Y2M3DT4H5M6S'); $output = [ 'years' => '1', 'months' => '2', 'days' => '3',
{ "filepath": "src/Symfony/Component/Form/Tests/Extension/Core/DataTransformer/DateIntervalToArrayTransformerTest.php", "language": "php", "file_size": 9138, "cut_index": 716, "middle_length": 229 }
* * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace Symfony\Component\Form\Tests\Extension\Core\DataTransformer; use PHPUnit\Framework\Attributes\DataProvider; use Symfony\Component\Form\Exception\TransformationFailedExceptio...
0DT00H00M00S', 'PT0S'], ['P%yY%mM%dDT%hH%iM%sS', 'P0Y0M0DT0H0M0S', 'PT0S'], ['P%yY%mM%dDT%hH%iM%sS', 'P10Y2M3DT16H5M6S', 'P10Y2M3DT16H5M6S'], ['P%yY%mM%dDT%hH%iM', 'P10Y2M3DT16H5M', 'P10Y2M3DT16H5M'], ['P%yY%
ffen.rosskamp@gimmickmedia.de> */ class DateIntervalToStringTransformerTest extends DateIntervalTestCase { public static function dataProviderISO(): array { return [ ['P%YY%MM%DDT%HH%IM%SS', 'P00Y00M0
{ "filepath": "src/Symfony/Component/Form/Tests/Extension/Core/DataTransformer/DateIntervalToStringTransformerTest.php", "language": "php", "file_size": 4231, "cut_index": 614, "middle_length": 229 }
ge. * * (c) Fabien Potencier <fabien@symfony.com> * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace Symfony\Component\Form\Tests\Extension\Core\DataTransformer; use PHPUnit\Framework\Attributes\DataProvider; use PHPUnit\Fr...
leToDateTimeTransformer(); $actualOutput = $transformer->transform($input); $this->assertEquals($expectedOutput, $actualOutput); $this->assertEquals($expectedOutput->getTimezone(), $actualOutput->getTimezone()); } public
ateTimeImmutableToDateTimeTransformerTest extends TestCase { #[DataProvider('provider')] public function testTransform(\DateTime $expectedOutput, \DateTimeImmutable $input) { $transformer = new DateTimeImmutab
{ "filepath": "src/Symfony/Component/Form/Tests/Extension/Core/DataTransformer/DateTimeImmutableToDateTimeTransformerTest.php", "language": "php", "file_size": 2971, "cut_index": 563, "middle_length": 229 }
nsion\Core\DataTransformer\BaseDateTimeTransformer; use Symfony\Component\Form\Extension\Core\DataTransformer\DateTimeToArrayTransformer; class DateTimeToArrayTransformerTest extends BaseDateTimeTransformerTestCase { public function testTransform() { $transformer = new DateTimeToArrayTransformer('UTC',...
DateTimeToArrayTransformer(); $output = [ 'year' => '', 'month' => '', 'day' => '', 'hour' => '', 'minute' => '', 'second' => '', ]; $this->assertSame($output
=> '4', 'minute' => '5', 'second' => '6', ]; $this->assertSame($output, $transformer->transform($input)); } public function testTransformEmpty() { $transformer = new
{ "filepath": "src/Symfony/Component/Form/Tests/Extension/Core/DataTransformer/DateTimeToArrayTransformerTest.php", "language": "php", "file_size": 16470, "cut_index": 921, "middle_length": 229 }
buted with this source code. */ namespace Symfony\Component\Form\Tests\Extension\Core\DataTransformer; use PHPUnit\Framework\Attributes\DataProvider; use Symfony\Component\Form\Exception\TransformationFailedException; use Symfony\Component\Form\Extension\Core\DataTransformer\BaseDateTimeTransformer; use Symfony\Comp...
6 UTC', '2010-02-03T04:05:06', true], ['UTC', 'UTC', null, '', true], ['America/New_York', 'Asia/Hong_Kong', '2010-02-03 04:05:06 America/New_York', '2010-02-03T17:05:06', true], ['America/New_York', 'Asia/Hong_Kong', nu
Html5LocalDateTimeTransformerTest extends BaseDateTimeTransformerTestCase { use DateTimeEqualsTrait; public static function transformProvider(): array { return [ ['UTC', 'UTC', '2010-02-03 04:05:0
{ "filepath": "src/Symfony/Component/Form/Tests/Extension/Core/DataTransformer/DateTimeToHtml5LocalDateTimeTransformerTest.php", "language": "php", "file_size": 5645, "cut_index": 716, "middle_length": 229 }
aTransformer\Traits\DateTimeEqualsTrait; use Symfony\Component\Intl\Util\IntlTestHelper; class DateTimeToLocalizedStringTransformerTest extends BaseDateTimeTransformerTestCase { use DateTimeEqualsTrait; protected \DateTime $dateTime; protected \DateTime $dateTimeWithoutSeconds; private string $default...
equireFullIntl($this, '57.1'); $this->defaultLocale = \Locale::getDefault(); \Locale::setDefault('de_AT'); $this->dateTime = new \DateTime('2010-02-03 04:05:06 UTC'); $this->dateTimeWithoutSeconds = new \DateTime('2010-02-
if (\extension_loaded('intl')) { $this->initialTestCaseUseException = ini_set('intl.use_exceptions', 0); } // Since we test against "de_AT", we need the full implementation IntlTestHelper::r
{ "filepath": "src/Symfony/Component/Form/Tests/Extension/Core/DataTransformer/DateTimeToLocalizedStringTransformerTest.php", "language": "php", "file_size": 18623, "cut_index": 1331, "middle_length": 229 }
buted with this source code. */ namespace Symfony\Component\Form\Tests\Extension\Core\DataTransformer; use PHPUnit\Framework\Attributes\DataProvider; use Symfony\Component\Form\Exception\TransformationFailedException; use Symfony\Component\Form\Extension\Core\DataTransformer\BaseDateTimeTransformer; use Symfony\Comp...
teTime = new \DateTime('2010-02-03 04:05:06 UTC'); $this->dateTimeWithoutSeconds = new \DateTime('2010-02-03 04:05:00 UTC'); } public static function allProvider(): array { return [ ['UTC', 'UTC', '2010-02-03 04:05:
sformerTest extends BaseDateTimeTransformerTestCase { use DateTimeEqualsTrait; protected \DateTime $dateTime; protected \DateTime $dateTimeWithoutSeconds; protected function setUp(): void { $this->da
{ "filepath": "src/Symfony/Component/Form/Tests/Extension/Core/DataTransformer/DateTimeToRfc3339TransformerTest.php", "language": "php", "file_size": 5173, "cut_index": 716, "middle_length": 229 }
buted with this source code. */ namespace Symfony\Component\Form\Tests\Extension\Core\DataTransformer; use PHPUnit\Framework\Attributes\DataProvider; use Symfony\Component\Form\Exception\TransformationFailedException; use Symfony\Component\Form\Extension\Core\DataTransformer\BaseDateTimeTransformer; use Symfony\Comp...
16:05', '2010-02-03 16:05:00 UTC'], ['Y-m-d H', '2010-02-03 16', '2010-02-03 16:00:00 UTC'], ['Y-m-d', '2010-02-03', '2010-02-03 00:00:00 UTC'], ['Y-m', '2010-12', '2010-12-01 00:00:00 UTC'], ['Y', '2010', '2
): array { return [ ['Y-m-d H:i:s', '2010-02-03 16:05:06', '2010-02-03 16:05:06 UTC'], ['Y-m-d H:i:00', '2010-02-03 16:05:00', '2010-02-03 16:05:00 UTC'], ['Y-m-d H:i', '2010-02-03
{ "filepath": "src/Symfony/Component/Form/Tests/Extension/Core/DataTransformer/DateTimeToStringTransformerTest.php", "language": "php", "file_size": 6929, "cut_index": 716, "middle_length": 229 }
* * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace Symfony\Component\Form\Tests\Extension\Core\DataTransformer; use Symfony\Component\Form\Exception\TransformationFailedException; use Symfony\Component\Form\Extension\Core\Da...
'U'); $this->assertEquals($output, $transformer->transform($input)); } public function testTransformEmpty() { $transformer = new DateTimeToTimestampTransformer(); $this->assertNull($transformer->transform(null));
ransformerTestCase { public function testTransform() { $transformer = new DateTimeToTimestampTransformer('UTC', 'UTC'); $input = new \DateTime('2010-02-03 04:05:06 UTC'); $output = $input->format(
{ "filepath": "src/Symfony/Component/Form/Tests/Extension/Core/DataTransformer/DateTimeToTimestampTransformerTest.php", "language": "php", "file_size": 4110, "cut_index": 614, "middle_length": 229 }
part of the Symfony package. * * (c) Fabien Potencier <fabien@symfony.com> * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace Symfony\Component\Form\Tests\Extension\Core\DataTransformer; use PHPUnit\Framework\TestCase; use...
erseTransform(null)); $this->assertSame('Europe/Amsterdam', $transformer->transform(new \DateTimeZone('Europe/Amsterdam'))); $this->assertEquals(new \DateTimeZone('Europe/Amsterdam'), $transformer->reverseTransform('Europe/Amsterdam'));
erTest extends TestCase { public function testSingle() { $transformer = new DateTimeZoneToStringTransformer(); $this->assertNull($transformer->transform(null)); $this->assertNull($transformer->rev
{ "filepath": "src/Symfony/Component/Form/Tests/Extension/Core/DataTransformer/DateTimeZoneToStringTransformerTest.php", "language": "php", "file_size": 1903, "cut_index": 537, "middle_length": 229 }
t\Form\Exception\TransformationFailedException; use Symfony\Component\Form\Extension\Core\DataTransformer\IntegerToLocalizedStringTransformer; use Symfony\Component\Intl\Util\IntlTestHelper; class IntegerToLocalizedStringTransformerTest extends TestCase { private string $defaultLocale; protected function setU...
G], [1234.4, '1235', \NumberFormatter::ROUND_CEILING], [-1234.5, '-1234', \NumberFormatter::ROUND_CEILING], [-1234.4, '-1234', \NumberFormatter::ROUND_CEILING], // towards negative infinity (1.6 -> 1, -1.6 ->
>defaultLocale); } public static function transformWithRoundingProvider() { return [ // towards positive infinity (1.6 -> 2, -1.6 -> -1) [1234.5, '1235', \NumberFormatter::ROUND_CEILIN
{ "filepath": "src/Symfony/Component/Form/Tests/Extension/Core/DataTransformer/IntegerToLocalizedStringTransformerTest.php", "language": "php", "file_size": 10668, "cut_index": 921, "middle_length": 229 }
ge. * * (c) Fabien Potencier <fabien@symfony.com> * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace Symfony\Component\Form\Tests\Extension\Core\DataTransformer; use PHPUnit\Framework\Attributes\RequiresPhpExtension; use PH...
transform(null)); $this->assertNull($transformer->reverseTransform(null)); $this->assertSame('Europe/Amsterdam', $transformer->transform(\IntlTimeZone::createTimeZone('Europe/Amsterdam'))); $this->assertEquals(\IntlTimeZone::create
iresPhpExtension('intl')] class IntlTimeZoneToStringTransformerTest extends TestCase { public function testSingle() { $transformer = new IntlTimeZoneToStringTransformer(); $this->assertNull($transformer->
{ "filepath": "src/Symfony/Component/Form/Tests/Extension/Core/DataTransformer/IntlTimeZoneToStringTransformerTest.php", "language": "php", "file_size": 2038, "cut_index": 563, "middle_length": 229 }
* * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace Symfony\Component\Form\Tests\Extension\Core\DataTransformer; use PHPUnit\Framework\TestCase; use Symfony\Component\Form\Exception\TransformationFailedException; use Symfony\...
(); } protected function tearDown(): void { setlocale(\LC_ALL, $this->previousLocale); \Locale::setDefault($this->defaultLocale); } public function testTransform() { // Since we test against "de_AT", we nee
private string|false $previousLocale; private string $defaultLocale; protected function setUp(): void { $this->previousLocale = setlocale(\LC_ALL, '0'); $this->defaultLocale = \Locale::getDefault
{ "filepath": "src/Symfony/Component/Form/Tests/Extension/Core/DataTransformer/MoneyToLocalizedStringTransformerTest.php", "language": "php", "file_size": 4314, "cut_index": 614, "middle_length": 229 }
alTestCaseUseException; protected function setUp(): void { // Normalize intl. configuration settings. if (\extension_loaded('intl')) { $this->initialTestCaseUseException = ini_set('intl.use_exceptions', 0); } $this->defaultLocale = \Locale::getDefault(); \Lo...
'1', 'de_AT'], [1.5, '1,5', 'de_AT'], [1234.5, '1234,5', 'de_AT'], [12345.912, '12345,912', 'de_AT'], [1234.5, '1234,5', 'ru'], [1234.5, '1234,5', 'fi'], ]; } #[DataProvider('pro
ntl.use_exceptions', $this->initialTestCaseUseException); } } public static function provideTransformations() { return [ [null, '', 'de_AT'], ['', '', 'de_AT'], [1,
{ "filepath": "src/Symfony/Component/Form/Tests/Extension/Core/DataTransformer/NumberToLocalizedStringTransformerTest.php", "language": "php", "file_size": 30394, "cut_index": 1331, "middle_length": 229 }
tialTestCaseUseException; protected function setUp(): void { // Normalize intl. configuration settings. if (\extension_loaded('intl')) { $this->initialTestCaseUseException = ini_set('intl.use_exceptions', 0); } $this->defaultLocale = \Locale::getDefault(); \...
$this->assertEquals('10', $transformer->transform(0.1)); $this->assertEquals('15', $transformer->transform(0.15)); $this->assertEquals('12', $transformer->transform(0.1234)); $this->assertEquals('200', $transformer->transform
'intl.use_exceptions', $this->initialTestCaseUseException); } } public function testTransform() { $transformer = new PercentToLocalizedStringTransformer(null, null, \NumberFormatter::ROUND_HALFUP);
{ "filepath": "src/Symfony/Component/Form/Tests/Extension/Core/DataTransformer/PercentToLocalizedStringTransformerTest.php", "language": "php", "file_size": 25207, "cut_index": 1331, "middle_length": 229 }
ge. * * (c) Fabien Potencier <fabien@symfony.com> * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace Symfony\Component\Form\Tests\Extension\Core\DataTransformer; use PHPUnit\Framework\Attributes\DataProvider; use PHPUnit\Fr...
23', 1.23], ]; } #[DataProvider('provideTransformations')] public function testTransform($from, $to) { $transformer = new StringToFloatTransformer(); $this->assertSame($to, $transformer->transform($from)); }
ansformerTest extends TestCase { public static function provideTransformations(): array { return [ [null, null], ['1', 1.], ['1.', 1.], ['1.0', 1.], ['1.
{ "filepath": "src/Symfony/Component/Form/Tests/Extension/Core/DataTransformer/StringToFloatTransformerTest.php", "language": "php", "file_size": 2435, "cut_index": 563, "middle_length": 229 }
ge. * * (c) Fabien Potencier <fabien@symfony.com> * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace Symfony\Component\Form\Tests\Extension\Core\DataTransformer; use PHPUnit\Framework\Attributes\DataProvider; use PHPUnit\Fr...
} #[DataProvider('provideValidUlid')] public function testTransform($output, $input) { $transformer = new UlidToStringTransformer(); $input = new Ulid($input); $this->assertEquals($output, $transformer->transform($i
id\Ulid; class UlidToStringTransformerTest extends TestCase { public static function provideValidUlid() { return [ ['01D85PP1982GF6KTVFHQ7W78FB', new Ulid('01d85pp1982gf6ktvfhq7w78fb')], ];
{ "filepath": "src/Symfony/Component/Form/Tests/Extension/Core/DataTransformer/UlidToStringTransformerTest.php", "language": "php", "file_size": 2468, "cut_index": 563, "middle_length": 229 }
ge. * * (c) Fabien Potencier <fabien@symfony.com> * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace Symfony\Component\Form\Tests\Extension\Core\DataTransformer; use PHPUnit\Framework\TestCase; use Symfony\Component\Form\Ex...
transform(new UuidV1('123e4567-e89b-12d3-a456-426655440000'))); } public function testTransformEmpty() { $transformer = new UuidToStringTransformer(); $this->assertNull($transformer->transform(null)); } public functio
ss UuidToStringTransformerTest extends TestCase { public function testTransform() { $transformer = new UuidToStringTransformer(); $this->assertEquals('123e4567-e89b-12d3-a456-426655440000', $transformer->
{ "filepath": "src/Symfony/Component/Form/Tests/Extension/Core/DataTransformer/UuidToStringTransformerTest.php", "language": "php", "file_size": 2300, "cut_index": 563, "middle_length": 229 }
part of the Symfony package. * * (c) Fabien Potencier <fabien@symfony.com> * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace Symfony\Component\Form\Tests\Extension\Core\Type; use PHPUnit\Framework\Attributes\DataProvider;...
c::TESTED_TYPE, 'name', array_merge($this->getTestOptions(), [ 'empty_data' => '', ])); $form->submit(null); $this->assertSame('', $form->getData()); $this->assertSame('', $form->getNormData()); $this->a
pected = null, $norm = null, $view = null) { parent::testSubmitNull($expected, $norm, ''); } public function testSubmitNullReturnsNullWithEmptyDataAsString() { $form = $this->factory->create(stati
{ "filepath": "src/Symfony/Component/Form/Tests/Extension/Core/Type/TextTypeTest.php", "language": "php", "file_size": 1790, "cut_index": 537, "middle_length": 229 }
buted with this source code. */ namespace Symfony\Component\Form\Tests\Extension\Core\Type; use PHPUnit\Framework\Attributes\RequiresPhpExtension; use Symfony\Component\Form\ChoiceList\View\ChoiceView; use Symfony\Component\Form\Exception\LogicException; use Symfony\Component\Form\Extension\Core\Type\TimezoneType; u...
a'), $choices); $this->assertContainsEquals(new ChoiceView('America/New_York', 'America/New_York', 'America / New York'), $choices); } public function testSubmitNull($expected = null, $norm = null, $view = null) { parent::testS
table() { $choices = $this->factory->create(static::TESTED_TYPE) ->createView()->vars['choices']; $this->assertContainsEquals(new ChoiceView('Africa/Kinshasa', 'Africa/Kinshasa', 'Africa / Kinshas
{ "filepath": "src/Symfony/Component/Form/Tests/Extension/Core/Type/TimezoneTypeTest.php", "language": "php", "file_size": 7206, "cut_index": 716, "middle_length": 229 }
/* * This file is part of the Symfony package. * * (c) Fabien Potencier <fabien@symfony.com> * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace Symfony\Component\Form\Tests\Extension\Core\Type; use Symfony\Component\Form\...
value']); } public function testSubmitNullUsesDefaultEmptyData($emptyData = '', $expectedData = null) { $form = $this->factory->create(static::TESTED_TYPE, null, [ 'empty_data' => $emptyData, ]); $form->subm
UlidToView() { $ulid = '01D85PP1982GF6KTVFHQ7W78FB'; $form = $this->factory->create(static::TESTED_TYPE); $form->setData(new Ulid($ulid)); $this->assertSame($ulid, $form->createView()->vars['
{ "filepath": "src/Symfony/Component/Form/Tests/Extension/Core/Type/UlidTypeTest.php", "language": "php", "file_size": 1210, "cut_index": 518, "middle_length": 229 }
ge. * * (c) Fabien Potencier <fabien@symfony.com> * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace Symfony\Component\Form\Tests\Extension\Core\Type; use Symfony\Component\Form\Extension\Core\Type\BirthdayType; use Symfony...
value', 'widget' => 'choice', ]); } public function testWidgetSingleTextHasDefaultAttrMinMax() { $form = $this->factory->create(static::TESTED_TYPE, null, [ 'widget' => 'single_text', ]);
= BirthdayType::class; public function testSetInvalidYearsOption() { $this->expectException(InvalidOptionsException::class); $this->factory->create(static::TESTED_TYPE, null, [ 'years' => 'bad
{ "filepath": "src/Symfony/Component/Form/Tests/Extension/Core/Type/BirthdayTypeTest.php", "language": "php", "file_size": 2421, "cut_index": 563, "middle_length": 229 }
buted with this source code. */ namespace Symfony\Component\Form\Tests\Extension\Core\Type; use PHPUnit\Framework\Attributes\DataProvider; use Symfony\Component\Form\CallbackTransformer; use Symfony\Component\Form\Extension\Core\Type\CheckboxType; use Symfony\Component\OptionsResolver\Exception\InvalidOptionsExcepti...
{ $view = $this->factory->create(static::TESTED_TYPE, null, ['value' => 'foobar']) ->createView(); $this->assertEquals('foobar', $view->vars['value']); } public function testCheckedIfDataTrue() { $view = $t
>create(static::TESTED_TYPE); $this->assertFalse($form->getData()); $this->assertFalse($form->getNormData()); $this->assertNull($form->getViewData()); } public function testPassValueToView()
{ "filepath": "src/Symfony/Component/Form/Tests/Extension/Core/Type/CheckboxTypeTest.php", "language": "php", "file_size": 6637, "cut_index": 716, "middle_length": 229 }
'expanded' => true, 'choices' => $this->choices, ]); $this->assertCount(\count($this->choices), $form, 'Each choice should become a new field'); } public function testChoiceListWithScalarValues() { $view = $this->factory->create(static::TESTED_TYPE, null, [ ...
ssertFalse($view->vars['is_selected']($view->vars['choices'][1], $view->vars['value']), 'False value should not be pre selected'); $this->assertFalse($view->vars['is_selected']($view->vars['choices'][2], $view->vars['value']), 'Empty value should n
; $this->assertSame('', $view->vars['choices'][2]->value); $this->assertFalse($view->vars['is_selected']($view->vars['choices'][0], $view->vars['value']), 'True value should not be pre selected'); $this->a
{ "filepath": "src/Symfony/Component/Form/Tests/Extension/Core/Type/ChoiceTypeTest.php", "language": "php", "file_size": 90196, "cut_index": 3790, "middle_length": 229 }
ge. * * (c) Fabien Potencier <fabien@symfony.com> * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace Symfony\Component\Form\Tests\Extension\Core\Type; use Symfony\Component\EventDispatcher\EventDispatcher; use Symfony\Compo...
'Jon' => 'd', 'Roman' => 'e', ]; protected function setUp(): void { $this->dispatcher = new EventDispatcher(); parent::setUp(); } protected function getExtensions(): array { $translator = $this->cr
erface; class ChoiceTypeTranslationTest extends TypeTestCase { public const TESTED_TYPE = ChoiceType::class; private array $choices = [ 'Bernhard' => 'a', 'Fabien' => 'b', 'Kris' => 'c',
{ "filepath": "src/Symfony/Component/Form/Tests/Extension/Core/Type/ChoiceTypeTranslationTest.php", "language": "php", "file_size": 2500, "cut_index": 563, "middle_length": 229 }
* * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace Symfony\Component\Form\Tests\Extension\Core\Type; use PHPUnit\Framework\Attributes\RequiresPhpExtension; use Symfony\Component\Form\ChoiceList\View\ChoiceView; use Symfony\C...
:TESTED_TYPE) ->createView()->vars['choices']; // Don't check objects for identity $this->assertContainsEquals(new ChoiceView('DE', 'DE', 'Germany'), $choices); $this->assertContainsEquals(new ChoiceView('GB', 'GB', 'Un
ss; protected function setUp(): void { IntlTestHelper::requireIntl($this); parent::setUp(); } public function testCountriesAreSelectable() { $choices = $this->factory->create(static:
{ "filepath": "src/Symfony/Component/Form/Tests/Extension/Core/Type/CountryTypeTest.php", "language": "php", "file_size": 4579, "cut_index": 614, "middle_length": 229 }
* * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace Symfony\Component\Form\Tests\Extension\Core\Type; use PHPUnit\Framework\Attributes\RequiresPhpExtension; use Symfony\Component\Form\ChoiceList\View\ChoiceView; use Symfony\C...
enciesAreSelectable() { $choices = $this->factory->create(static::TESTED_TYPE) ->createView()->vars['choices']; $this->assertContainsEquals(new ChoiceView('EUR', 'EUR', 'Euro'), $choices); $this->assertContainsEqual
extends BaseTypeTestCase { public const TESTED_TYPE = CurrencyType::class; protected function setUp(): void { IntlTestHelper::requireIntl($this); parent::setUp(); } public function testCurr
{ "filepath": "src/Symfony/Component/Form/Tests/Extension/Core/Type/CurrencyTypeTest.php", "language": "php", "file_size": 4333, "cut_index": 614, "middle_length": 229 }
ception::class); $this->factory->create(static::TESTED_TYPE, null, [ 'input' => 'fake_input', 'widget' => 'choice', ]); } public function testSubmitFromSingleTextDateTimeWithDefaultFormat() { $form = $this->factory->create(static::TESTED_TYPE, null, [ ...
{ $form = $this->factory->create(static::TESTED_TYPE, null, [ 'model_timezone' => 'UTC', 'view_timezone' => 'UTC', 'widget' => 'single_text', 'input' => 'datetime', 'format' => 'yyyy',
; $this->assertEquals(new \DateTime('2010-06-02 UTC'), $form->getData()); $this->assertEquals('2010-06-02', $form->getViewData()); } public function testSubmitFromSingleTextDateTimeWithCustomFormat()
{ "filepath": "src/Symfony/Component/Form/Tests/Extension/Core/Type/DateTypeTest.php", "language": "php", "file_size": 40890, "cut_index": 2151, "middle_length": 229 }
ge. * * (c) Fabien Potencier <fabien@symfony.com> * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace Symfony\Component\Form\Tests\Extension\Core\Type; use PHPUnit\Framework\Attributes\DataProvider; use PHPUnit\Framework\Tes...
r() ->addTypeExtension(new ChoiceTypeExtension()) ->getFormFactory() ; $choices = $factory->create($type, null, ['choice_loader' => null])->createView()->vars['choices']; $this->assertCount(2, $choices);
TypeTest extends TestCase { #[DataProvider('provideTestedTypes')] public function testChoicesAreOverridden($type) { ChoiceTypeExtension::$extendedType = $type; $factory = Forms::createFormFactoryBuilde
{ "filepath": "src/Symfony/Component/Form/Tests/Extension/Core/Type/ExtendedChoiceTypeTest.php", "language": "php", "file_size": 2234, "cut_index": 563, "middle_length": 229 }
; use Symfony\Component\Form\Form; use Symfony\Component\Form\FormBuilderInterface; use Symfony\Component\Form\FormError; use Symfony\Component\Form\Forms; use Symfony\Component\Form\Tests\Fixtures\Author; use Symfony\Component\Form\Tests\Fixtures\FixedDataTransformer; use Symfony\Component\OptionsResolver\Exception\In...
t having // to provide a setReference() method public function getReference() { return $this->reference; } // The returned object is a copy, so setReferenceCopy() must be used // to update it public function getReferenc
otected $referenceCopy; public function __construct($reference) { $this->reference = $reference; $this->referenceCopy = $reference; } // The returned object should be modified by reference withou
{ "filepath": "src/Symfony/Component/Form/Tests/Extension/Core/Type/FormTypeTest.php", "language": "php", "file_size": 30396, "cut_index": 1331, "middle_length": 229 }
buted with this source code. */ namespace Symfony\Component\Form\Tests\Extension\Core\Type; use PHPUnit\Framework\Attributes\RequiresPhpExtension; use Symfony\Component\Form\ChoiceList\View\ChoiceView; use Symfony\Component\Form\Exception\LogicException; use Symfony\Component\Form\Extension\Core\Type\LanguageType; u...
['choices']; $this->assertContainsEquals(new ChoiceView('en', 'en', 'English'), $choices); $this->assertContainsEquals(new ChoiceView('fr', 'fr', 'French'), $choices); $this->assertContainsEquals(new ChoiceView('my', 'my', 'Burmese
{ IntlTestHelper::requireIntl($this); parent::setUp(); } public function testCountriesAreSelectable() { $choices = $this->factory->create(static::TESTED_TYPE) ->createView()->vars
{ "filepath": "src/Symfony/Component/Form/Tests/Extension/Core/Type/LanguageTypeTest.php", "language": "php", "file_size": 5632, "cut_index": 716, "middle_length": 229 }
buted with this source code. */ namespace Symfony\Component\Form\Tests\Extension\Core\Type; use Symfony\Component\Form\Exception\TransformationFailedException; use Symfony\Component\Form\Extension\Core\Type\MoneyType; use Symfony\Component\Intl\Util\IntlTestHelper; class MoneyTypeTest extends BaseTypeTestCase { ...
is->defaultLocale)) { \Locale::setDefault($this->defaultLocale); } } public function testPassMoneyPatternToView() { \Locale::setDefault('de_DE'); $view = $this->factory->create(static::TESTED_TYPE)
// implementation IntlTestHelper::requireFullIntl($this); parent::setUp(); $this->defaultLocale = \Locale::getDefault(); } protected function tearDown(): void { if (isset($th
{ "filepath": "src/Symfony/Component/Form/Tests/Extension/Core/Type/MoneyTypeTest.php", "language": "php", "file_size": 7885, "cut_index": 716, "middle_length": 229 }
part of the Symfony package. * * (c) Fabien Potencier <fabien@symfony.com> * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace Symfony\Component\Form\Tests\Extension\Core\Type; use Symfony\Component\Form\Extension\Core\Type...
y->create(static::TESTED_TYPE); $form->submit('pAs5w0rd'); $this->assertSame('', $form->createView()->vars['value']); } public function testNotEmptyIfSubmittedAndNotAlwaysEmpty() { $form = $this->factory->create(static
->factory->create(static::TESTED_TYPE); $form->setData('pAs5w0rd'); $this->assertSame('', $form->createView()->vars['value']); } public function testEmptyIfSubmitted() { $form = $this->factor
{ "filepath": "src/Symfony/Component/Form/Tests/Extension/Core/Type/PasswordTypeTest.php", "language": "php", "file_size": 1552, "cut_index": 537, "middle_length": 229 }
part of the Symfony package. * * (c) Fabien Potencier <fabien@symfony.com> * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace Symfony\Component\Form\Tests\Extension\Core\Type; use Symfony\Component\Form\Extension\Core\Type...
) { $button = $this->factory->create(static::TESTED_TYPE); $this->assertFalse($button->isClicked()); } public function testNotClickedIfSubmittedWithNull() { $button = $this->factory->create(static::TESTED_TYPE);
ubmitType::class; public function testCreateSubmitButtonInstances() { $this->assertInstanceOf(SubmitButton::class, $this->factory->create(static::TESTED_TYPE)); } public function testNotClickedByDefault(
{ "filepath": "src/Symfony/Component/Form/Tests/Extension/Core/Type/SubmitTypeTest.php", "language": "php", "file_size": 2018, "cut_index": 537, "middle_length": 229 }
* * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace Symfony\Component\Form\Tests\Extension\Core\Type; use Symfony\Component\Form\CallbackTransformer; use Symfony\Component\Form\Extension\Core\Type\TextareaType; class Textare...
ssertSame("Line 1\nLine 2\nLine 3", $form->getData()); } public function testSubmitNormalizeCr() { $form = $this->factory->create(static::TESTED_TYPE); $form->submit("Line 1\rLine 2\rLine 3"); $this->assertSame("Line 1
:testSubmitNull($expected, $norm, ''); } public function testSubmitNormalizeCrlf() { $form = $this->factory->create(static::TESTED_TYPE); $form->submit("Line 1\r\nLine 2\r\nLine 3"); $this->a
{ "filepath": "src/Symfony/Component/Form/Tests/Extension/Core/Type/TextareaTypeTest.php", "language": "php", "file_size": 3573, "cut_index": 614, "middle_length": 229 }
author Bernhard Schussek <bschussek@gmail.com> */ abstract class BaseTypeTestCase extends TypeTestCase { public const TESTED_TYPE = ''; protected function setUp(): void { $this->dispatcher = new EventDispatcher(); parent::setUp(); } public function testPassDisabledAsOption() ...
rs['id']); $this->assertEquals('name', $view->vars['name']); $this->assertEquals('name', $view->vars['full_name']); } public function testPassIdAndNameToViewWithParent() { $view = $this->factory->createNamedBuilder('par
public function testPassIdAndNameToView() { $view = $this->factory->createNamed('name', $this->getTestedType(), null, $this->getTestOptions()) ->createView(); $this->assertEquals('name', $view->va
{ "filepath": "src/Symfony/Component/Form/Tests/Extension/Core/Type/BaseTypeTestCase.php", "language": "php", "file_size": 10234, "cut_index": 921, "middle_length": 229 }
?php /* * This file is part of the Symfony package. * * (c) Fabien Potencier <fabien@symfony.com> * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace Symfony\Component\Form\Tests\Extension\Core\Type; use PHPUnit\Framework\...
$this->setMaxRunningTime(1); $choices = range(1, 300); for ($i = 0; $i < 100; ++$i) { $this->factory->create('Symfony\Component\Form\Extension\Core\Type\ChoiceType', random_int(1, 400), [ 'choices' => $ch
stCase { /** * This test case is realistic in collection forms where each * row contains the same choice field. */ #[Group('benchmark')] public function testSameChoiceFieldCreatedMultipleTimes() {
{ "filepath": "src/Symfony/Component/Form/Tests/Extension/Core/Type/ChoiceTypePerformanceTest.php", "language": "php", "file_size": 1039, "cut_index": 513, "middle_length": 229 }
; use Symfony\Component\Form\Tests\Fixtures\CollectionWithRecursiveSetDataType; class CollectionTypeTest extends BaseTypeTestCase { public const TESTED_TYPE = CollectionType::class; public function testContainsNoChildByDefault() { $form = $this->factory->create(static::TESTED_TYPE, null, [ ...
om', 'foo@bar.com']); $this->assertInstanceOf(Form::class, $form[0]); $this->assertInstanceOf(Form::class, $form[1]); $this->assertCount(2, $form); $this->assertEquals('foo@foo.com', $form[0]->getData()); $this->ass
ate(static::TESTED_TYPE, null, [ 'entry_type' => TextTypeTest::TESTED_TYPE, 'entry_options' => [ 'attr' => ['maxlength' => 20], ], ]); $form->setData(['foo@foo.c
{ "filepath": "src/Symfony/Component/Form/Tests/Extension/Core/Type/CollectionTypeTest.php", "language": "php", "file_size": 21392, "cut_index": 1331, "middle_length": 229 }
eList\View\ChoiceView; use Symfony\Component\Form\Extension\Core\Type\EnumType; use Symfony\Component\Form\Tests\Extension\Core\Type\BaseTypeTestCase; use Symfony\Component\Form\Tests\Fixtures\Answer; use Symfony\Component\Form\Tests\Fixtures\Number; use Symfony\Component\Form\Tests\Fixtures\Suit; use Symfony\Component...
ClassOptionIsRequired() { $this->expectException(MissingOptionsException::class); $this->factory->createNamed('name', $this->getTestedType()); } public function testInvalidClassOption() { $this->expectException(Inva
e Symfony\Component\Translation\IdentityTranslator; use Symfony\Contracts\Translation\TranslatableInterface; class EnumTypeTest extends BaseTypeTestCase { public const TESTED_TYPE = EnumType::class; public function test
{ "filepath": "src/Symfony/Component/Form/Tests/Extension/Core/Type/EnumTypeTest.php", "language": "php", "file_size": 14204, "cut_index": 921, "middle_length": 229 }
mfony\Component\Form\Extension\Core\Type\FileType; use Symfony\Component\Form\Extension\HttpFoundation\HttpFoundationRequestHandler; use Symfony\Component\Form\Extension\Validator\ViolationMapper\ViolationMapperInterface; use Symfony\Component\Form\NativeRequestHandler; use Symfony\Component\Form\RequestHandlerInterfac...
er), [new CoreExtension(null, null, new IdentityTranslator())]); } // https://github.com/symfony/symfony/pull/5028 public function testSetData() { $form = $this->factory->createBuilder(static::TESTED_TYPE)->getForm(); $data
eTypeTestCase { public const TESTED_TYPE = FileType::class; protected function getExtensions(?ViolationMapperInterface $violationMapper = null): array { return array_merge(parent::getExtensions($violationMapp
{ "filepath": "src/Symfony/Component/Form/Tests/Extension/Core/Type/FileTypeTest.php", "language": "php", "file_size": 12470, "cut_index": 921, "middle_length": 229 }
ge. * * (c) Fabien Potencier <fabien@symfony.com> * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace Symfony\Component\Form\Tests\Extension\Core\Type; use PHPUnit\Framework\Attributes\RequiresPhpExtension; use Symfony\Compo...
$choices = $this->factory->create(static::TESTED_TYPE) ->createView()->vars['choices']; $this->assertContainsEquals(new ChoiceView('en', 'en', 'English'), $choices); $this->assertContainsEquals(new ChoiceView('en_GB', 'en_
{ public const TESTED_TYPE = LocaleType::class; protected function setUp(): void { IntlTestHelper::requireIntl($this); parent::setUp(); } public function testLocalesAreSelectable() {
{ "filepath": "src/Symfony/Component/Form/Tests/Extension/Core/Type/LocaleTypeTest.php", "language": "php", "file_size": 2309, "cut_index": 563, "middle_length": 229 }
'widget' => 'choice', 'input' => 'date_point', ]); $input = [ 'hour' => '3', 'minute' => '4', ]; $form->submit($input); $this->assertInstanceOf(DatePoint::class, $form->getData()); $datePoint = DatePoint::createFromMutab...
'widget' => 'choice', ]); $input = [ 'hour' => '3', 'minute' => '4', ]; $form->submit($input); $dateTime = new \DateTimeImmutable('1970-01-01 03:04:00 UTC'); $this->assertI
estSubmitDateTimeImmutable() { $form = $this->factory->create(static::TESTED_TYPE, null, [ 'model_timezone' => 'UTC', 'view_timezone' => 'UTC', 'input' => 'datetime_immutable',
{ "filepath": "src/Symfony/Component/Form/Tests/Extension/Core/Type/TimeTypeTest.php", "language": "php", "file_size": 40098, "cut_index": 2151, "middle_length": 229 }
* * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace Symfony\Component\Form\Tests\Extension\Core\Type; use Symfony\Component\Form\Button; use Symfony\Component\Form\Exception\BadMethodCallException; use Symfony\Component\Form\...
ate(static::TESTED_TYPE)); } /** * @param string $emptyData * @param null $expectedData */ public function testSubmitNullUsesDefaultEmptyData($emptyData = 'empty', $expectedData = null) { $this->expectException(Bad
.com> */ class ButtonTypeTest extends BaseTypeTestCase { public const TESTED_TYPE = ButtonType::class; public function testCreateButtonInstances() { $this->assertInstanceOf(Button::class, $this->factory->cre
{ "filepath": "src/Symfony/Component/Form/Tests/Extension/Core/Type/ButtonTypeTest.php", "language": "php", "file_size": 3621, "cut_index": 614, "middle_length": 229 }
* * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace Symfony\Component\Form\Tests\Extension\Core\Type; use PHPUnit\Framework\Attributes\RequiresPhpExtension; use Symfony\Component\Form\Extension\Core\Type\IntegerType; use Symf...
s->defaultLocale)) { \Locale::setDefault($this->defaultLocale); } } #[RequiresPhpExtension('intl')] public function testArabicLocale() { \Locale::setDefault('ar'); $form = $this->factory->create(static:
function setUp(): void { IntlTestHelper::requireIntl($this); $this->previousLocale = \Locale::getDefault(); parent::setUp(); } protected function tearDown(): void { if (isset($thi
{ "filepath": "src/Symfony/Component/Form/Tests/Extension/Core/Type/IntegerTypeTest.php", "language": "php", "file_size": 3665, "cut_index": 614, "middle_length": 229 }
buted with this source code. */ namespace Symfony\Component\Form\Tests\Extension\Core\Type; use Symfony\Component\Form\Exception\LogicException; use Symfony\Component\Form\Exception\TransformationFailedException; use Symfony\Component\Form\Extension\Core\Type\NumberType; use Symfony\Component\Intl\Util\IntlTestHelpe...
} protected function tearDown(): void { if (isset($this->defaultLocale)) { \Locale::setDefault($this->defaultLocale); } } public function testDefaultFormatting() { $form = $this->factory->create(
rent::setUp(); // we test against "de_DE", so we need the full implementation IntlTestHelper::requireFullIntl($this); $this->defaultLocale = \Locale::getDefault(); \Locale::setDefault('de_DE');
{ "filepath": "src/Symfony/Component/Form/Tests/Extension/Core/Type/NumberTypeTest.php", "language": "php", "file_size": 7614, "cut_index": 716, "middle_length": 229 }
* * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace Symfony\Component\Form\Tests\ChoiceList; use PHPUnit\Framework\TestCase; use Symfony\Component\Form\ChoiceList\ChoiceListInterface; /** * @author Bernhard Schussek <bschus...
ue2; protected string $value3; protected string $value4; protected string $key1; protected string $key2; protected string $key3; protected string $key4; protected function setUp(): void { $this->list = $this->create
d array $structuredValues; protected array $keys; protected mixed $choice1; protected mixed $choice2; protected mixed $choice3; protected mixed $choice4; protected string $value1; protected string $val
{ "filepath": "src/Symfony/Component/Form/Tests/ChoiceList/AbstractChoiceListTestCase.php", "language": "php", "file_size": 4990, "cut_index": 614, "middle_length": 229 }
n Potencier <fabien@symfony.com> * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace Symfony\Component\Form\Tests\Fixtures; class EnumFormTypeGuesserCase { public string $string; public UndefinedEnum $undefinedEnum; ...
ypeGuesserCaseEnum|BackedEnumFormTypeGuesserCaseEnum $enumUnion; public EnumFormTypeGuesserCaseEnum&BackedEnumFormTypeGuesserCaseEnum $enumIntersection; } enum EnumFormTypeGuesserCaseEnum { case Foo; case Bar; } enum BackedEnumFormTypeGuesser
erCaseEnum $nullableBackedEnum; public EnumFormT
{ "filepath": "src/Symfony/Component/Form/Tests/Fixtures/EnumFormTypeGuesserCase.php", "language": "php", "file_size": 955, "cut_index": 582, "middle_length": 52 }
/* * This file is part of the Symfony package. * * (c) Fabien Potencier <fabien@symfony.com> * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace Symfony\Component\Form\Tests\Fixtures; use Symfony\Component\Form\DataTransfo...
ow new TransformationFailedException(\sprintf('No mapping for value "%s"', $value)); } return $this->mapping[$value]; } public function reverseTransform($value): mixed { $result = array_search($value, $this->mapping, t
ction __construct(array $mapping) { $this->mapping = $mapping; } public function transform($value): mixed { $value ??= ''; if (!\array_key_exists($value, $this->mapping)) { thr
{ "filepath": "src/Symfony/Component/Form/Tests/Fixtures/FixedDataTransformer.php", "language": "php", "file_size": 1194, "cut_index": 518, "middle_length": 229 }
part of the Symfony package. * * (c) Fabien Potencier <fabien@symfony.com> * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace Symfony\Component\Form\Tests\Fixtures; use Symfony\Component\EventDispatcher\EventSubscriberInte...
Event $event) { $data = $event->getData(); if (isset($this->mapping['preSubmit'][$data])) { $event->setData($this->mapping['preSubmit'][$data]); } } public function onSubmit(FormEvent $event) {
__construct(array $mapping) { $this->mapping = array_merge([ 'preSubmit' => [], 'onSubmit' => [], 'preSetData' => [], ], $mapping); } public function preSubmit(Form
{ "filepath": "src/Symfony/Component/Form/Tests/Fixtures/FixedFilterListener.php", "language": "php", "file_size": 1680, "cut_index": 537, "middle_length": 229 }
/* * This file is part of the Symfony package. * * (c) Fabien Potencier <fabien@symfony.com> * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace Symfony\Component\Form\Tests\Fixtures; use Symfony\Contracts\Translation\Tra...
ions; } public function trans(string $id, array $parameters = [], ?string $domain = null, ?string $locale = null): string { return $this->translations[$id] ?? $id; } public function getLocale(): string { return 'en
ns = $translat
{ "filepath": "src/Symfony/Component/Form/Tests/Fixtures/FixedTranslator.php", "language": "php", "file_size": 798, "cut_index": 517, "middle_length": 14 }
* This file is part of the Symfony package. * * (c) Fabien Potencier <fabien@symfony.com> * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace Symfony\Component\Form\Tests\Fixtures; use Symfony\Component\Form\AbstractTypeExt...
$builder->setAttribute('bar', 'x'); } public function getAllowedOptionValues(): array { return [ 'a_or_b' => ['c'], ]; } public static function getExtendedTypes(): iterable { return [FooT
: void {
{ "filepath": "src/Symfony/Component/Form/Tests/Fixtures/FooTypeBarExtension.php", "language": "php", "file_size": 813, "cut_index": 522, "middle_length": 14 }
he Symfony package. * * (c) Fabien Potencier <fabien@symfony.com> * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace Symfony\Component\Form\Tests\Fixtures; use Symfony\Component\Form\AbstractTypeExtension; use Symfony\Compo...
ver): void { $resolver->setDefault('choice_loader', ChoiceList::lazy($this, fn () => [ 'Lazy A' => 'lazy_a', 'Lazy B' => 'lazy_b', ])); } public static function getExtendedTypes(): iterable {
lic function configureOptions(OptionsResolver $resol
{ "filepath": "src/Symfony/Component/Form/Tests/Fixtures/LazyChoiceTypeExtension.php", "language": "php", "file_size": 894, "cut_index": 547, "middle_length": 52 }
he Symfony package. * * (c) Fabien Potencier <fabien@symfony.com> * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace Symfony\Component\Form\Tests\Fixtures; use Symfony\Component\Form\FormTypeGuesserInterface; use Symfony\Co...
c function guessRequired($class, $property): ?ValueGuess { return null; } public function guessMaxLength($class, $property): ?ValueGuess { return null; } public function guessPattern($class, $property): ?ValueGuess
ypeGuess { return null; } publi
{ "filepath": "src/Symfony/Component/Form/Tests/Fixtures/NullFormTypeGuesser.php", "language": "php", "file_size": 891, "cut_index": 547, "middle_length": 52 }
ackage. * * (c) Fabien Potencier <fabien@symfony.com> * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace Symfony\Component\Form\Tests\Fixtures; class Organization { public $authors = []; public function __construct...
or; return $this; } public function removeAuthor(Author $author): self { if (false !== $key = array_search($author, $this->authors, true)) { array_splice($this->authors, $key, 1); } return $this;
author): self { $this->authors[] = $auth
{ "filepath": "src/Symfony/Component/Form/Tests/Fixtures/Organization.php", "language": "php", "file_size": 874, "cut_index": 559, "middle_length": 52 }
n Potencier <fabien@symfony.com> * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace Symfony\Component\Form\Tests\Fixtures; use Symfony\Component\Form\AbstractType; use Symfony\Component\Form\Extension\Core\Type\PasswordType; ...
class; } public function configureOptions(OptionsResolver $resolver): void { $resolver->setDefaults([ 'mapped' => false, 'type' => PasswordType::class, 'first_options' => [ 'hash_prop
arent(): ?string { return RepeatedType::
{ "filepath": "src/Symfony/Component/Form/Tests/Fixtures/RepeatedPasswordField.php", "language": "php", "file_size": 951, "cut_index": 582, "middle_length": 52 }
part of the Symfony package. * * (c) Fabien Potencier <fabien@symfony.com> * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace Symfony\Component\Form\Tests\Fixtures; use Symfony\Component\Form\FormExtensionInterface; use Sy...
esser; } public function addType(FormTypeInterface $type) { $this->types[$type::class] = $type; } public function getType($name): FormTypeInterface { return $this->types[$name]; } public function hasType($
nInterface { private array $types = []; private array $extensions = []; private FormTypeGuesserInterface $guesser; public function __construct(FormTypeGuesserInterface $guesser) { $this->guesser = $gu
{ "filepath": "src/Symfony/Component/Form/Tests/Fixtures/TestExtension.php", "language": "php", "file_size": 1749, "cut_index": 537, "middle_length": 229 }
/* * This file is part of the Symfony package. * * (c) Fabien Potencier <fabien@symfony.com> * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace Symfony\Component\Form\Tests\Fixtures\Flow; use Symfony\Component\Form\Extens...
, array $options): void { $builder->addStep('step1', TextType::class); $builder->addStep('step2', FormType::class, [], static fn () => true); $builder->add('navigator', NavigatorFlowType::class, [ 'with_reset' => tr
Symfony\Component\Form\Flow\Type\NavigatorFlowType; use Symfony\Component\OptionsResolver\OptionsResolver; class LastStepSkippedType extends AbstractFlowType { public function buildFormFlow(FormFlowBuilderInterface $builder
{ "filepath": "src/Symfony/Component/Form/Tests/Fixtures/Flow/LastStepSkippedType.php", "language": "php", "file_size": 1242, "cut_index": 518, "middle_length": 229 }
hp /* * This file is part of the Symfony package. * * (c) Fabien Potencier <fabien@symfony.com> * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace Symfony\Component\Form\Tests\Fixtures\Flow; use Symfony\Component\Form\Abs...
'clear_submission' => true, 'include_if' => ['professional'], ]); } public function configureOptions(OptionsResolver $resolver): void { $resolver->setDefaults([ 'with_reset' => true, ]);
ionsResolver\OptionsResolver; class UserSignUpNavigatorType extends AbstractType { public function buildForm(FormBuilderInterface $builder, array $options): void { $builder->add('skip', NextFlowType::class, [
{ "filepath": "src/Symfony/Component/Form/Tests/Fixtures/Flow/UserSignUpNavigatorType.php", "language": "php", "file_size": 1103, "cut_index": 515, "middle_length": 229 }
part of the Symfony package. * * (c) Fabien Potencier <fabien@symfony.com> * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace Symfony\Component\Form\Tests\Fixtures\Flow; use Symfony\Component\Form\Flow\AbstractFlowType; us...
ymfony\Component\OptionsResolver\OptionsResolver; class UserSignUpType extends AbstractFlowType { public function buildFormFlow(FormFlowBuilderInterface $builder, array $options): void { $skip = $options['data_class'] ? static
fony\Component\Form\Tests\Fixtures\Flow\Step\UserSignUpAccountType; use Symfony\Component\Form\Tests\Fixtures\Flow\Step\UserSignUpPersonalType; use Symfony\Component\Form\Tests\Fixtures\Flow\Step\UserSignUpProfessionalType; use S
{ "filepath": "src/Symfony/Component/Form/Tests/Fixtures/Flow/UserSignUpType.php", "language": "php", "file_size": 1723, "cut_index": 537, "middle_length": 229 }
n Potencier <fabien@symfony.com> * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace Symfony\Component\Form\Tests\Fixtures\Flow\Step; use Symfony\Component\Form\AbstractType; use Symfony\Component\Form\Extension\Core\Type\Emai...
buildForm(FormBuilderInterface $builder, array $options): void { $builder->add('email', EmailType::class); $builder->add('password', PasswordType::class); } public function configureOptions(OptionsResolver $resolver): void
ountType extends AbstractType { public function
{ "filepath": "src/Symfony/Component/Form/Tests/Fixtures/Flow/Step/UserSignUpAccountType.php", "language": "php", "file_size": 981, "cut_index": 582, "middle_length": 52 }
?php /* * This file is part of the Symfony package. * * (c) Fabien Potencier <fabien@symfony.com> * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace Symfony\Component\Form\Tests\Fixtures\Flow\Step; use Symfony\Component\F...
Type::class); $builder->add('lastName', TextType::class); $builder->add('worker', CheckboxType::class, ['required' => false]); } public function configureOptions(OptionsResolver $resolver): void { $resolver->setDefaults
fony\Component\OptionsResolver\OptionsResolver; class UserSignUpPersonalType extends AbstractType { public function buildForm(FormBuilderInterface $builder, array $options): void { $builder->add('firstName', Text
{ "filepath": "src/Symfony/Component/Form/Tests/Fixtures/Flow/Step/UserSignUpPersonalType.php", "language": "php", "file_size": 1057, "cut_index": 513, "middle_length": 229 }
hp /* * This file is part of the Symfony package. * * (c) Fabien Potencier <fabien@symfony.com> * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace Symfony\Component\Form\Tests\Fixtures\Flow\Step; use Symfony\Component\For...
'choices' => [ 'Product Manager' => 'ROLE_MANAGER', 'Developer' => 'ROLE_DEVELOPER', 'Designer' => 'ROLE_DESIGNER', ], ]); } public function configureOptions(OptionsResolver $res
gnUpProfessionalType extends AbstractType { public function buildForm(FormBuilderInterface $builder, array $options): void { $builder->add('company'); $builder->add('role', ChoiceType::class, [
{ "filepath": "src/Symfony/Component/Form/Tests/Fixtures/Flow/Step/UserSignUpProfessionalType.php", "language": "php", "file_size": 1108, "cut_index": 515, "middle_length": 229 }
/* * This file is part of the Symfony package. * * (c) Fabien Potencier <fabien@symfony.com> * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace Symfony\Component\Form\Tests\Fixtures\Flow\Extension; use Symfony\Component\F...
uilder instanceof FormFlowBuilderInterface) { throw new \InvalidArgumentException(\sprintf('The "%s" can only be used with FormFlowType.', self::class)); } $builder->addStep('first', FormType::class, ['mapped' => false], null,
se Symfony\Component\Form\Tests\Fixtures\Flow\UserSignUpType; class UserSignUpTypeExtension extends AbstractTypeExtension { public function buildForm(FormBuilderInterface $builder, array $options): void { if (!$b
{ "filepath": "src/Symfony/Component/Form/Tests/Fixtures/Flow/Extension/UserSignUpTypeExtension.php", "language": "php", "file_size": 1197, "cut_index": 518, "middle_length": 229 }
hp /* * This file is part of the Symfony package. * * (c) Fabien Potencier <fabien@symfony.com> * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace Symfony\Component\Form\Tests\Fixtures\Flow\Data; use Symfony\Component\Val...
?string $company = null; public ?string $role = null; // account step #[Assert\NotBlank(groups: ['account'])] #[Assert\Email(groups: ['account'])] public ?string $email = null; #[Assert\NotBlank(groups: ['account'])] #[Assert\
$firstName = null; public ?string $lastName = null; public bool $worker = false; // professional step #[Assert\NotBlank(groups: ['professional'])] #[Assert\Length(min: 3, groups: ['professional'])] public
{ "filepath": "src/Symfony/Component/Form/Tests/Fixtures/Flow/Data/UserSignUp.php", "language": "php", "file_size": 1116, "cut_index": 515, "middle_length": 229 }
part of the Symfony package. * * (c) Fabien Potencier <fabien@symfony.com> * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace Symfony\Component\Form\Tests\Resources; use PHPUnit\Framework\Attributes\DataProvider; use PHPUn...
rrors, \sprintf('"%s" is invalid:%s', $filePath, \PHP_EOL.implode(\PHP_EOL, array_column($errors, 'message')))); } #[DataProvider('provideTranslationFiles')] public function testTranslationFileIsValidWithoutEntityLoader($filePath) {
TranslationFileIsValid($filePath) { $document = new \DOMDocument(); $document->loadXML(file_get_contents($filePath)); $errors = XliffUtils::validateSchema($document); $this->assertCount(0, $e
{ "filepath": "src/Symfony/Component/Form/Tests/Resources/TranslationFilesTest.php", "language": "php", "file_size": 1903, "cut_index": 537, "middle_length": 229 }
use Symfony\Component\Console\Exception\InvalidArgumentException; use Symfony\Component\Console\Tester\CommandCompletionTester; use Symfony\Component\Console\Tester\CommandTester; use Symfony\Component\Form\AbstractType; use Symfony\Component\Form\Command\DebugCommand; use Symfony\Component\Form\Extension\Core\CoreExte...
eateCommandTester(); $ret = $tester->execute([], ['decorated' => false]); $this->assertEquals(0, $ret, 'Returns 0 in case of success'); $this->assertStringContainsString('Built-in form types', $tester->getDisplay()); } pub
peFactory; use Symfony\Component\OptionsResolver\Options; use Symfony\Component\OptionsResolver\OptionsResolver; class DebugCommandTest extends TestCase { public function testDebugDefaults() { $tester = $this->cr
{ "filepath": "src/Symfony/Component/Form/Tests/Command/DebugCommandTest.php", "language": "php", "file_size": 11004, "cut_index": 921, "middle_length": 229 }
ony.com> * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace Symfony\Component\Form\Tests\Guess; use PHPUnit\Framework\TestCase; use Symfony\Component\Form\Guess\Guess; class TestGuess extends Guess { } class GuessTest exten...
::HIGH_CONFIDENCE); $this->assertSame($guess3, Guess::getBestGuess([$guess1, $guess2, $guess3])); } public function testGuessExpectsValidConfidence() { $this->expectException(\InvalidArgumentException::class); new Test
W_CONFIDENCE); $guess3 = new TestGuess(Guess
{ "filepath": "src/Symfony/Component/Form/Tests/Guess/GuessTest.php", "language": "php", "file_size": 932, "cut_index": 606, "middle_length": 52 }