Skip to content

Commit

Permalink
test: compatibility with Symfony 6.4 (#5706)
Browse files Browse the repository at this point in the history
* test: compatibility with Symfony 6.4

* fix deprec
  • Loading branch information
dunglas authored Jul 28, 2023
1 parent f0698a4 commit e692071
Show file tree
Hide file tree
Showing 18 changed files with 73 additions and 141 deletions.
1 change: 0 additions & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@
"behat/mink": "^1.9",
"doctrine/cache": "^1.11 || ^2.1",
"doctrine/common": "^3.2.2",
"doctrine/data-fixtures": "^1.2.2",
"doctrine/dbal": "^3.4.0",
"doctrine/doctrine-bundle": "^1.12 || ^2.0",
"doctrine/mongodb-odm": "^2.2",
Expand Down
3 changes: 1 addition & 2 deletions tests/Fixtures/DummyCompoundValidatedEntity.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,7 @@ class DummyCompoundValidatedEntity
{
/**
* @var string
*
* @DummyCompoundRequirements
*/
#[DummyCompoundRequirements]
public $dummy;
}
9 changes: 3 additions & 6 deletions tests/Fixtures/DummyCountValidatedEntity.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,22 +19,19 @@ class DummyCountValidatedEntity
{
/**
* @var array
*
* @Assert\Count(min=1)
*/
#[Assert\Count(min: 1)]
public $dummyMin;

/**
* @var array
*
* @Assert\Count(max=10)
*/
#[Assert\Count(max: 10)]
public $dummyMax;

/**
* @var array
*
* @Assert\Count(min=1, max=10)
*/
#[Assert\Count(min: 1, max: 10)]
public $dummyMinMax;
}
11 changes: 3 additions & 8 deletions tests/Fixtures/DummyIgnoreProperty.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,15 +20,10 @@ class DummyIgnoreProperty
{
public $visibleWithoutGroup;

/**
* @Groups({"dummy"})
*/
#[Groups('dummy')]
public $visibleWithGroup;

/**
* @Groups({"dummy"})
*
* @Ignore
*/
#[Groups('dummy')]
#[Ignore]
public $ignored;
}
56 changes: 14 additions & 42 deletions tests/Fixtures/DummyIriWithValidationEntity.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,73 +22,45 @@
*/
class DummyIriWithValidationEntity
{
/**
* @Assert\Url
*/
#[Assert\Url]
public $dummyUrl;

/**
* @Assert\Email
*/
#[Assert\Email]
public $dummyEmail;

/**
* @Assert\Uuid
*/
#[Assert\Uuid]
public $dummyUuid;

/**
* @Assert\CardScheme(schemes="MASTERCARD")
*/
#[Assert\CardScheme(schemes: 'MASTERCARD')]
public $dummyCardScheme;

/**
* @Assert\Bic
*/
#[Assert\Bic]
public $dummyBic;

/**
* @Assert\Iban
*/
#[Assert\Iban]
public $dummyIban;

/**
* @Assert\Date
*/
#[Assert\Date]
public $dummyDate;

/**
* @Assert\DateTime
*/
#[Assert\DateTime]
public $dummyDateTime;

/**
* @Assert\Time
*/
#[Assert\Time]
public $dummyTime;

/**
* @Assert\Image
*/
#[Assert\Image]
public $dummyImage;

/**
* @Assert\File
*/
#[Assert\File]
public $dummyFile;

/**
* @Assert\Currency
*/
#[Assert\Currency]
public $dummyCurrency;

/**
* @Assert\Isbn
*/
#[Assert\Isbn]
public $dummyIsbn;

/**
* @Assert\Issn
*/
#[Assert\Issn]
public $dummyIssn;
}
24 changes: 8 additions & 16 deletions tests/Fixtures/DummyNumericValidatedEntity.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,57 +19,49 @@ class DummyNumericValidatedEntity
{
/**
* @var int
*
* @Assert\GreaterThan(value=10)
*/
#[Assert\GreaterThan(value: 10)]
public $greaterThanMe;

/**
* @var float
*
* @Assert\GreaterThanOrEqual(value=10.99)
*/
#[Assert\GreaterThanOrEqual(value: '10.99')]
public $greaterThanOrEqualToMe;

/**
* @var int
*
* @Assert\LessThan(value=99)
*/
#[Assert\LessThan(value: 99)]
public $lessThanMe;

/**
* @var float
*
* @Assert\LessThanOrEqual(value=99.33)
*/
#[Assert\LessThanOrEqual(value: '99.33')]
public $lessThanOrEqualToMe;

/**
* @var int
*
* @Assert\Positive
*/
#[Assert\Positive]
public $positive;

/**
* @var int
*
* @Assert\PositiveOrZero
*/
#[Assert\PositiveOrZero]
public $positiveOrZero;

/**
* @var int
*
* @Assert\Negative
*/
#[Assert\Negative]
public $negative;

/**
* @var int
*
* @Assert\NegativeOrZero
*/
#[Assert\NegativeOrZero]
public $negativeOrZero;
}
18 changes: 6 additions & 12 deletions tests/Fixtures/DummyRangeValidatedEntity.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,43 +19,37 @@ class DummyRangeValidatedEntity
{
/**
* @var int
*
* @Assert\Range(min=1)
*/
#[Assert\Range(min: 1)]
public $dummyIntMin;

/**
* @var int
*
* @Assert\Range(max=10)
*/
#[Assert\Range(max: 10)]
public $dummyIntMax;

/**
* @var int
*
* @Assert\Range(min=1, max=10)
*/
#[Assert\Range(min: 1, max: 10)]
public $dummyIntMinMax;

/**
* @var float
*
* @Assert\Range(min=1.5)
*/
#[Assert\Range(min: '1.5')]
public $dummyFloatMin;

/**
* @var float
*
* @Assert\Range(max=10.5)
*/
#[Assert\Range(max: '10.5')]
public $dummyFloatMax;

/**
* @var float
*
* @Assert\Range(min=1.5, max=10.5)
*/
#[Assert\Range(min: '1.5', max: '10.5')]
public $dummyFloatMinMax;
}
3 changes: 1 addition & 2 deletions tests/Fixtures/DummyUniqueValidatedEntity.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,7 @@ class DummyUniqueValidatedEntity
{
/**
* @var string[]
*
* @Assert\Unique
*/
#[Assert\Unique]
public $dummyItems;
}
21 changes: 7 additions & 14 deletions tests/Fixtures/DummyValidatedChoiceEntity.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,51 +19,44 @@ class DummyValidatedChoiceEntity
{
/**
* @var string
*
* @Assert\Choice(choices={"a", "b"})
*/
#[Assert\Choice(choices: ['a', 'b'])]
public $dummySingleChoice;

/**
* @var string
*
* @Assert\Choice(callback={DummyValidatedChoiceEntity::class, "getChoices"})
*/
#[Assert\Choice(callback: [self::class, 'getChoices'])]
public $dummySingleChoiceCallback;

/**
* @var string[]
*
* @Assert\Choice(choices={"a", "b"}, multiple=true)
*/
#[Assert\Choice(choices: ['a', 'b'], multiple: true)]
public $dummyMultiChoice;

/**
* @var string[]
*
* @Assert\Choice(callback={DummyValidatedChoiceEntity::class, "getChoices"}, multiple=true)
*/
#[Assert\Choice(callback: [self::class, 'getChoices'], multiple: true)]
public $dummyMultiChoiceCallback;

/**
* @var string[]
*
* @Assert\Choice(choices={"a", "b", "c", "d"}, multiple=true, min=2)
*/
#[Assert\Choice(choices: ['a', 'b', 'c', 'd'], multiple: true, min: 2)]
public $dummyMultiChoiceMin;

/**
* @var string[]
*
* @Assert\Choice(choices={"a", "b", "c", "d"}, multiple=true, max=4)
*/
#[Assert\Choice(choices: ['a', 'b', 'c', 'd'], multiple: true, max: 4)]
public $dummyMultiChoiceMax;

/**
* @var string[]
*
* @Assert\Choice(choices={"a", "b", "c", "d"}, multiple=true, min=2, max=4)
*/
#[Assert\Choice(choices: ['a', 'b', 'c', 'd'], multiple: true, min: 2, max: 4)]
public $dummyMultiChoiceMinMax;

public static function getChoices(): array
Expand Down
3 changes: 1 addition & 2 deletions tests/Fixtures/DummyValidatedHostnameEntity.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,7 @@ class DummyValidatedHostnameEntity
{
/**
* @var string
*
* @Assert\Hostname
*/
#[Assert\Hostname]
public $dummyHostname;
}
3 changes: 1 addition & 2 deletions tests/Fixtures/DummyValidatedUlidEntity.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,7 @@ class DummyValidatedUlidEntity
{
/**
* @var string
*
* @Assert\Ulid
*/
#[Assert\Ulid]
public $dummyUlid;
}
8 changes: 2 additions & 6 deletions tests/Fixtures/NotAResource.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,9 @@
class NotAResource
{
public function __construct(
/**
* @Groups("contain_non_resource")
*/
#[Groups('contain_non_resource')]
private $foo,
/**
* @Groups("contain_non_resource")
*/
#[Groups('contain_non_resource')]
private $bar
) {
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,8 @@ class CustomController extends AbstractController
{
/**
* Custom route for a non API Platform route.
*
* @Route(methods={"GET"}, name="custom_external_route", path="/common/custom/object")
*/
#[Route(methods: ['GET'], name: 'custom_external_route', path: '/common/custom/object')]
public function __invoke(): CustomObject
{
return new CustomObject(1, 'Lorem ipsum dolor sit amet');
Expand Down
Loading

0 comments on commit e692071

Please sign in to comment.