Skip to content

Commit

Permalink
Fix composite validation test for Symfony < 5.1
Browse files Browse the repository at this point in the history
  • Loading branch information
mcg-web committed Mar 11, 2022
1 parent 9ad3dac commit 5e3d1d0
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 1 deletion.
37 changes: 37 additions & 0 deletions tests/Functional/App/Validator/AtLeastOneOf.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
<?php

declare(strict_types=1);

namespace Overblog\GraphQLBundle\Tests\Functional\App\Validator;

use Symfony\Component\Validator\AtLeastOneOf as BaseAtLeastOneOf;
use Symfony\Component\Validator\Constraint;

if (class_exists(BaseAtLeastOneOf::class)) {
class AtLeastOneOf extends BaseAtLeastOneOf
{
}
} else {
class AtLeastOneOf extends Constraint
{
public string $message = 'Mock constraint';

/**
* @var array
*/
public $constraints = [];

/**
* @var bool
*/
public $includeInternalMessages = true;

/**
* @return class-string
*/
public function validatedBy(): string
{
return MockValidator::class;
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ Period:
type: String!
validation:
- Date: ~
- AtLeastOneOf:
- Overblog\GraphQLBundle\Tests\Functional\App\Validator\AtLeastOneOf:
constraints:
- GreaterThanOrEqual: '-100 years'
message: "Year should be GreaterThanOrEqual -100."
Expand Down

0 comments on commit 5e3d1d0

Please sign in to comment.