prefix
stringlengths
512
512
suffix
stringlengths
256
256
middle
stringlengths
14
229
meta
dict
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\Validator\Tests\Constraints; use PHPUnit\Framework\TestCase; use Symfony\Compo...
$metadata->getPropertyMetadata('a')[0]->getConstraints(); self::assertNull($aConstraint->minWidth); self::assertNull($aConstraint->maxWidth); self::assertNull($aConstraint->minHeight); self::assertNull($aConstraint->maxHeig
public function testAttributes() { $metadata = new ClassMetadata(ImageDummy::class); $loader = new AttributeLoader(); self::assertTrue($loader->loadClassMetadata($metadata)); [$aConstraint] =
{ "filepath": "src/Symfony/Component/Validator/Tests/Constraints/ImageTest.php", "language": "php", "file_size": 1929, "cut_index": 537, "middle_length": 229 }
\Component\HttpFoundation\File\File; use Symfony\Component\Validator\Constraints\Image; use Symfony\Component\Validator\Constraints\ImageValidator; use Symfony\Component\Validator\Test\ConstraintValidatorTestCase; /** * @extends ConstraintValidatorTestCase<ImageValidator> */ #[RequiresPhpExtension('fileinfo')] class...
dator(); } protected function setUp(): void { parent::setUp(); $this->image = __DIR__.'/Fixtures/test.gif'; $this->imageLandscape = __DIR__.'/Fixtures/test_landscape.gif'; $this->imagePortrait = __DIR__.'/Fixtu
protected string $image4By3; protected string $image16By9; protected string $imageCorrupted; protected string $notAnImage; protected function createValidator(): ImageValidator { return new ImageVali
{ "filepath": "src/Symfony/Component/Validator/Tests/Constraints/ImageValidatorTest.php", "language": "php", "file_size": 16096, "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\Validator\Tests\Constraints; use PHPUnit\Framework\Attributes\DataProvider; use Symfony\Component\Intl\U...
f \DateTimeInterface) { IntlTestHelper::requireIntl($this, '57.1'); } $constraint = $this->createConstraint(['value' => $comparedValue]); $constraint->message = 'Constraint Message'; $this->validate($dirtyValue
ring, $comparedValue, $comparedValueString, $comparedValueType) { // Conversion of dates to string differs between ICU versions // Make sure we have the correct version loaded if ($dirtyValue instanceo
{ "filepath": "src/Symfony/Component/Validator/Tests/Constraints/InvalidComparisonToValueTestTrait.php", "language": "php", "file_size": 2778, "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\Validator\Tests\Constraints; use PHPUnit\Framework\TestCase; use Symfony\Compo...
ttributes() { $metadata = new ClassMetadata(IpDummy::class); $loader = new AttributeLoader(); self::assertTrue($loader->loadClassMetadata($metadata)); [$aConstraint] = $metadata->getPropertyMetadata('a')[0]->getConstrai
o@gmail.com> */ class IpTest extends TestCase { public function testNormalizerCanBeSet() { $ip = new Ip(normalizer: 'trim'); $this->assertEquals('trim', $ip->normalizer); } public function testA
{ "filepath": "src/Symfony/Component/Validator/Tests/Constraints/IpTest.php", "language": "php", "file_size": 1857, "cut_index": 537, "middle_length": 229 }
ent\Validator\Constraints\IpValidator; use Symfony\Component\Validator\Exception\ConstraintDefinitionException; use Symfony\Component\Validator\Exception\UnexpectedValueException; use Symfony\Component\Validator\Test\ConstraintValidatorTestCase; class IpValidatorTest extends ConstraintValidatorTestCase { protected...
his->expectException(UnexpectedValueException::class); $this->validate(new \stdClass(), new Ip()); } public function testInvalidValidatorVersion() { $this->expectException(ConstraintDefinitionException::class); new Ip(v
ertNoViolation(); } public function testEmptyStringIsValid() { $this->validate('', new Ip()); $this->assertNoViolation(); } public function testExpectsStringCompatibleType() { $t
{ "filepath": "src/Symfony/Component/Validator/Tests/Constraints/IpValidatorTest.php", "language": "php", "file_size": 14269, "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\Validator\Tests\Constraints; use Symfony\Component\Validato...
$this->assertNoViolation(); } public function testFalseIsValid() { $this->validate(false, new IsFalse()); $this->assertNoViolation(); } public function testTrueIsInvalid() { $this->validate(true, new
raintValidatorTestCase { protected function createValidator(): IsFalseValidator { return new IsFalseValidator(); } public function testNullIsValid() { $this->validate(null, new IsFalse());
{ "filepath": "src/Symfony/Component/Validator/Tests/Constraints/IsFalseValidatorTest.php", "language": "php", "file_size": 1216, "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\Validator\Tests\Constraints; use PHPUnit\Framework\Attributes\DataProvider; us...
ll, new IsNull()); $this->assertNoViolation(); } #[DataProvider('getInvalidValues')] public function testInvalidValues($value, $valueAsString) { $constraint = new IsNull(message: 'myMessage'); $this->validate($val
lidatorTest extends ConstraintValidatorTestCase { protected function createValidator(): IsNullValidator { return new IsNullValidator(); } public function testNullIsValid() { $this->validate(nu
{ "filepath": "src/Symfony/Component/Validator/Tests/Constraints/IsNullValidatorTest.php", "language": "php", "file_size": 1974, "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\Validator\Tests\Constraints; use Symfony\Component\Validato...
$this->assertNoViolation(); } public function testTrueIsValid() { $this->validate(true, new IsTrue()); $this->assertNoViolation(); } public function testFalseIsInvalid() { $this->validate(false, new IsTrue
ntValidatorTestCase { protected function createValidator(): IsTrueValidator { return new IsTrueValidator(); } public function testNullIsValid() { $this->validate(null, new IsTrue());
{ "filepath": "src/Symfony/Component/Validator/Tests/Constraints/IsTrueValidatorTest.php", "language": "php", "file_size": 1207, "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\Validator\Tests\Constraints; use PHPUnit\Framework\TestCase; use Symfony\Compo...
etadata->getPropertyMetadata('a')[0]->getConstraints(); self::assertNull($aConstraint->type); [$bConstraint] = $metadata->getPropertyMetadata('b')[0]->getConstraints(); self::assertSame(Isbn::ISBN_13, $bConstraint->type); s
ublic function testAttributes() { $metadata = new ClassMetadata(IsbnDummy::class); $loader = new AttributeLoader(); self::assertTrue($loader->loadClassMetadata($metadata)); [$aConstraint] = $m
{ "filepath": "src/Symfony/Component/Validator/Tests/Constraints/IsbnTest.php", "language": "php", "file_size": 1577, "cut_index": 537, "middle_length": 229 }
buted with this source code. */ namespace Symfony\Component\Validator\Tests\Constraints; use PHPUnit\Framework\Attributes\DataProvider; use Symfony\Component\Validator\Constraints\Isbn; use Symfony\Component\Validator\Constraints\IsbnValidator; use Symfony\Component\Validator\Exception\UnexpectedValueException; use ...
3455041'], ['2070546810'], ['2711858839'], ['2756406767'], ['2870971648'], ['226623854X'], ['2851806424'], ['0321812700'], ['0-45122-5244'], ['0-471
nction createValidator(): IsbnValidator { return new IsbnValidator(); } public static function getValidIsbn10() { return [ ['2723442284'], ['2723442276'], ['272
{ "filepath": "src/Symfony/Component/Validator/Tests/Constraints/IsbnValidatorTest.php", "language": "php", "file_size": 6982, "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\Validator\Tests\Constraints; use PHPUnit\Framework\TestCase; use ...
straint] = $metadata->getPropertyMetadata('b')[0]->getConstraints(); self::assertSame('myMessage', $bConstraint->message); self::assertSame(['Default', 'IsinDummy'], $bConstraint->groups); [$cConstraint] = $metadata->getPropertyMet
tCase { public function testAttributes() { $metadata = new ClassMetadata(IsinDummy::class); $loader = new AttributeLoader(); self::assertTrue($loader->loadClassMetadata($metadata)); [$bCon
{ "filepath": "src/Symfony/Component/Validator/Tests/Constraints/IsinTest.php", "language": "php", "file_size": 1365, "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\Validator\Tests\Constraints; use PHPUnit\Framework\Attributes\DataProvider; use Symfony\Component\Validator\Constraints\Isin; use Symfony\Component\Validat...
rtNoViolation(); } public function testEmptyStringIsValid() { $this->validate('', new Isin()); $this->assertNoViolation(); } #[DataProvider('getValidIsin')] public function testValidIsin($isin) { $this
idatorTestCase { protected function createValidator(): IsinValidator { return new IsinValidator(); } public function testNullIsValid() { $this->validate(null, new Isin()); $this->asse
{ "filepath": "src/Symfony/Component/Validator/Tests/Constraints/IsinValidatorTest.php", "language": "php", "file_size": 3808, "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\Validator\Tests\Constraints; use PHPUnit\Framework\TestCase; use Symfony\Compo...
int] = $metadata->getPropertyMetadata('a')[0]->getConstraints(); self::assertFalse($aConstraint->alpha3); [$bConstraint] = $metadata->getPropertyMetadata('b')[0]->getConstraints(); self::assertSame('myMessage', $bConstraint->messag
public function testAttributes() { $metadata = new ClassMetadata(CountryDummy::class); $loader = new AttributeLoader(); self::assertTrue($loader->loadClassMetadata($metadata)); [$aConstra
{ "filepath": "src/Symfony/Component/Validator/Tests/Constraints/CountryTest.php", "language": "php", "file_size": 1584, "cut_index": 537, "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\Validator\Tests\Constraints; use PHPUnit\Framework\TestCase; use Symfony\Component\Validator\Constraints...
er->loadClassMetadata($metadata)); [$aConstraint] = $metadata->getPropertyMetadata('a')[0]->getConstraints(); self::assertSame([CssColor::HEX_LONG, CssColor::HEX_SHORT], $aConstraint->formats); [$bConstraint] = $metadata->getPrope
.com> */ final class CssColorTest extends TestCase { public function testAttributes() { $metadata = new ClassMetadata(CssColorDummy::class); $loader = new AttributeLoader(); self::assertTrue($load
{ "filepath": "src/Symfony/Component/Validator/Tests/Constraints/CssColorTest.php", "language": "php", "file_size": 2485, "cut_index": 563, "middle_length": 229 }
turn new CssColorValidator(); } public function testNullIsValid() { $this->validate(null, new CssColor(CssColor::HEX_LONG)); $this->assertNoViolation(); } public function testEmptyStringIsValid() { $this->validate('', new CssColor(CssColor::HEX_LONG)); $this->...
} #[DataProvider('getValidAnyColor')] public function testValidAnyColorWithNewLine($cssColor) { $this->validate($cssColor."\n", new CssColor([], 'myMessage')); $this->buildViolation('myMessage') ->setParameter('{
, new CssColor(CssColor::HEX_LONG)); } #[DataProvider('getValidAnyColor')] public function testValidAnyColor($cssColor) { $this->validate($cssColor, new CssColor()); $this->assertNoViolation();
{ "filepath": "src/Symfony/Component/Validator/Tests/Constraints/CssColorValidatorTest.php", "language": "php", "file_size": 19556, "cut_index": 1331, "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\Validator\Tests\Constraints; use PHPUnit\Framework\TestCase; use ...
straint] = $metadata->getPropertyMetadata('b')[0]->getConstraints(); self::assertSame('myMessage', $bConstraint->message); self::assertSame(['Default', 'DateDummy'], $bConstraint->groups); [$cConstraint] = $metadata->getPropertyMet
tCase { public function testAttributes() { $metadata = new ClassMetadata(DateDummy::class); $loader = new AttributeLoader(); self::assertTrue($loader->loadClassMetadata($metadata)); [$bCon
{ "filepath": "src/Symfony/Component/Validator/Tests/Constraints/DateTest.php", "language": "php", "file_size": 1365, "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\Validator\Tests\Constraints; use PHPUnit\Framework\Attributes\DataProvider; use Symfony\Component\Validator\Constraints\DateTime; use Symfony\Component\Val...
ull, new DateTime()); $this->assertNoViolation(); } public function testEmptyStringIsValid() { $this->validate('', new DateTime()); $this->assertNoViolation(); } public function testExpectsStringCompatibleTyp
atorTest extends ConstraintValidatorTestCase { protected function createValidator(): DateTimeValidator { return new DateTimeValidator(); } public function testNullIsValid() { $this->validate(n
{ "filepath": "src/Symfony/Component/Validator/Tests/Constraints/DateTimeValidatorTest.php", "language": "php", "file_size": 4310, "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\Validator\Tests\Constraints; use PHPUnit\Framework\Attributes\DataProvider; use Symfony\Component\Valida...
{ $this->validate(null, new Date()); $this->assertNoViolation(); } public function testEmptyStringIsValid() { $this->validate('', new Date()); $this->assertNoViolation(); } public function testExp
aintValidatorTestCase; class DateValidatorTest extends ConstraintValidatorTestCase { protected function createValidator(): DateValidator { return new DateValidator(); } public function testNullIsValid()
{ "filepath": "src/Symfony/Component/Validator/Tests/Constraints/DateValidatorTest.php", "language": "php", "file_size": 3038, "cut_index": 563, "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\Validator\Tests\Constraints; use PHPUnit\Framework\TestCase...
self::assertSame(CascadingStrategy::NONE, $metadata->getCascadingStrategy()); self::assertTrue($loader->loadClassMetadata($metadata)); self::assertSame(CascadingStrategy::CASCADE, $metadata->getCascadingStrategy()); } publi
alidator\Mapping\Loader\AttributeLoader; class CascadeTest extends TestCase { public function testCascadeAttribute() { $metadata = new ClassMetadata(CascadeDummy::class); $loader = new AttributeLoader();
{ "filepath": "src/Symfony/Component/Validator/Tests/Constraints/CascadeTest.php", "language": "php", "file_size": 1213, "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\Validator\Tests\Constraints; use PHPUnit\Framework\TestCase; use Symfony\Component\Validator\Constraints...
[$aConstraint] = $metadata->getPropertyMetadata('a')[0]->getConstraints(); self::assertSame([1, 2], $aConstraint->choices); self::assertSame(['Default', 'ChoiceDummy'], $aConstraint->groups); /** @var Choice $bConstraint */
ributes() { $metadata = new ClassMetadata(ChoiceDummy::class); $loader = new AttributeLoader(); self::assertTrue($loader->loadClassMetadata($metadata)); /** @var Choice $aConstraint */
{ "filepath": "src/Symfony/Component/Validator/Tests/Constraints/ChoiceTest.php", "language": "php", "file_size": 2224, "cut_index": 563, "middle_length": 229 }
buted with this source code. */ namespace Symfony\Component\Validator\Tests\Constraints; use PHPUnit\Framework\Attributes\DataProvider; use PHPUnit\Framework\TestCase; use Symfony\Component\Validator\Constraints\Cidr; use Symfony\Component\Validator\Constraints\Ip; use Symfony\Component\Validator\Exception\Constrain...
int->netmaskMax); } public function testForV4() { $cidrConstraint = new Cidr(version: Ip::V4); self::assertEquals(Ip::V4, $cidrConstraint->version); self::assertEquals(0, $cidrConstraint->netmaskMin); self::ass
ion testForAll() { $cidrConstraint = new Cidr(); self::assertEquals(Ip::ALL, $cidrConstraint->version); self::assertEquals(0, $cidrConstraint->netmaskMin); self::assertEquals(128, $cidrConstra
{ "filepath": "src/Symfony/Component/Validator/Tests/Constraints/CidrTest.php", "language": "php", "file_size": 5445, "cut_index": 716, "middle_length": 229 }
buted with this source code. */ namespace Symfony\Component\Validator\Tests\Constraints; use PHPUnit\Framework\Attributes\TestWithJson; use PHPUnit\Framework\TestCase; use Symfony\Component\Validator\Constraints\Collection; use Symfony\Component\Validator\Constraints\Email; use Symfony\Component\Validator\Constraint...
his->expectException(ConstraintDefinitionException::class); new Collection([ 'foo' => new Valid(), ]); } public function testRejectValidConstraintWithinOptional() { $this->expectException(ConstraintDefinitio
e Symfony\Component\Validator\Exception\MissingOptionsException; /** * @author Bernhard Schussek <bschussek@gmail.com> */ class CollectionTest extends TestCase { public function testRejectValidConstraint() { $t
{ "filepath": "src/Symfony/Component/Validator/Tests/Constraints/CollectionTest.php", "language": "php", "file_size": 5977, "cut_index": 716, "middle_length": 229 }
idator; use Symfony\Component\Validator\Constraints\NotNull; use Symfony\Component\Validator\Constraints\Optional; use Symfony\Component\Validator\Constraints\Range; use Symfony\Component\Validator\Constraints\Required; use Symfony\Component\Validator\Exception\UnexpectedValueException; use Symfony\Component\Validator\...
ew Range(min: 4), ])); $this->assertNoViolation(); } public function testFieldsAsDefaultOption() { $constraint = new Range(min: 4); $data = $this->prepareTestData(['foo' => 'foobar']); $this->expectVa
return new CollectionValidator(); } abstract protected function prepareTestData(array $contents); public function testNullIsValid() { $this->validate(null, new Collection(fields: [ 'foo' => n
{ "filepath": "src/Symfony/Component/Validator/Tests/Constraints/CollectionValidatorTestCase.php", "language": "php", "file_size": 10051, "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\Validator\Tests\Constraints; use PHPUnit\Framework\TestCase; use Symfony\Component\Validator\Constraints...
me(['my-group', 'my-other-group'], $compound->groups); $this->assertSame($payload, $compound->payload); } public function testGroupsArePropagatedToNestedCompositeConstraints() { $compound = new CompoundWithSequentially(groups:
st extends TestCase { public function testGroupsAndPayload() { $payload = new \stdClass(); $compound = new EmptyCompound(groups: ['my-group', 'my-other-group'], payload: $payload); $this->assertSa
{ "filepath": "src/Symfony/Component/Validator/Tests/Constraints/CompoundTest.php", "language": "php", "file_size": 2764, "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\Validator\Tests\Constraints; use PHPUnit\Framework\TestCase; use Symfony\Compo...
[$aConstraint] = $metadata->getPropertyMetadata('a')[0]->getConstraints(); self::assertSame(2, $aConstraint->value); self::assertNull($aConstraint->propertyPath); [$bConstraint] = $metadata->getPropertyMetadata('b')[0]->getConstr
stCase { public function testAttributes() { $metadata = new ClassMetadata(DivisibleByDummy::class); $loader = new AttributeLoader(); self::assertTrue($loader->loadClassMetadata($metadata));
{ "filepath": "src/Symfony/Component/Validator/Tests/Constraints/DivisibleByTest.php", "language": "php", "file_size": 1775, "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\Validator\Tests\Constraints; use PHPUnit\Framework\Attributes\DataProvider; use Symfony\Component\Validator\Constraint; use Symfony\Component\Validator\Con...
otected function createValidator(): DivisibleByValidator { return new DivisibleByValidator(); } protected static function createConstraint(?array $options = null): Constraint { if (null !== $options) { return ne
dell@gmail.com> */ class DivisibleByValidatorTest extends AbstractComparisonValidatorTestCase { use InvalidComparisonToValueTestTrait; use ThrowsOnInvalidStringDatesTestTrait; use ValidComparisonToValueTrait; pr
{ "filepath": "src/Symfony/Component/Validator/Tests/Constraints/DivisibleByValidatorTest.php", "language": "php", "file_size": 3140, "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\Validator\Tests\Constraints; use PHPUnit\Framework\TestCase...
ta = new ClassMetadata(EnableAutoMappingDummy::class); $loader = new AttributeLoader(); self::assertSame(AutoMappingStrategy::NONE, $metadata->getAutoMappingStrategy()); self::assertTrue($loader->loadClassMetadata($metadata));
\Component\Validator\Mapping\Loader\AttributeLoader; /** * @author Kévin Dunglas <dunglas@gmail.com> */ class EnableAutoMappingTest extends TestCase { public function testDisableAutoMappingAttribute() { $metada
{ "filepath": "src/Symfony/Component/Validator/Tests/Constraints/EnableAutoMappingTest.php", "language": "php", "file_size": 1155, "cut_index": 518, "middle_length": 229 }
buted with this source code. */ namespace Symfony\Component\Validator\Tests\Constraints; use PHPUnit\Framework\Attributes\DataProvider; use Symfony\Component\Validator\Constraints\Count; use Symfony\Component\Validator\Constraints\CountValidator; use Symfony\Component\Validator\Constraints\DivisibleBy; use Symfony\C...
rray $content); public function testNullIsValid() { $this->validate(null, new Count(6)); $this->assertNoViolation(); } public function testExpectsCountableType() { $this->expectException(UnexpectedValueExcepti
ass CountValidatorTestCase extends ConstraintValidatorTestCase { protected function createValidator(): CountValidator { return new CountValidator(); } abstract protected static function createCollection(a
{ "filepath": "src/Symfony/Component/Validator/Tests/Constraints/CountValidatorTestCase.php", "language": "php", "file_size": 6009, "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\Validator\Tests\Constraints; use PHPUnit\Framework\TestCase; use ...
[$bConstraint] = $metadata->getPropertyMetadata('b')[0]->getConstraints(); self::assertSame('myMessage', $bConstraint->message); self::assertSame(['Default', 'CurrencyDummy'], $bConstraint->groups); [$cConstraint] = $metadata
ends TestCase { public function testAttributes() { $metadata = new ClassMetadata(CurrencyDummy::class); $loader = new AttributeLoader(); self::assertTrue($loader->loadClassMetadata($metadata));
{ "filepath": "src/Symfony/Component/Validator/Tests/Constraints/CurrencyTest.php", "language": "php", "file_size": 1397, "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\Validator\Tests\Constraints; use PHPUnit\Framework\Attributes\DataProvider; use Symfony\Component\Intl\Util\IntlTestHelper; use Symfony\Component\Validator...
= \Locale::getDefault(); } protected function tearDown(): void { parent::tearDown(); \Locale::setDefault($this->defaultLocale); } protected function createValidator(): CurrencyValidator { return new Curren
onstraintValidatorTestCase; class CurrencyValidatorTest extends ConstraintValidatorTestCase { private string $defaultLocale; protected function setUp(): void { parent::setUp(); $this->defaultLocale
{ "filepath": "src/Symfony/Component/Validator/Tests/Constraints/CurrencyValidatorTest.php", "language": "php", "file_size": 3242, "cut_index": 614, "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\Validator\Tests\Fixtures; use Symfony\Component\Valida...
dyMappedNotBlank; #[Assert\All([ new Assert\Type(type: 'string'), new Assert\Iban(), ])] public $alreadyPartiallyMappedCollection; public $readOnly; #[Assert\DisableAutoMapping] public $noAutoMapping; public
$object; public $collection; public $collectionOfUnknown; #[Assert\Type(type: 'int')] public $alreadyMappedType; #[Assert\NotNull] public $alreadyMappedNotNull; #[Assert\NotBlank] public $alrea
{ "filepath": "src/Symfony/Component/Validator/Tests/Fixtures/PropertyInfoLoaderEntity.php", "language": "php", "file_size": 1044, "cut_index": 513, "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\Validator\Tests\Constraints; use PHPUnit\Framework\Attributes\DataProvider; use Symfony\Component\Valida...
{ return new CharsetValidator(); } #[DataProvider('provideValidValues')] public function testEncodingIsValid(string|\Stringable $value, array|string $encodings) { $this->validate($value, new Charset(encodings: $encodin
ConstraintValidatorTestCase; use Symfony\Component\Validator\Tests\Constraints\Fixtures\StringableValue; class CharsetValidatorTest extends ConstraintValidatorTestCase { protected function createValidator(): CharsetValidator
{ "filepath": "src/Symfony/Component/Validator/Tests/Constraints/CharsetValidatorTest.php", "language": "php", "file_size": 2838, "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\Validator\Tests\Constraints; use Symfony\Component\Valid...
$this->assertNoViolation(); } public function testCompareWithUninitializedPropertyAtPropertyPath() { $this->setObject(new TypedDummy()); $this->validate(5, $this->createConstraint([ 'message' => 'Constraint Me
ateConstraint(['propertyPath' => 'value']); $constraint->message = 'Constraint Message'; $object = new ComparisonTest_Class(null); $this->setObject($object); $this->validate(5, $constraint);
{ "filepath": "src/Symfony/Component/Validator/Tests/Constraints/CompareWithNullValueAtPropertyAtTestTrait.php", "language": "php", "file_size": 1105, "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\Validator\Tests\Constraints; use PHPUnit\Framework\TestCase...
data = new ClassMetadata(DisableAutoMappingDummy::class); $loader = new AttributeLoader(); self::assertSame(AutoMappingStrategy::NONE, $metadata->getAutoMappingStrategy()); self::assertTrue($loader->loadClassMetadata($metadata));
y\Component\Validator\Mapping\Loader\AttributeLoader; /** * @author Kévin Dunglas <dunglas@gmail.com> */ class DisableAutoMappingTest extends TestCase { public function testDisableAutoMappingAttribute() { $meta
{ "filepath": "src/Symfony/Component/Validator/Tests/Constraints/DisableAutoMappingTest.php", "language": "php", "file_size": 1161, "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\Validator\Tests\Constraints; use PHPUnit\Framework\TestCase; use Symfony\Component\Validator\Constraints...
e); } public function testConstructorHtml5AllowNoTld() { $subject = new Email(mode: Email::VALIDATION_MODE_HTML5_ALLOW_NO_TLD); $this->assertEquals(Email::VALIDATION_MODE_HTML5_ALLOW_NO_TLD, $subject->mode); } public
r; class EmailTest extends TestCase { public function testConstructorStrict() { $subject = new Email(mode: Email::VALIDATION_MODE_STRICT); $this->assertEquals(Email::VALIDATION_MODE_STRICT, $subject->mod
{ "filepath": "src/Symfony/Component/Validator/Tests/Constraints/EmailTest.php", "language": "php", "file_size": 2823, "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\Validator\Tests\Constraints; use PHPUnit\Framework\Attributes\DataProvider; use Symfony\Component\Intl\Util\IntlTestHelper; use Symfony\Component\Validator...
Locale::getDefault(); } protected function tearDown(): void { parent::tearDown(); \Locale::setDefault($this->defaultLocale); } protected function createValidator(): CountryValidator { return new CountryVal
straintValidatorTestCase; class CountryValidatorTest extends ConstraintValidatorTestCase { private string $defaultLocale; protected function setUp(): void { parent::setUp(); $this->defaultLocale = \
{ "filepath": "src/Symfony/Component/Validator/Tests/Constraints/CountryValidatorTest.php", "language": "php", "file_size": 4156, "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\Validator\Tests\Constraints; use PHPUnit\Framework\TestCase; use Symfony\Compo...
} public function testMultipleEncodingCanBeSet() { $encoding = new Charset(['ASCII', 'UTF-8']); $this->assertSame(['ASCII', 'UTF-8'], $encoding->encodings); } public function testThrowsOnNoCharset() { $th
tor\Mapping\Loader\AttributeLoader; class CharsetTest extends TestCase { public function testSingleEncodingCanBeSet() { $encoding = new Charset('UTF-8'); $this->assertSame('UTF-8', $encoding->encodings);
{ "filepath": "src/Symfony/Component/Validator/Tests/Constraints/CharsetTest.php", "language": "php", "file_size": 1900, "cut_index": 537, "middle_length": 229 }
buted with this source code. */ namespace Symfony\Component\Validator\Tests\Constraints; use PHPUnit\Framework\Attributes\DataProvider; use Symfony\Component\Validator\Constraints\Cidr; use Symfony\Component\Validator\Constraints\CidrValidator; use Symfony\Component\Validator\Constraints\Ip; use Symfony\Component\Va...
tor { return new CidrValidator(); } public function testNullIsValid() { $this->validate(null, new Cidr()); $this->assertNoViolation(); } public function testEmptyStringIsValid() { $this->valida
tor\Test\ConstraintValidatorTestCase; use Symfony\Component\Validator\Tests\Constraints\Fixtures\StringableValue; class CidrValidatorTest extends ConstraintValidatorTestCase { protected function createValidator(): CidrValida
{ "filepath": "src/Symfony/Component/Validator/Tests/Constraints/CidrValidatorTest.php", "language": "php", "file_size": 8260, "cut_index": 716, "middle_length": 229 }
dator\Constraints\Email; use Symfony\Component\Validator\Constraints\EmailValidator; use Symfony\Component\Validator\Exception\UnexpectedValueException; use Symfony\Component\Validator\Test\ConstraintValidatorTestCase; #[Group('dns-sensitive')] class EmailValidatorTest extends ConstraintValidatorTestCase { protect...
tNullIsValid() { $this->validate(null, new Email()); $this->assertNoViolation(); } public function testEmptyStringIsValid() { $this->validate('', new Email()); $this->assertNoViolation(); } public
$this->expectException(\InvalidArgumentException::class); $this->expectExceptionMessage('The "defaultMode" parameter value is not valid.'); new EmailValidator('Unknown Mode'); } public function tes
{ "filepath": "src/Symfony/Component/Validator/Tests/Constraints/EmailValidatorTest.php", "language": "php", "file_size": 9802, "cut_index": 921, "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\Validator\Tests\Constraints; use PHPUnit\Framework\TestCase; use Symfony\Compo...
traint] = $metadata->getPropertyMetadata('a')[0]->getConstraints(); self::assertSame('Y-m-d H:i:s', $aConstraint->format); [$bConstraint] = $metadata->getPropertyMetadata('b')[0]->getConstraints(); self::assertSame('d.m.Y', $bConst
{ public function testAttributes() { $metadata = new ClassMetadata(DateTimeDummy::class); $loader = new AttributeLoader(); self::assertTrue($loader->loadClassMetadata($metadata)); [$aCons
{ "filepath": "src/Symfony/Component/Validator/Tests/Constraints/DateTimeTest.php", "language": "php", "file_size": 1684, "cut_index": 537, "middle_length": 229 }
buted with this source code. */ namespace Symfony\Component\Validator\Tests\Constraints; use PHPUnit\Framework\TestCase; use Symfony\Component\Validator\Constraint; use Symfony\Component\Validator\Constraints\Composite; use Symfony\Component\Validator\Constraints\Length; use Symfony\Component\Validator\Constraints\N...
$this->constraints = $constraints; parent::__construct(null, $groups); } protected function getCompositeOption(): array { return ['constraints', 'otherNested']; } } /** * @author Bernhard Schussek <bschussek@gmail.
ConcreteComposite extends Composite { public array|Constraint $constraints = []; public function __construct(array|Constraint $constraints = [], public array|Constraint $otherNested = [], ?array $groups = null) {
{ "filepath": "src/Symfony/Component/Validator/Tests/Constraints/CompositeTest.php", "language": "php", "file_size": 7357, "cut_index": 716, "middle_length": 229 }
buted with this source code. */ namespace Symfony\Component\Validator\Tests\Constraints; use PHPUnit\Framework\Attributes\DataProvider; use Symfony\Component\Validator\Constraints\Choice; use Symfony\Component\Validator\Constraints\ChoiceValidator; use Symfony\Component\Validator\Exception\ConstraintDefinitionExcept...
return ['foo', 'bar']; } public function objectMethodCallback() { return ['foo', 'bar']; } public static function staticCallbackInvalid() { return null; } public function testExpectArrayIfMultiple
']; } class ChoiceValidatorTest extends ConstraintValidatorTestCase { protected function createValidator(): ChoiceValidator { return new ChoiceValidator(); } public static function staticCallback() {
{ "filepath": "src/Symfony/Component/Validator/Tests/Constraints/ChoiceValidatorTest.php", "language": "php", "file_size": 8782, "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\Validator\Tests\Constraints; use PHPUnit\Framework\TestCase; use Symfony\Compo...
etadata->getPropertyMetadata('a')[0]->getConstraints(); self::assertFalse($aConstraint->caseSensitive); self::assertFalse($aConstraint->requireHyphen); [$bConstraint] = $metadata->getPropertyMetadata('b')[0]->getConstraints();
ublic function testAttributes() { $metadata = new ClassMetadata(IssnDummy::class); $loader = new AttributeLoader(); self::assertTrue($loader->loadClassMetadata($metadata)); [$aConstraint] = $m
{ "filepath": "src/Symfony/Component/Validator/Tests/Constraints/IssnTest.php", "language": "php", "file_size": 1713, "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\Validator\Tests\Constraints; use PHPUnit\Framework\TestCase; use Symfony\Compo...
ore: PasswordStrength::STRENGTH_STRONG, message: 'This password should be strong.'); $this->assertSame(PasswordStrength::STRENGTH_STRONG, $constraint->minScore); $this->assertSame('This password should be strong.', $constraint->message);
structor() { $constraint = new PasswordStrength(); $this->assertSame(2, $constraint->minScore); } public function testConstructorWithParameters() { $constraint = new PasswordStrength(minSc
{ "filepath": "src/Symfony/Component/Validator/Tests/Constraints/PasswordStrengthTest.php", "language": "php", "file_size": 1766, "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\Validator\Tests\Constraints; use PHPUnit\Framework\Attributes\DataProvider; use Symfony\Component\Validator\Constraints\PasswordStrength; use Symfony\Compo...
etValidValues')] public function testValidValues(string|\Stringable $value, int $expectedStrength) { $this->validate($value, new PasswordStrength(minScore: $expectedStrength)); $this->assertNoViolation(); if (PasswordStren
ue; class PasswordStrengthValidatorTest extends ConstraintValidatorTestCase { protected function createValidator(): PasswordStrengthValidator { return new PasswordStrengthValidator(); } #[DataProvider('g
{ "filepath": "src/Symfony/Component/Validator/Tests/Constraints/PasswordStrengthValidatorTest.php", "language": "php", "file_size": 3973, "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\Validator\Tests\Constraints; use PHPUnit\Framework\Attributes\DataProvider; use Symfony\Component\Validator\Constraints\PasswordStrength; use Symfony\Compo...
ing $value) { $length = \strlen($value); return match (true) { $length < 6 => PasswordStrength::STRENGTH_VERY_WEAK, $length < 10 => PasswordStrength::STRENGTH_WEAK, $length < 15 => Pa
ue; class PasswordStrengthValidatorWithClosureTest extends ConstraintValidatorTestCase { protected function createValidator(): PasswordStrengthValidator { return new PasswordStrengthValidator(static function (str
{ "filepath": "src/Symfony/Component/Validator/Tests/Constraints/PasswordStrengthValidatorWithClosureTest.php", "language": "php", "file_size": 3811, "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\Validator\Tests\Constraints; use PHPUnit\Framework\TestCase; use ...
a($metadata)); [$aConstraint] = $metadata->getPropertyMetadata('a')[0]->getConstraints(); self::assertSame(0, $aConstraint->value); self::assertNull($aConstraint->propertyPath); self::assertSame(['Default', 'PositiveOrZeroD
ZeroTest extends TestCase { public function testAttributes() { $metadata = new ClassMetadata(PositiveOrZeroDummy::class); $loader = new AttributeLoader(); self::assertTrue($loader->loadClassMetadat
{ "filepath": "src/Symfony/Component/Validator/Tests/Constraints/PositiveOrZeroTest.php", "language": "php", "file_size": 1398, "cut_index": 524, "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\Validator\Tests\Constraints; use PHPUnit\Framework\TestCase; use ...
[$aConstraint] = $metadata->getPropertyMetadata('a')[0]->getConstraints(); self::assertSame(0, $aConstraint->value); self::assertNull($aConstraint->propertyPath); self::assertSame(['Default', 'PositiveDummy'], $aConstraint->gr
ends TestCase { public function testAttributes() { $metadata = new ClassMetadata(PositiveDummy::class); $loader = new AttributeLoader(); self::assertTrue($loader->loadClassMetadata($metadata));
{ "filepath": "src/Symfony/Component/Validator/Tests/Constraints/PositiveTest.php", "language": "php", "file_size": 1356, "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\Validator\Tests\Constraints; use PHPUnit\Framework\TestCase; use Symfony\Component\Validator\Constraints...
inPropertyPath" options to be set, not both.'); new Range(min: 'min', minPropertyPath: 'minPropertyPath'); } public function testThrowsConstraintExceptionIfBothMaxLimitAndPropertyPathNamed() { $this->expectException(ConstraintD
ic function testThrowsConstraintExceptionIfBothMinLimitAndPropertyPathNamed() { $this->expectException(ConstraintDefinitionException::class); $this->expectExceptionMessage('requires only one of the "min" or "m
{ "filepath": "src/Symfony/Component/Validator/Tests/Constraints/RangeTest.php", "language": "php", "file_size": 2987, "cut_index": 563, "middle_length": 229 }
RangeValidatorTest extends ConstraintValidatorTestCase { use IcuCompatibilityTrait; protected function createValidator(): RangeValidator { return new RangeValidator(); } public function testNullIsValid() { $this->validate(null, new Range(min: 10, max: 20)); $this->ass...
.99999"'], [5, '5'], [1.0, '1'], ]; } public static function getMoreThanTwenty(): array { return [ [20.000001, '20.000001'], ['20.000001', '"20.000001"'], [21, '21'],
999'], [10], [20], [10.0], [20.0], ]; } public static function getLessThanTen() { return [ [9.99999, '9.99999'], ['9.99999', '"9
{ "filepath": "src/Symfony/Component/Validator/Tests/Constraints/RangeValidatorTest.php", "language": "php", "file_size": 31221, "cut_index": 1331, "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\Validator\Tests\Constraints; use PHPUnit\Framework\Attributes\DataProvider; use PHPUnit\Framework\TestCase; use Symfony\Component\Validator\Constraints\Reg...
[0-9]+$/', $constraint->pattern); } public static function provideHtmlPatterns() { return [ // HTML5 wraps the pattern in ^(?:pattern)$ ['/^[0-9]+$/', '[0-9]+'], ['/[0-9]+$/', '.*[0-9]+'],
** * @author Bernhard Schussek <bschussek@gmail.com> */ class RegexTest extends TestCase { public function testConstraintGetDefaultOption() { $constraint = new Regex('/^[0-9]+$/'); $this->assertSame('/^
{ "filepath": "src/Symfony/Component/Validator/Tests/Constraints/RegexTest.php", "language": "php", "file_size": 4918, "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\Validator\Tests\Constraints; use PHPUnit\Framework\Attributes\DataProvider; use Symfony\Component\Validator\Constraints\Regex; use Symfony\Component\Valida...
pattern: '/^[0-9]+$/')); $this->assertNoViolation(); } public function testEmptyStringIsValid() { $this->validate('', new Regex(pattern: '/^[0-9]+$/')); $this->assertNoViolation(); } public function testExpec
extends ConstraintValidatorTestCase { protected function createValidator(): RegexValidator { return new RegexValidator(); } public function testNullIsValid() { $this->validate(null, new Regex(
{ "filepath": "src/Symfony/Component/Validator/Tests/Constraints/RegexValidatorTest.php", "language": "php", "file_size": 3844, "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\Validator\Tests\Constraints; use PHPUnit\Framework\TestCase; use Symfony\Compo...
ceptionMessage('The value "foo" is not an instance of Constraint in constraint "Symfony\Component\Validator\Constraints\Sequentially"'); new Sequentially([ 'foo', ]); } public function testRejectValidConstraint() {
ator\Exception\MissingOptionsException; class SequentiallyTest extends TestCase { public function testRejectNonConstraints() { $this->expectException(ConstraintDefinitionException::class); $this->expectEx
{ "filepath": "src/Symfony/Component/Validator/Tests/Constraints/SequentiallyTest.php", "language": "php", "file_size": 1902, "cut_index": 537, "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\Validator\Tests\Constraints; use Symfony\Component\Validator\Constraints\GreaterThan; use Symfony\Compon...
torTestCase; use Symfony\Component\Validator\Validation; class SequentiallyValidatorTest extends ConstraintValidatorTestCase { protected function createValidator(): SequentiallyValidator { return new SequentiallyValidator(); } pub
ally; use Symfony\Component\Validator\Constraints\SequentiallyValidator; use Symfony\Component\Validator\Constraints\Type; use Symfony\Component\Validator\ConstraintViolation; use Symfony\Component\Validator\Test\ConstraintValida
{ "filepath": "src/Symfony/Component/Validator/Tests/Constraints/SequentiallyValidatorTest.php", "language": "php", "file_size": 2690, "cut_index": 563, "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\Validator\Tests\Constraints; use PHPUnit\Framework\Attributes\Dat...
ption::class); $this->expectExceptionMessage($expectedMessage); $this->validate($value, $constraint); } public static function throwsOnInvalidStringDatesProvider(): array { $constraint = static::createConstraint([
#[DataProvider('throwsOnInvalidStringDatesProvider')] public function testThrowsOnInvalidStringDates(AbstractComparison $constraint, $expectedMessage, $value) { $this->expectException(ConstraintDefinitionExce
{ "filepath": "src/Symfony/Component/Validator/Tests/Constraints/ThrowsOnInvalidStringDatesTestTrait.php", "language": "php", "file_size": 1450, "cut_index": 524, "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\Validator\Tests\Constraints; use PHPUnit\Framework\TestCase; use ...
straint] = $metadata->getPropertyMetadata('b')[0]->getConstraints(); self::assertSame('myMessage', $bConstraint->message); self::assertSame(['Default', 'TimeDummy'], $bConstraint->groups); [$cConstraint] = $metadata->getPropertyMet
tCase { public function testAttributes() { $metadata = new ClassMetadata(TimeDummy::class); $loader = new AttributeLoader(); self::assertTrue($loader->loadClassMetadata($metadata)); [$bCon
{ "filepath": "src/Symfony/Component/Validator/Tests/Constraints/TimeTest.php", "language": "php", "file_size": 1365, "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\Validator\Tests\Constraints; use PHPUnit\Framework\Attributes\DataProvider; use Symfony\Component\Validator\Constraints\Time; use Symfony\Component\Validat...
$this->assertNoViolation(); } public function testDefaultWithSeconds() { $this->validate('10:15:25', new Time()); $this->assertNoViolation(); } public function testEmptyStringIsValid() { $this->vali
ends ConstraintValidatorTestCase { protected function createValidator(): TimeValidator { return new TimeValidator(); } public function testNullIsValid() { $this->validate(null, new Time());
{ "filepath": "src/Symfony/Component/Validator/Tests/Constraints/TimeValidatorTest.php", "language": "php", "file_size": 4238, "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\Validator\Tests\Constraints; use PHPUnit\Framework\Attributes\DataProvider; use PHPUnit\Framework\TestCase; use Symfony\Component\Validator\Constraints\Tim...
L); new Timezone(\DateTimeZone::ALL_WITH_BC); new Timezone( zone: \DateTimeZone::PER_COUNTRY, countryCode: 'AR', ); $this->addToAssertionCount(1); } public function testExceptionForGroupedTi
oader; /** * @author Javier Spagnoletti <phansys@gmail.com> */ class TimezoneTest extends TestCase { public function testValidTimezoneConstraints() { new Timezone(); new Timezone(zone: \DateTimeZone::AL
{ "filepath": "src/Symfony/Component/Validator/Tests/Constraints/TimezoneTest.php", "language": "php", "file_size": 3074, "cut_index": 614, "middle_length": 229 }
\Component\Validator\Constraints\Timezone; use Symfony\Component\Validator\Constraints\TimezoneValidator; use Symfony\Component\Validator\Exception\UnexpectedValueException; use Symfony\Component\Validator\Test\ConstraintValidatorTestCase; /** * @author Javier Spagnoletti <phansys@gmail.com> * @author Hugo Hamon <hu...
ezone()); $this->assertNoViolation(); } public function testExpectsStringCompatibleType() { $this->expectException(UnexpectedValueException::class); $this->validate(new \stdClass(), new Timezone()); } #[DataPr
} public function testNullIsValid() { $this->validate(null, new Timezone()); $this->assertNoViolation(); } public function testEmptyStringIsValid() { $this->validate('', new Tim
{ "filepath": "src/Symfony/Component/Validator/Tests/Constraints/TimezoneValidatorTest.php", "language": "php", "file_size": 11253, "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\Validator\Tests\Constraints; use PHPUnit\Framework\TestCase; use ...
self::assertTrue($loader->loadClassMetadata($metadata)); self::assertSame(TraversalStrategy::TRAVERSE, $metadata->getTraversalStrategy()); } public function testNegativeAttribute() { $metadata = new ClassMetadata(DoNotTr
alidator\Mapping\TraversalStrategy; class TraverseTest extends TestCase { public function testPositiveAttributes() { $metadata = new ClassMetadata(TraverseDummy::class); $loader = new AttributeLoader();
{ "filepath": "src/Symfony/Component/Validator/Tests/Constraints/TraverseTest.php", "language": "php", "file_size": 1310, "cut_index": 524, "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\Validator\Tests\Constraints; use PHPUnit\Framework\TestCase; use Symfony\Compo...
($metadata)); [$aConstraint] = $metadata->getPropertyMetadata('a')[0]->getConstraints(); self::assertSame('integer', $aConstraint->type); [$bConstraint] = $metadata->getPropertyMetadata('b')[0]->getConstraints(); self::ass
ng\Loader\AttributeLoader; class TypeTest extends TestCase { public function testAttributes() { $metadata = new ClassMetadata(TypeDummy::class); self::assertTrue((new AttributeLoader())->loadClassMetadata
{ "filepath": "src/Symfony/Component/Validator/Tests/Constraints/TypeTest.php", "language": "php", "file_size": 2016, "cut_index": 537, "middle_length": 229 }
buted with this source code. */ namespace Symfony\Component\Validator\Tests\Constraints; use PHPUnit\Framework\Attributes\DataProvider; use Symfony\Component\Validator\Constraints\Type; use Symfony\Component\Validator\Constraints\TypeValidator; use Symfony\Component\Validator\Test\ConstraintValidatorTestCase; class...
{ $constraint = new Type(type: 'string'); $this->validate('', $constraint); $this->assertNoViolation(); } public function testEmptyIsInvalidIfNoString() { $constraint = new Type( type: 'integer'
public function testNullIsValid() { $constraint = new Type(type: 'integer'); $this->validate(null, $constraint); $this->assertNoViolation(); } public function testEmptyIsValidIfString()
{ "filepath": "src/Symfony/Component/Validator/Tests/Constraints/TypeValidatorTest.php", "language": "php", "file_size": 6927, "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\Validator\Tests\Constraints; use PHPUnit\Framework\TestCase; use Symfony\Compo...
True($loader->loadClassMetadata($metadata)); [$bConstraint] = $metadata->getPropertyMetadata('b')[0]->getConstraints(); self::assertSame('myMessage', $bConstraint->message); self::assertSame(['Default', 'UlidDummy'], $bConstraint->
\Mapping\Loader\AttributeLoader; class UlidTest extends TestCase { public function testAttributes() { $metadata = new ClassMetadata(UlidDummy::class); $loader = new AttributeLoader(); self::assert
{ "filepath": "src/Symfony/Component/Validator/Tests/Constraints/UlidTest.php", "language": "php", "file_size": 1804, "cut_index": 537, "middle_length": 229 }
buted with this source code. */ namespace Symfony\Component\Validator\Tests\Constraints; use PHPUnit\Framework\Attributes\DataProvider; use Symfony\Component\Validator\Constraints\Ulid; use Symfony\Component\Validator\Constraints\UlidValidator; use Symfony\Component\Validator\Exception\UnexpectedValueException; use ...
public function testEmptyStringIsValid() { $this->validate('', new Ulid()); $this->assertNoViolation(); } public function testExpectsStringCompatibleType() { $this->expectException(UnexpectedValueException::clas
ected function createValidator(): UlidValidator { return new UlidValidator(); } public function testNullIsValid() { $this->validate(null, new Ulid()); $this->assertNoViolation(); }
{ "filepath": "src/Symfony/Component/Validator/Tests/Constraints/UlidValidatorTest.php", "language": "php", "file_size": 5114, "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\Validator\Tests\Constraints; use PHPUnit\Framework\TestCase; use Symfony\Compo...
] = $metadata->getPropertyMetadata('b')[0]->getConstraints(); self::assertSame('myMessage', $bConstraint->message); self::assertSame(['Default', 'UniqueDummy'], $bConstraint->groups); [$cConstraint] = $metadata->getPropertyMetadata
public function testAttributes() { $metadata = new ClassMetadata(UniqueDummy::class); $loader = new AttributeLoader(); self::assertTrue($loader->loadClassMetadata($metadata)); [$bConstraint
{ "filepath": "src/Symfony/Component/Validator/Tests/Constraints/UniqueTest.php", "language": "php", "file_size": 1580, "cut_index": 537, "middle_length": 229 }
mponent\Validator\Constraints\UniqueValidator; use Symfony\Component\Validator\Exception\UnexpectedTypeException; use Symfony\Component\Validator\Exception\UnexpectedValueException; use Symfony\Component\Validator\Test\ConstraintValidatorTestCase; use Symfony\Component\Validator\Tests\Dummy\DummyClassOne; class Unique...
value) { $this->validate($value, new Unique()); $this->assertNoViolation(); } public static function getValidValues() { return [ yield 'null' => [[null]], yield 'empty array' => [[]],
UniqueConstraintCompatibleType() { $this->expectException(UnexpectedValueException::class); $this->validate('', new Unique()); } #[DataProvider('getValidValues')] public function testValidValues($
{ "filepath": "src/Symfony/Component/Validator/Tests/Constraints/UniqueValidatorTest.php", "language": "php", "file_size": 15013, "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\Validator\Tests\Constraints; use PHPUnit\Framework\Attributes\TestWith; use PHPUnit\Framework\TestCase; ...
lizer); } public function testAttributes() { $metadata = new ClassMetadata(UrlDummy::class); self::assertTrue((new AttributeLoader())->loadClassMetadata($metadata)); [$aConstraint] = $metadata->getPropertyMetadata('a')
ranto <renantaranto@gmail.com> */ class UrlTest extends TestCase { public function testNormalizerCanBeSet() { $url = new Url(normalizer: 'trim', requireTld: true); $this->assertEquals('trim', $url->norma
{ "filepath": "src/Symfony/Component/Validator/Tests/Constraints/UrlTest.php", "language": "php", "file_size": 2973, "cut_index": 563, "middle_length": 229 }
nent\Validator\Constraints\UrlValidator; use Symfony\Component\Validator\Exception\UnexpectedValueException; use Symfony\Component\Validator\Test\ConstraintValidatorTestCase; class UrlValidatorTest extends ConstraintValidatorTestCase { protected function createValidator(): UrlValidator { return new Url...
, new Url(requireTld: true)); $this->assertNoViolation(); } public function testExpectsStringCompatibleType() { $this->expectException(UnexpectedValueException::class); $this->validate(new \stdClass(), new Url(requireT
ptyStringIsValid() { $this->validate('', new Url(requireTld: true)); $this->assertNoViolation(); } public function testEmptyStringFromObjectIsValid() { $this->validate(new EmailProvider()
{ "filepath": "src/Symfony/Component/Validator/Tests/Constraints/UrlValidatorTest.php", "language": "php", "file_size": 15838, "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\Validator\Tests\Constraints; use PHPUnit\Framework\TestCase; use Symfony\Component\Validator\Constraints...
{ $metadata = new ClassMetadata(UuidDummy::class); self::assertTrue((new AttributeLoader())->loadClassMetadata($metadata)); [$aConstraint] = $metadata->getPropertyMetadata('a')[0]->getConstraints(); self::assertSame(Uuid::A
uidTest extends TestCase { public function testNormalizerCanBeSet() { $uuid = new Uuid(normalizer: 'trim'); $this->assertEquals('trim', $uuid->normalizer); } public function testAttributes()
{ "filepath": "src/Symfony/Component/Validator/Tests/Constraints/UuidTest.php", "language": "php", "file_size": 2093, "cut_index": 563, "middle_length": 229 }
Validator\Constraints\Uuid; use Symfony\Component\Validator\Constraints\UuidValidator; use Symfony\Component\Validator\Exception\UnexpectedTypeException; use Symfony\Component\Validator\Exception\UnexpectedValueException; use Symfony\Component\Validator\Test\ConstraintValidatorTestCase; /** * @author Colin O'Dell <co...
$this->assertNoViolation(); } public function testExpectsUuidConstraintCompatibleType() { $constraint = $this->createStub(Constraint::class); $this->expectException(UnexpectedTypeException::class); $this->validate('
public function testNullIsValid() { $this->validate(null, new Uuid()); $this->assertNoViolation(); } public function testEmptyStringIsValid() { $this->validate('', new Uuid());
{ "filepath": "src/Symfony/Component/Validator/Tests/Constraints/UuidValidatorTest.php", "language": "php", "file_size": 12094, "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\Validator\Tests\Constraints; use PHPUnit\Framework\Attribut...
ray { // The provider runs before setUp(), so we need to manually fix // the default timezone $timezone = date_default_timezone_get(); date_default_timezone_set('UTC'); $comparisons = self::addPhp5Dot5Comparison
$constraint = $this->createConstraint(['value' => $comparisonValue]); $this->validate($dirtyValue, $constraint); $this->assertNoViolation(); } public static function provideAllValidComparisons(): ar
{ "filepath": "src/Symfony/Component/Validator/Tests/Constraints/ValidComparisonToValueTrait.php", "language": "php", "file_size": 1126, "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\Validator\Tests\Constraints; use PHPUnit\Framework\TestCase; use Symfony\Compo...
function testGroupsAreNullByDefault() { $constraint = new Valid(); $this->assertNull($constraint->groups); } public function testAttributes() { $metadata = new ClassMetadata(ValidDummy::class); $loader = ne
ussek@gmail.com> */ class ValidTest extends TestCase { public function testGroupsCanBeSet() { $constraint = new Valid(groups: ['foo']); $this->assertSame(['foo'], $constraint->groups); } public
{ "filepath": "src/Symfony/Component/Validator/Tests/Constraints/ValidTest.php", "language": "php", "file_size": 1791, "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\Validator\Tests\Constraints; use PHPUnit\Framework\TestCase; use Symfony\Compo...
$this->assertCount(1, $violations); $this->assertSame('fooBar.fooBarBaz.foo', $violations->get(0)->getPropertyPath()); } public function testNullValues() { $validatorBuilder = new ValidatorBuilder(); $validator = $valid
xts() { $validatorBuilder = new ValidatorBuilder(); $validator = $validatorBuilder->enableAttributeMapping()->getValidator(); $violations = $validator->validate(new Foo(), null, ['nested']);
{ "filepath": "src/Symfony/Component/Validator/Tests/Constraints/ValidValidatorTest.php", "language": "php", "file_size": 1667, "cut_index": 537, "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\Validator\Tests\Constraints; use PHPUnit\Framework\TestCase; use Symfony\Component\Process\ExecutableFin...
} } public function testAttributes() { $metadata = new ClassMetadata(VideoDummy::class); $loader = new AttributeLoader(); self::assertTrue($loader->loadClassMetadata($metadata)); [$aConstraint] = $metadata->ge
extends TestCase { public static function setUpBeforeClass(): void { if (!(new ExecutableFinder())->find('ffprobe')) { self::markTestSkipped('The ffprobe binary is required to run this test.');
{ "filepath": "src/Symfony/Component/Validator/Tests/Constraints/VideoTest.php", "language": "php", "file_size": 2197, "cut_index": 563, "middle_length": 229 }
y\Component\Validator\Constraints\Video; use Symfony\Component\Validator\Constraints\VideoValidator; use Symfony\Component\Validator\Test\ConstraintValidatorTestCase; #[RequiresPhpExtension('fileinfo')] class VideoValidatorTest extends ConstraintValidatorTestCase { public static function setUpBeforeClass(): void ...
tion testEmptyStringIsValid() { $this->validate('', new Video()); $this->assertNoViolation(); } public function testValidVideo() { $this->validate(__DIR__.'/Fixtures/test.mp4', new Video()); $this->assertN
eateValidator(): VideoValidator { return new VideoValidator(); } public function testNullIsValid() { $this->validate(null, new Video()); $this->assertNoViolation(); } public func
{ "filepath": "src/Symfony/Component/Validator/Tests/Constraints/VideoValidatorTest.php", "language": "php", "file_size": 9252, "cut_index": 921, "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\Validator\Tests\Constraints; use PHPUnit\Framework\Attributes\DataProvider; us...
) { $this->validate($value, new Json()); $this->assertNoViolation(); } #[DataProvider('getInvalidValues')] public function testInvalidValues($value) { $constraint = new Json(message: 'myMessageTest');
rTest extends ConstraintValidatorTestCase { protected function createValidator(): JsonValidator { return new JsonValidator(); } #[DataProvider('getValidValues')] public function testJsonIsValid($value
{ "filepath": "src/Symfony/Component/Validator/Tests/Constraints/JsonValidatorTest.php", "language": "php", "file_size": 1882, "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\Validator\Tests\Constraints; use PHPUnit\Framework\Attributes\DataProvider; use Symfony\Component\Intl\Util\IntlTestHelper; use Symfony\Component\Validator...
= \Locale::getDefault(); } protected function tearDown(): void { parent::tearDown(); \Locale::setDefault($this->defaultLocale); } protected function createValidator(): LanguageValidator { return new Langua
onstraintValidatorTestCase; class LanguageValidatorTest extends ConstraintValidatorTestCase { private string $defaultLocale; protected function setUp(): void { parent::setUp(); $this->defaultLocale
{ "filepath": "src/Symfony/Component/Validator/Tests/Constraints/LanguageValidatorTest.php", "language": "php", "file_size": 4146, "cut_index": 614, "middle_length": 229 }
mponent\Validator\Constraints\LengthValidator; use Symfony\Component\Validator\Exception\UnexpectedValueException; use Symfony\Component\Validator\Test\ConstraintValidatorTestCase; class LengthValidatorTest extends ConstraintValidatorTestCase { protected function createValidator(): LengthValidator { re...
eter('{{ value }}', '""') ->setParameter('{{ limit }}', $limit) ->setParameter('{{ min }}', $limit) ->setParameter('{{ max }}', $limit) ->setParameter('{{ value_length }}', 0) ->setInvalidValue(''
ction testEmptyStringIsInvalid() { $this->validate('', new Length( exactly: $limit = 6, exactMessage: 'myMessage', )); $this->buildViolation('myMessage') ->setParam
{ "filepath": "src/Symfony/Component/Validator/Tests/Constraints/LengthValidatorTest.php", "language": "php", "file_size": 11758, "cut_index": 921, "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\Validator\Tests\Constraints; use Symfony\Component\Validator\Constraint; use Symfony\Component\Validator\Constraints\LessThanOrEqual; use Symfony\Component...
use ValidComparisonToValueTrait; protected function createValidator(): LessThanOrEqualValidator { return new LessThanOrEqualValidator(); } protected static function createConstraint(?array $options = null): Constraint {
alidatorTest extends AbstractComparisonValidatorTestCase { use CompareWithNullValueAtPropertyAtTestTrait; use IcuCompatibilityTrait; use InvalidComparisonToValueTestTrait; use ThrowsOnInvalidStringDatesTestTrait;
{ "filepath": "src/Symfony/Component/Validator/Tests/Constraints/LessThanOrEqualValidatorTest.php", "language": "php", "file_size": 3925, "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\Validator\Tests\Constraints; use PHPUnit\Framework\TestCase; use Symfony\Compo...
traint] = $metadata->getPropertyMetadata('a')[0]->getConstraints(); self::assertSame(2, $aConstraint->value); self::assertNull($aConstraint->propertyPath); [$bConstraint] = $metadata->getPropertyMetadata('b')[0]->getConstraints();
{ public function testAttributes() { $metadata = new ClassMetadata(LessThanDummy::class); $loader = new AttributeLoader(); self::assertTrue($loader->loadClassMetadata($metadata)); [$aCons
{ "filepath": "src/Symfony/Component/Validator/Tests/Constraints/LessThanTest.php", "language": "php", "file_size": 1751, "cut_index": 537, "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\Validator\Tests\Constraints; use PHPUnit\Framework\Attributes\DataProvider; use Symfony\Component\Valida...
static function createConstraint(?array $options = null): Constraint { return new Negative($options); } public static function provideValidComparisons(): array { return [ [-1, 0], [-2, 0],
> */ class LessThanValidatorWithNegativeConstraintTest extends AbstractComparisonValidatorTestCase { protected function createValidator(): LessThanValidator { return new LessThanValidator(); } protected
{ "filepath": "src/Symfony/Component/Validator/Tests/Constraints/LessThanValidatorWithNegativeConstraintTest.php", "language": "php", "file_size": 2642, "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\Validator\Tests\Constraints; use PHPUnit\Framework\Attributes\DataProvider; use Symfony\Component\Validator\Constraints\Locale; use Symfony\Component\Valid...
ocale()); $this->assertNoViolation(); } public function testEmptyStringIsValid() { $this->validate('', new Locale()); $this->assertNoViolation(); } public function testExpectsStringCompatibleType() {
st extends ConstraintValidatorTestCase { protected function createValidator(): LocaleValidator { return new LocaleValidator(); } public function testNullIsValid() { $this->validate(null, new L
{ "filepath": "src/Symfony/Component/Validator/Tests/Constraints/LocaleValidatorTest.php", "language": "php", "file_size": 4286, "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\Validator\Tests\Constraints; use PHPUnit\Framework\Attributes\DataProvider; use Symfony\Component\Validator\Constraints\Luhn; use Symfony\Component\Validat...
$this->assertNoViolation(); } public function testEmptyStringIsValid() { $this->validate('', new Luhn()); $this->assertNoViolation(); } #[DataProvider('getValidNumbers')] public function testValidNumbers($n
ends ConstraintValidatorTestCase { protected function createValidator(): LuhnValidator { return new LuhnValidator(); } public function testNullIsValid() { $this->validate(null, new Luhn());
{ "filepath": "src/Symfony/Component/Validator/Tests/Constraints/LuhnValidatorTest.php", "language": "php", "file_size": 3143, "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\Validator\Tests\Constraints; use PHPUnit\Framework\TestCase; use Symfony\Component\Validator\Constraints...
() { $metadata = new ClassMetadata(MacAddressDummy::class); $loader = new AttributeLoader(); self::assertTrue($loader->loadClassMetadata($metadata)); [$aConstraint] = $metadata->getPropertyMetadata('a')[0]->getConstrain
essTest extends TestCase { public function testNormalizerCanBeSet() { $mac = new MacAddress(normalizer: 'trim'); $this->assertEquals(trim(...), $mac->normalizer); } public function testAttributes
{ "filepath": "src/Symfony/Component/Validator/Tests/Constraints/MacAddressTest.php", "language": "php", "file_size": 2045, "cut_index": 563, "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\Validator\Tests\Constraints; use PHPUnit\Framework\TestCase; use ...
[$aConstraint] = $metadata->getPropertyMetadata('a')[0]->getConstraints(); self::assertSame(0, $aConstraint->value); self::assertNull($aConstraint->propertyPath); self::assertSame(['Default', 'NegativeDummy'], $aConstraint->gr
ends TestCase { public function testAttributes() { $metadata = new ClassMetadata(NegativeDummy::class); $loader = new AttributeLoader(); self::assertTrue($loader->loadClassMetadata($metadata));
{ "filepath": "src/Symfony/Component/Validator/Tests/Constraints/NegativeTest.php", "language": "php", "file_size": 1356, "cut_index": 524, "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\Validator\Tests\Constraints; use PHPUnit\Framework\TestCase; use Symfony\Compo...
} public function testAttributes() { $metadata = new ClassMetadata(NotBlankDummy::class); $loader = new AttributeLoader(); self::assertTrue($loader->loadClassMetadata($metadata)); [$aConstraint] = $metadata->getP
taranto@gmail.com> */ class NotBlankTest extends TestCase { public function testNormalizerCanBeSet() { $notBlank = new NotBlank(normalizer: 'trim'); $this->assertEquals('trim', $notBlank->normalizer);
{ "filepath": "src/Symfony/Component/Validator/Tests/Constraints/NotBlankTest.php", "language": "php", "file_size": 1583, "cut_index": 537, "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\Validator\Tests\Constraints; use PHPUnit\Framework\TestCase; use Symfony\Component\Validator\Constraints...
rtFalse($constraint->skipOnError); } public function testAttributes() { $metadata = new ClassMetadata(NotCompromisedPasswordDummy::class); $loader = new AttributeLoader(); self::assertTrue($loader->loadClassMetadata($me
> */ class NotCompromisedPasswordTest extends TestCase { public function testDefaultValues() { $constraint = new NotCompromisedPassword(); $this->assertSame(1, $constraint->threshold); $this->asse
{ "filepath": "src/Symfony/Component/Validator/Tests/Constraints/NotCompromisedPasswordTest.php", "language": "php", "file_size": 2110, "cut_index": 563, "middle_length": 229 }
buted with this source code. */ namespace Symfony\Component\Validator\Tests\Constraints; use Symfony\Component\HttpClient\MockHttpClient; use Symfony\Component\HttpClient\Response\MockResponse; use Symfony\Component\Validator\Constraints\Luhn; use Symfony\Component\Validator\Constraints\NotCompromisedPassword; use S...
s@gmail.com> */ class NotCompromisedPasswordValidatorTest extends ConstraintValidatorTestCase { private const PASSWORD_TRIGGERING_AN_ERROR = 'apiError'; private const PASSWORD_TRIGGERING_AN_ERROR_RANGE_URL = 'https://api.pwnedpasswords.com/range/3
ception; use Symfony\Component\Validator\Test\ConstraintValidatorTestCase; use Symfony\Contracts\HttpClient\Exception\ExceptionInterface; use Symfony\Contracts\HttpClient\HttpClientInterface; /** * @author Kévin Dunglas <dungla
{ "filepath": "src/Symfony/Component/Validator/Tests/Constraints/NotCompromisedPasswordValidatorTest.php", "language": "php", "file_size": 7971, "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\Validator\Tests\Constraints; use PHPUnit\Framework\TestCase; use Symfony\Component\Validator\Constraints...
self::assertSame([1, 2, 3], $constraint->value); } public function testAttributes() { $metadata = new ClassMetadata(NotIdenticalToDummy::class); $loader = new AttributeLoader(); self::assertTrue($loader->loadClassMetada
function testArrayValueDoesNotTriggerDeprecation() { $constraint = new NotIdenticalTo(value: []); self::assertSame([], $constraint->value); $constraint = new NotIdenticalTo(value: [1, 2, 3]);
{ "filepath": "src/Symfony/Component/Validator/Tests/Constraints/NotIdenticalToTest.php", "language": "php", "file_size": 2095, "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\Validator\Tests\Constraints; use Symfony\Component\Validator\Constraint; use Symfony\Component\Validator...
t; use ThrowsOnInvalidStringDatesTestTrait; use ValidComparisonToValueTrait; protected function createValidator(): NotIdenticalToValidator { return new NotIdenticalToValidator(); } protected static function createConstrain
niel@danielholmes.org> */ class NotIdenticalToValidatorTest extends AbstractComparisonValidatorTestCase { use CompareWithNullValueAtPropertyAtTestTrait; use IcuCompatibilityTrait; use InvalidComparisonToValueTestTrai
{ "filepath": "src/Symfony/Component/Validator/Tests/Constraints/NotIdenticalToValidatorTest.php", "language": "php", "file_size": 2991, "cut_index": 563, "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\Validator\Tests\Constraints; use PHPUnit\Framework\TestCase; use ...
straint] = $metadata->getPropertyMetadata('b')[0]->getConstraints(); self::assertSame('myMessage', $bConstraint->message); self::assertSame(['Default', 'JsonDummy'], $bConstraint->groups); [$cConstraint] = $metadata->getPropertyMet
tCase { public function testAttributes() { $metadata = new ClassMetadata(JsonDummy::class); $loader = new AttributeLoader(); self::assertTrue($loader->loadClassMetadata($metadata)); [$bCon
{ "filepath": "src/Symfony/Component/Validator/Tests/Constraints/JsonTest.php", "language": "php", "file_size": 1365, "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\Validator\Tests\Constraints; use PHPUnit\Framework\TestCase; use Symfony\Component\Validator\Constraints\Length; use Symfony\Component\Validator\Exception\...
assertEquals('trim', $length->normalizer); } public function testDefaultCountUnitIsUsed() { $length = new Length(min: 0, max: 10); $this->assertSame(Length::COUNT_CODEPOINTS, $length->countUnit); } public function test
il.com> */ class LengthTest extends TestCase { public function testNormalizerCanBeSet() { $length = new Length( min: 0, max: 10, normalizer: 'trim', ); $this->
{ "filepath": "src/Symfony/Component/Validator/Tests/Constraints/LengthTest.php", "language": "php", "file_size": 3630, "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\Validator\Tests\Constraints; use PHPUnit\Framework\Attributes\DataProvider; use Symfony\Component\Valida...
rEqualValidator(); } protected static function createConstraint(?array $options = null): Constraint { return new NegativeOrZero($options); } public static function provideValidComparisons(): array { return [
sensiolabs.de> */ class LessThanOrEqualValidatorWithNegativeOrZeroConstraintTest extends AbstractComparisonValidatorTestCase { protected function createValidator(): LessThanOrEqualValidator { return new LessThanO
{ "filepath": "src/Symfony/Component/Validator/Tests/Constraints/LessThanOrEqualValidatorWithNegativeOrZeroConstraintTest.php", "language": "php", "file_size": 2724, "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\Validator\Tests\Constraints; use PHPUnit\Framework\TestCase; use Symfony\Compo...
] = $metadata->getPropertyMetadata('a')[0]->getConstraints(); self::assertTrue($aConstraint->canonicalize); [$bConstraint] = $metadata->getPropertyMetadata('b')[0]->getConstraints(); self::assertSame('myMessage', $bConstraint->mess
public function testAttributes() { $metadata = new ClassMetadata(LocaleDummy::class); $loader = new AttributeLoader(); self::assertTrue($loader->loadClassMetadata($metadata)); [$aConstraint
{ "filepath": "src/Symfony/Component/Validator/Tests/Constraints/LocaleTest.php", "language": "php", "file_size": 1595, "cut_index": 537, "middle_length": 229 }
y\Component\Validator\Constraints\MacAddressValidator; use Symfony\Component\Validator\Exception\ConstraintDefinitionException; use Symfony\Component\Validator\Exception\UnexpectedValueException; use Symfony\Component\Validator\Test\ConstraintValidatorTestCase; /** * @author Ninos Ego <me@ninosego.de> */ class MacAd...
is->assertNoViolation(); } public function testExpectsStringCompatibleType() { $this->expectException(UnexpectedValueException::class); $this->validate(new \stdClass(), new MacAddress()); } public function testInvalidV
n testNullIsValid() { $this->validate(null, new MacAddress()); $this->assertNoViolation(); } public function testEmptyStringIsValid() { $this->validate('', new MacAddress()); $th
{ "filepath": "src/Symfony/Component/Validator/Tests/Constraints/MacAddressValidatorTest.php", "language": "php", "file_size": 15636, "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\Validator\Tests\Constraints; use PHPUnit\Framework\TestCase; use ...
a($metadata)); [$aConstraint] = $metadata->getPropertyMetadata('a')[0]->getConstraints(); self::assertSame(0, $aConstraint->value); self::assertNull($aConstraint->propertyPath); self::assertSame(['Default', 'NegativeOrZeroD
ZeroTest extends TestCase { public function testAttributes() { $metadata = new ClassMetadata(NegativeOrZeroDummy::class); $loader = new AttributeLoader(); self::assertTrue($loader->loadClassMetadat
{ "filepath": "src/Symfony/Component/Validator/Tests/Constraints/NegativeOrZeroTest.php", "language": "php", "file_size": 1398, "cut_index": 524, "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\Validator\Tests\Constraints; use PHPUnit\Framework\TestCase; use Symfony\Compo...
$aConstraint] = $metadata->getPropertyMetadata('a')[0]->getConstraints(); self::assertSame(2, $aConstraint->value); self::assertNull($aConstraint->propertyPath); [$bConstraint] = $metadata->getPropertyMetadata('b')[0]->getConstrain
Case { public function testAttributes() { $metadata = new ClassMetadata(NotEqualToDummy::class); $loader = new AttributeLoader(); self::assertTrue($loader->loadClassMetadata($metadata)); [
{ "filepath": "src/Symfony/Component/Validator/Tests/Constraints/NotEqualToTest.php", "language": "php", "file_size": 1767, "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\Validator\Tests\Constraints; use PHPUnit\Framework\Attributes\Dat...
ction testValidValues($value) { $this->validate($value, new NotNull()); $this->assertNoViolation(); } public static function getValidValues() { return [ [0], [false], [true],
class NotNullValidatorTest extends ConstraintValidatorTestCase { protected function createValidator(): NotNullValidator { return new NotNullValidator(); } #[DataProvider('getValidValues')] public fun
{ "filepath": "src/Symfony/Component/Validator/Tests/Constraints/NotNullValidatorTest.php", "language": "php", "file_size": 1332, "cut_index": 524, "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\Validator\Tests\Constraints; use PHPUnit\Framework\TestCase; use Symfony\Compo...
traint] = $metadata->getPropertyMetadata('a')[0]->getConstraints(); self::assertFalse($aConstraint->alpha3); [$bConstraint] = $metadata->getPropertyMetadata('b')[0]->getConstraints(); self::assertSame('myMessage', $bConstraint->mes
{ public function testAttributes() { $metadata = new ClassMetadata(LanguageDummy::class); $loader = new AttributeLoader(); self::assertTrue($loader->loadClassMetadata($metadata)); [$aCons
{ "filepath": "src/Symfony/Component/Validator/Tests/Constraints/LanguageTest.php", "language": "php", "file_size": 1592, "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\Validator\Tests\Constraints; use Symfony\Component\Validator\Constraint; use Symfony\Component\Validator\Constraints\LessThan; use Symfony\Component\Valida...
onToValueTrait; protected function createValidator(): LessThanValidator { return new LessThanValidator(); } protected static function createConstraint(?array $options = null): Constraint { if (null !== $options) {
AbstractComparisonValidatorTestCase { use CompareWithNullValueAtPropertyAtTestTrait; use IcuCompatibilityTrait; use InvalidComparisonToValueTestTrait; use ThrowsOnInvalidStringDatesTestTrait; use ValidComparis
{ "filepath": "src/Symfony/Component/Validator/Tests/Constraints/LessThanValidatorTest.php", "language": "php", "file_size": 3490, "cut_index": 614, "middle_length": 229 }