From 68201f5acc84100d7f75c828b69d0f23993b4ac3 Mon Sep 17 00:00:00 2001 From: Yoanm <4410697+yoanm@users.noreply.github.com> Date: Wed, 3 Sep 2025 18:59:32 +0200 Subject: [PATCH 1/2] Increase CI supported versions --- .github/workflows/reusable-CI-workflow.yml | 8 ++++---- .github/workflows/supported-versions.json | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/.github/workflows/reusable-CI-workflow.yml b/.github/workflows/reusable-CI-workflow.yml index 5d25a6a..de3ef56 100644 --- a/.github/workflows/reusable-CI-workflow.yml +++ b/.github/workflows/reusable-CI-workflow.yml @@ -76,8 +76,8 @@ jobs: php-version: ${{ ( needs.fetch-supported-versions.outputs.php-min == '8.0' ) && '8.1' || needs.fetch-supported-versions.outputs.php-min }} symfony-version: '6.4' - job-name: Late PHP migration # => Highest symfony version with lowest php version allowed by composer config - # Fix - Sf 7.0 require php 8.1 minimum, most of deps require 8.2 ! - php-version: ${{ ( needs.fetch-supported-versions.outputs.symfony-max == '7.0' && needs.fetch-supported-versions.outputs.php-min == '8.0' ) && '8.2' || needs.fetch-supported-versions.outputs.php-min }} + # Fix - Sf 7.3 require php 8.2 ! + php-version: ${{ ( needs.fetch-supported-versions.outputs.symfony-max == '7.3' && needs.fetch-supported-versions.outputs.php-min == '8.0' ) && '8.2' || needs.fetch-supported-versions.outputs.php-min }} symfony-version: '${{ needs.fetch-supported-versions.outputs.symfony-max }}' - job-name: Late Symfony migration # => Lowest symfony version with highest php version allowed by composer config php-version: '${{ needs.fetch-supported-versions.outputs.php-max }}' @@ -250,8 +250,8 @@ jobs: # Fix - behat/gherkin => Avoid issue with behat <-> gherkin packages (See https://github.com/Behat/Gherkin/issues/317) pkg-extra-constraints: behat/gherkin:~4.12.0 - job-name: Symfony with lowest supported PHP version - # Fix - symfony/validator 7.1 require php 8.2 minimum ! - php-version: ${{ ( needs.fetch-supported-versions.outputs.symfony-next == '7.1' && needs.fetch-supported-versions.outputs.php-min == '8.0' ) && '8.2' || needs.fetch-supported-versions.outputs.php-min }} + # Fix - symfony/validator 7.4 require php 8.2 minimum ! + php-version: ${{ ( needs.fetch-supported-versions.outputs.symfony-next == '7.4' && needs.fetch-supported-versions.outputs.php-min == '8.0' ) && '8.2' || needs.fetch-supported-versions.outputs.php-min }} symfony-version: ${{ needs.fetch-supported-versions.outputs.symfony-next }} # Fix - behat/gherkin => Avoid issue with behat <-> gherkin packages (See https://github.com/Behat/Gherkin/issues/317) pkg-extra-constraints: behat/gherkin:~4.12.0 diff --git a/.github/workflows/supported-versions.json b/.github/workflows/supported-versions.json index fefdd3a..9615147 100644 --- a/.github/workflows/supported-versions.json +++ b/.github/workflows/supported-versions.json @@ -1,4 +1,4 @@ { "php": {"min": "8.0", "max": "8.4", "next": "8.5"}, - "symfony": {"min": "5.4", "max": "7.0", "next": "7.1"} + "symfony": {"min": "5.4", "max": "7.3", "next": "7.4"} } From 2b5aab6c1fd21a8e9567c71d0ba736710dfa10e5 Mon Sep 17 00:00:00 2001 From: Yoanm <4410697+yoanm@users.noreply.github.com> Date: Wed, 3 Sep 2025 19:21:14 +0200 Subject: [PATCH 2/2] Fix constraints creation for tests --- .../equalTo-constraints.feature | 22 +++-- .../greaterThan-constraints.feature | 66 +++++++++----- ...rThan-constraints_fully-configured.feature | 88 +++++++++++------- ...calTo-constraints_fully-configured.feature | 55 +++++++---- .../lessThan-constraints.feature | 66 +++++++++----- ...sThan-constraints_fully-configured.feature | 91 ++++++++++++------- .../dateTime-constraint.feature | 11 ++- .../callback-constraint.feature | 9 +- .../Helper/MinMaxHelper/CollectionTest.php | 44 +++++---- .../Functional/App/Helper/TypeGuesserTest.php | 6 +- 10 files changed, 287 insertions(+), 171 deletions(-) diff --git a/features/03_comparaison-constraints/equalTo-constraints.feature b/features/03_comparaison-constraints/equalTo-constraints.feature index 2257df1..2eea0e8 100644 --- a/features/03_comparaison-constraints/equalTo-constraints.feature +++ b/features/03_comparaison-constraints/equalTo-constraints.feature @@ -42,9 +42,12 @@ Feature: ConstraintToParamsDocTransformer - EqualTo & NotEqualTo constraint Given I have the following Constraint: """ use Symfony\Component\Validator\Constraints as ConstraintNS; - return new ConstraintNS\EqualTo([ - 'value' => 'expected-text', - 'payload' => [ + return new ConstraintNS\EqualTo( + 'expected-text', + null, + null, + null, + [ 'documentation' => [ 'description' => 'description', 'default' => 'default', @@ -53,7 +56,7 @@ Feature: ConstraintToParamsDocTransformer - EqualTo & NotEqualTo constraint 'nullable' => false ] ] - ]); + ); """ When I transform constraint Then I should have a constraint doc of class "Yoanm\JsonRpcServerDoc\Domain\Model\Type\TypeDoc" @@ -73,9 +76,12 @@ Feature: ConstraintToParamsDocTransformer - EqualTo & NotEqualTo constraint Given I have the following Constraint: """ use Symfony\Component\Validator\Constraints as ConstraintNS; - return new ConstraintNS\NotEqualTo([ - 'value' => 'expected-text', - 'payload' => [ + return new ConstraintNS\NotEqualTo( + 'expected-text', + null, + null, + null, + [ 'documentation' => [ 'description' => 'description', 'default' => 'default', @@ -84,7 +90,7 @@ Feature: ConstraintToParamsDocTransformer - EqualTo & NotEqualTo constraint 'nullable' => false ] ] - ]); + ); """ When I transform constraint Then I should have a constraint doc of class "Yoanm\JsonRpcServerDoc\Domain\Model\Type\TypeDoc" diff --git a/features/03_comparaison-constraints/greaterThan-constraints.feature b/features/03_comparaison-constraints/greaterThan-constraints.feature index d3365a1..bfda534 100644 --- a/features/03_comparaison-constraints/greaterThan-constraints.feature +++ b/features/03_comparaison-constraints/greaterThan-constraints.feature @@ -21,14 +21,17 @@ Feature: ConstraintToParamsDocTransformer - GreaterThan & GreaterThanOrEqual con Given I have the following Constraint: """ use Symfony\Component\Validator\Constraints as ConstraintNS; - return new ConstraintNS\GreaterThan([ - 'value' => 2, - 'payload' => [ + return new ConstraintNS\GreaterThan( + 2, + null, + null, + null, + [ 'documentation' => [ 'type' => 'integer' ] ] - ]); + ); """ When I transform constraint Then I should have a constraint doc of class "Yoanm\JsonRpcServerDoc\Domain\Model\Type\IntegerDoc" @@ -49,14 +52,17 @@ Feature: ConstraintToParamsDocTransformer - GreaterThan & GreaterThanOrEqual con Given I have the following Constraint: """ use Symfony\Component\Validator\Constraints as ConstraintNS; - return new ConstraintNS\GreaterThan([ - 'value' => 2.4, - 'payload' => [ + return new ConstraintNS\GreaterThan( + 2.4, + null, + null, + null, + [ 'documentation' => [ 'type' => 'float' ] ] - ]); + ); """ When I transform constraint Then I should have a constraint doc of class "Yoanm\JsonRpcServerDoc\Domain\Model\Type\FloatDoc" @@ -77,14 +83,17 @@ Feature: ConstraintToParamsDocTransformer - GreaterThan & GreaterThanOrEqual con Given I have the following Constraint: """ use Symfony\Component\Validator\Constraints as ConstraintNS; - return new ConstraintNS\GreaterThan([ - 'value' => 2, - 'payload' => [ + return new ConstraintNS\GreaterThan( + 2, + null, + null, + null, + [ 'documentation' => [ 'type' => 'array' ] ] - ]); + ); """ When I transform constraint Then I should have a constraint doc of class "Yoanm\JsonRpcServerDoc\Domain\Model\Type\ArrayDoc" @@ -123,14 +132,17 @@ Feature: ConstraintToParamsDocTransformer - GreaterThan & GreaterThanOrEqual con Given I have the following Constraint: """ use Symfony\Component\Validator\Constraints as ConstraintNS; - return new ConstraintNS\GreaterThanOrEqual([ - 'value' => 2, - 'payload' => [ + return new ConstraintNS\GreaterThanOrEqual( + 2, + null, + null, + null, + [ 'documentation' => [ 'type' => 'integer' ] ] - ]); + ); """ When I transform constraint Then I should have a constraint doc of class "Yoanm\JsonRpcServerDoc\Domain\Model\Type\IntegerDoc" @@ -151,14 +163,17 @@ Feature: ConstraintToParamsDocTransformer - GreaterThan & GreaterThanOrEqual con Given I have the following Constraint: """ use Symfony\Component\Validator\Constraints as ConstraintNS; - return new ConstraintNS\GreaterThanOrEqual([ - 'value' => 2.4, - 'payload' => [ + return new ConstraintNS\GreaterThanOrEqual( + 2.4, + null, + null, + null, + [ 'documentation' => [ 'type' => 'float' ] ] - ]); + ); """ When I transform constraint Then I should have a constraint doc of class "Yoanm\JsonRpcServerDoc\Domain\Model\Type\FloatDoc" @@ -179,14 +194,17 @@ Feature: ConstraintToParamsDocTransformer - GreaterThan & GreaterThanOrEqual con Given I have the following Constraint: """ use Symfony\Component\Validator\Constraints as ConstraintNS; - return new ConstraintNS\GreaterThanOrEqual([ - 'value' => 2, - 'payload' => [ + return new ConstraintNS\GreaterThanOrEqual( + 2, + null, + null, + null, + [ 'documentation' => [ 'type' => 'array' ] ] - ]); + ); """ When I transform constraint Then I should have a constraint doc of class "Yoanm\JsonRpcServerDoc\Domain\Model\Type\ArrayDoc" diff --git a/features/03_comparaison-constraints/greaterThan-constraints_fully-configured.feature b/features/03_comparaison-constraints/greaterThan-constraints_fully-configured.feature index be49564..fef998a 100644 --- a/features/03_comparaison-constraints/greaterThan-constraints_fully-configured.feature +++ b/features/03_comparaison-constraints/greaterThan-constraints_fully-configured.feature @@ -4,9 +4,12 @@ Feature: ConstraintToParamsDocTransformer - Fully configured GreaterThan & Great Given I have the following Constraint: """ use Symfony\Component\Validator\Constraints as ConstraintNS; - return new ConstraintNS\GreaterThan([ - 'value' => 2, - 'payload' => [ + return new ConstraintNS\GreaterThan( + 2, + null, + null, + null, + [ 'documentation' => [ 'description' => 'description', 'default' => 'default', @@ -15,7 +18,7 @@ Feature: ConstraintToParamsDocTransformer - Fully configured GreaterThan & Great 'nullable' => false ] ] - ]); + ); """ When I transform constraint Then I should have a constraint doc of class "Yoanm\JsonRpcServerDoc\Domain\Model\Type\TypeDoc" @@ -31,9 +34,12 @@ Feature: ConstraintToParamsDocTransformer - Fully configured GreaterThan & Great Given I have the following Constraint: """ use Symfony\Component\Validator\Constraints as ConstraintNS; - return new ConstraintNS\GreaterThan([ - 'value' => 2, - 'payload' => [ + return new ConstraintNS\GreaterThan( + 2, + null, + null, + null, + [ 'documentation' => [ 'type' => 'integer', 'description' => 'description', @@ -43,7 +49,7 @@ Feature: ConstraintToParamsDocTransformer - Fully configured GreaterThan & Great 'nullable' => false ] ] - ]); + ); """ When I transform constraint Then I should have a constraint doc of class "Yoanm\JsonRpcServerDoc\Domain\Model\Type\IntegerDoc" @@ -63,9 +69,12 @@ Feature: ConstraintToParamsDocTransformer - Fully configured GreaterThan & Great Given I have the following Constraint: """ use Symfony\Component\Validator\Constraints as ConstraintNS; - return new ConstraintNS\GreaterThan([ - 'value' => 2.4, - 'payload' => [ + return new ConstraintNS\GreaterThan( + 2.4, + null, + null, + null, + [ 'documentation' => [ 'type' => 'float', 'description' => 'description', @@ -75,7 +84,7 @@ Feature: ConstraintToParamsDocTransformer - Fully configured GreaterThan & Great 'nullable' => false ] ] - ]); + ); """ When I transform constraint Then I should have a constraint doc of class "Yoanm\JsonRpcServerDoc\Domain\Model\Type\FloatDoc" @@ -95,9 +104,12 @@ Feature: ConstraintToParamsDocTransformer - Fully configured GreaterThan & Great Given I have the following Constraint: """ use Symfony\Component\Validator\Constraints as ConstraintNS; - return new ConstraintNS\GreaterThan([ - 'value' => 2, - 'payload' => [ + return new ConstraintNS\GreaterThan( + 2, + null, + null, + null, + [ 'documentation' => [ 'type' => 'array', 'description' => 'description', @@ -107,7 +119,7 @@ Feature: ConstraintToParamsDocTransformer - Fully configured GreaterThan & Great 'nullable' => false ] ] - ]); + ); """ When I transform constraint Then I should have a constraint doc of class "Yoanm\JsonRpcServerDoc\Domain\Model\Type\ArrayDoc" @@ -128,9 +140,12 @@ Feature: ConstraintToParamsDocTransformer - Fully configured GreaterThan & Great Given I have the following Constraint: """ use Symfony\Component\Validator\Constraints as ConstraintNS; - return new ConstraintNS\GreaterThanOrEqual([ - 'value' => 2, - 'payload' => [ + return new ConstraintNS\GreaterThanOrEqual( + 2, + null, + null, + null, + [ 'documentation' => [ 'description' => 'description', 'default' => 'default', @@ -139,7 +154,7 @@ Feature: ConstraintToParamsDocTransformer - Fully configured GreaterThan & Great 'nullable' => false ] ] - ]); + ); """ When I transform constraint Then I should have a constraint doc of class "Yoanm\JsonRpcServerDoc\Domain\Model\Type\TypeDoc" @@ -155,9 +170,12 @@ Feature: ConstraintToParamsDocTransformer - Fully configured GreaterThan & Great Given I have the following Constraint: """ use Symfony\Component\Validator\Constraints as ConstraintNS; - return new ConstraintNS\GreaterThanOrEqual([ - 'value' => 2, - 'payload' => [ + return new ConstraintNS\GreaterThanOrEqual( + 2, + null, + null, + null, + [ 'documentation' => [ 'type' => 'integer', 'description' => 'description', @@ -167,7 +185,7 @@ Feature: ConstraintToParamsDocTransformer - Fully configured GreaterThan & Great 'nullable' => false ] ] - ]); + ); """ When I transform constraint Then I should have a constraint doc of class "Yoanm\JsonRpcServerDoc\Domain\Model\Type\IntegerDoc" @@ -187,9 +205,12 @@ Feature: ConstraintToParamsDocTransformer - Fully configured GreaterThan & Great Given I have the following Constraint: """ use Symfony\Component\Validator\Constraints as ConstraintNS; - return new ConstraintNS\GreaterThanOrEqual([ - 'value' => 2.4, - 'payload' => [ + return new ConstraintNS\GreaterThanOrEqual( + 2.4, + null, + null, + null, + [ 'documentation' => [ 'type' => 'float', 'description' => 'description', @@ -199,7 +220,7 @@ Feature: ConstraintToParamsDocTransformer - Fully configured GreaterThan & Great 'nullable' => false ] ] - ]); + ); """ When I transform constraint Then I should have a constraint doc of class "Yoanm\JsonRpcServerDoc\Domain\Model\Type\FloatDoc" @@ -219,9 +240,12 @@ Feature: ConstraintToParamsDocTransformer - Fully configured GreaterThan & Great Given I have the following Constraint: """ use Symfony\Component\Validator\Constraints as ConstraintNS; - return new ConstraintNS\GreaterThanOrEqual([ - 'value' => 2, - 'payload' => [ + return new ConstraintNS\GreaterThanOrEqual( + 2, + null, + null, + null, + [ 'documentation' => [ 'type' => 'array', 'description' => 'description', @@ -231,7 +255,7 @@ Feature: ConstraintToParamsDocTransformer - Fully configured GreaterThan & Great 'nullable' => false ] ] - ]); + ); """ When I transform constraint Then I should have a constraint doc of class "Yoanm\JsonRpcServerDoc\Domain\Model\Type\ArrayDoc" diff --git a/features/03_comparaison-constraints/identicalTo-constraints_fully-configured.feature b/features/03_comparaison-constraints/identicalTo-constraints_fully-configured.feature index 1cf20b5..45ff991 100644 --- a/features/03_comparaison-constraints/identicalTo-constraints_fully-configured.feature +++ b/features/03_comparaison-constraints/identicalTo-constraints_fully-configured.feature @@ -4,16 +4,19 @@ Feature: ConstraintToParamsDocTransformer - Fully configured IdenticalTo & NotId Given I have the following Constraint: """ use Symfony\Component\Validator\Constraints as ConstraintNS; - return new ConstraintNS\IdenticalTo([ - 'value' => 'expected-text', - 'payload' => [ + return new ConstraintNS\IdenticalTo( + 'expected-text', + null, + null, + null, + [ 'documentation' => [ 'description' => 'description', 'required' => true, 'nullable' => false ] ] - ]); + ); """ When I transform constraint Then I should have a constraint doc of class "Yoanm\JsonRpcServerDoc\Domain\Model\Type\StringDoc" @@ -36,16 +39,19 @@ Feature: ConstraintToParamsDocTransformer - Fully configured IdenticalTo & NotId Given I have the following Constraint: """ use Symfony\Component\Validator\Constraints as ConstraintNS; - return new ConstraintNS\IdenticalTo([ - 'value' => true, - 'payload' => [ + return new ConstraintNS\IdenticalTo( + true, + null, + null, + null, + [ 'documentation' => [ 'description' => 'description', 'required' => true, 'nullable' => false ] ] - ]); + ); """ When I transform constraint Then I should have a constraint doc of class "Yoanm\JsonRpcServerDoc\Domain\Model\Type\BooleanDoc" @@ -65,16 +71,19 @@ Feature: ConstraintToParamsDocTransformer - Fully configured IdenticalTo & NotId Given I have the following Constraint: """ use Symfony\Component\Validator\Constraints as ConstraintNS; - return new ConstraintNS\IdenticalTo([ - 'value' => 2, - 'payload' => [ + return new ConstraintNS\IdenticalTo( + 2, + null, + null, + null, + [ 'documentation' => [ 'description' => 'description', 'required' => true, 'nullable' => false ] ] - ]); + ); """ When I transform constraint Then I should have a constraint doc of class "Yoanm\JsonRpcServerDoc\Domain\Model\Type\IntegerDoc" @@ -98,16 +107,19 @@ Feature: ConstraintToParamsDocTransformer - Fully configured IdenticalTo & NotId Given I have the following Constraint: """ use Symfony\Component\Validator\Constraints as ConstraintNS; - return new ConstraintNS\IdenticalTo([ - 'value' => 2.3, - 'payload' => [ + return new ConstraintNS\IdenticalTo( + 2.3, + null, + null, + null, + [ 'documentation' => [ 'description' => 'description', 'required' => true, 'nullable' => false ] ] - ]); + ); """ When I transform constraint Then I should have a constraint doc of class "Yoanm\JsonRpcServerDoc\Domain\Model\Type\FloatDoc" @@ -131,9 +143,12 @@ Feature: ConstraintToParamsDocTransformer - Fully configured IdenticalTo & NotId Given I have the following Constraint: """ use Symfony\Component\Validator\Constraints as ConstraintNS; - return new ConstraintNS\NotIdenticalTo([ - 'value' => 'not-expected-value', - 'payload' => [ + return new ConstraintNS\NotIdenticalTo( + 'not-expected-value', + null, + null, + null, + [ 'documentation' => [ 'description' => 'description', 'default' => 'default', @@ -142,7 +157,7 @@ Feature: ConstraintToParamsDocTransformer - Fully configured IdenticalTo & NotId 'nullable' => false ] ] - ]); + ); """ When I transform constraint Then I should have a constraint doc of class "Yoanm\JsonRpcServerDoc\Domain\Model\Type\TypeDoc" diff --git a/features/03_comparaison-constraints/lessThan-constraints.feature b/features/03_comparaison-constraints/lessThan-constraints.feature index 25fd1a9..32ba7fb 100644 --- a/features/03_comparaison-constraints/lessThan-constraints.feature +++ b/features/03_comparaison-constraints/lessThan-constraints.feature @@ -21,14 +21,17 @@ Feature: ConstraintToParamsDocTransformer - LessThan & LessThanOrEqual constrain Given I have the following Constraint: """ use Symfony\Component\Validator\Constraints as ConstraintNS; - return new ConstraintNS\LessThan([ - 'value' => 2, - 'payload' => [ + return new ConstraintNS\LessThan( + 2, + null, + null, + null, + [ 'documentation' => [ 'type' => 'integer' ] ] - ]); + ); """ When I transform constraint Then I should have a constraint doc of class "Yoanm\JsonRpcServerDoc\Domain\Model\Type\IntegerDoc" @@ -49,14 +52,17 @@ Feature: ConstraintToParamsDocTransformer - LessThan & LessThanOrEqual constrain Given I have the following Constraint: """ use Symfony\Component\Validator\Constraints as ConstraintNS; - return new ConstraintNS\LessThan([ - 'value' => 2.4, - 'payload' => [ + return new ConstraintNS\LessThan( + 2.4, + null, + null, + null, + [ 'documentation' => [ 'type' => 'float' ] ] - ]); + ); """ When I transform constraint Then I should have a constraint doc of class "Yoanm\JsonRpcServerDoc\Domain\Model\Type\FloatDoc" @@ -77,14 +83,17 @@ Feature: ConstraintToParamsDocTransformer - LessThan & LessThanOrEqual constrain Given I have the following Constraint: """ use Symfony\Component\Validator\Constraints as ConstraintNS; - return new ConstraintNS\LessThan([ - 'value' => 4, - 'payload' => [ + return new ConstraintNS\LessThan( + 4, + null, + null, + null, + [ 'documentation' => [ 'type' => 'array' ] ] - ]); + ); """ When I transform constraint Then I should have a constraint doc of class "Yoanm\JsonRpcServerDoc\Domain\Model\Type\ArrayDoc" @@ -123,14 +132,17 @@ Feature: ConstraintToParamsDocTransformer - LessThan & LessThanOrEqual constrain Given I have the following Constraint: """ use Symfony\Component\Validator\Constraints as ConstraintNS; - return new ConstraintNS\LessThanOrEqual([ - 'value' => 2, - 'payload' => [ + return new ConstraintNS\LessThanOrEqual( + 2, + null, + null, + null, + [ 'documentation' => [ 'type' => 'integer' ] ] - ]); + ); """ When I transform constraint Then I should have a constraint doc of class "Yoanm\JsonRpcServerDoc\Domain\Model\Type\IntegerDoc" @@ -151,14 +163,17 @@ Feature: ConstraintToParamsDocTransformer - LessThan & LessThanOrEqual constrain Given I have the following Constraint: """ use Symfony\Component\Validator\Constraints as ConstraintNS; - return new ConstraintNS\LessThanOrEqual([ - 'value' => 2.4, - 'payload' => [ + return new ConstraintNS\LessThanOrEqual( + 2.4, + null, + null, + null, + [ 'documentation' => [ 'type' => 'float' ] ] - ]); + ); """ When I transform constraint Then I should have a constraint doc of class "Yoanm\JsonRpcServerDoc\Domain\Model\Type\FloatDoc" @@ -179,14 +194,17 @@ Feature: ConstraintToParamsDocTransformer - LessThan & LessThanOrEqual constrain Given I have the following Constraint: """ use Symfony\Component\Validator\Constraints as ConstraintNS; - return new ConstraintNS\LessThanOrEqual([ - 'value' => 4, - 'payload' => [ + return new ConstraintNS\LessThanOrEqual( + 4, + null, + null, + null, + [ 'documentation' => [ 'type' => 'array' ] ] - ]); + ); """ When I transform constraint Then I should have a constraint doc of class "Yoanm\JsonRpcServerDoc\Domain\Model\Type\ArrayDoc" diff --git a/features/03_comparaison-constraints/lessThan-constraints_fully-configured.feature b/features/03_comparaison-constraints/lessThan-constraints_fully-configured.feature index 71f7939..8c73978 100644 --- a/features/03_comparaison-constraints/lessThan-constraints_fully-configured.feature +++ b/features/03_comparaison-constraints/lessThan-constraints_fully-configured.feature @@ -4,9 +4,12 @@ Feature: ConstraintToParamsDocTransformer - Fully configured LessThan & LessThan Given I have the following Constraint: """ use Symfony\Component\Validator\Constraints as ConstraintNS; - return new ConstraintNS\LessThan([ - 'value' => 2, - 'payload' => [ + return new ConstraintNS\LessThan( + 2, + null, + null, + null, + [ 'documentation' => [ 'description' => 'description', 'default' => 'default', @@ -15,7 +18,7 @@ Feature: ConstraintToParamsDocTransformer - Fully configured LessThan & LessThan 'nullable' => false ] ] - ]); + ); """ When I transform constraint Then I should have a constraint doc of class "Yoanm\JsonRpcServerDoc\Domain\Model\Type\TypeDoc" @@ -32,9 +35,12 @@ Feature: ConstraintToParamsDocTransformer - Fully configured LessThan & LessThan Given I have the following Constraint: """ use Symfony\Component\Validator\Constraints as ConstraintNS; - return new ConstraintNS\LessThan([ - 'value' => 2, - 'payload' => [ + return new ConstraintNS\LessThan( + 2, + null, + null, + null, + [ 'documentation' => [ 'type' => 'integer', 'description' => 'description', @@ -44,7 +50,7 @@ Feature: ConstraintToParamsDocTransformer - Fully configured LessThan & LessThan 'nullable' => false ] ] - ]); + ); """ When I transform constraint Then I should have a constraint doc of class "Yoanm\JsonRpcServerDoc\Domain\Model\Type\IntegerDoc" @@ -65,9 +71,12 @@ Feature: ConstraintToParamsDocTransformer - Fully configured LessThan & LessThan Given I have the following Constraint: """ use Symfony\Component\Validator\Constraints as ConstraintNS; - return new ConstraintNS\LessThan([ - 'value' => 2.4, - 'payload' => [ + return new ConstraintNS\LessThan( + 2.4, + null, + null, + null, + [ 'documentation' => [ 'type' => 'float', 'description' => 'description', @@ -77,7 +86,7 @@ Feature: ConstraintToParamsDocTransformer - Fully configured LessThan & LessThan 'nullable' => false ] ] - ]); + ); """ When I transform constraint Then I should have a constraint doc of class "Yoanm\JsonRpcServerDoc\Domain\Model\Type\FloatDoc" @@ -98,9 +107,12 @@ Feature: ConstraintToParamsDocTransformer - Fully configured LessThan & LessThan Given I have the following Constraint: """ use Symfony\Component\Validator\Constraints as ConstraintNS; - return new ConstraintNS\LessThan([ - 'value' => 4, - 'payload' => [ + return new ConstraintNS\LessThan( + 4, + null, + null, + null, + [ 'documentation' => [ 'type' => 'array', 'description' => 'description', @@ -110,7 +122,7 @@ Feature: ConstraintToParamsDocTransformer - Fully configured LessThan & LessThan 'nullable' => false ] ] - ]); + ); """ When I transform constraint Then I should have a constraint doc of class "Yoanm\JsonRpcServerDoc\Domain\Model\Type\ArrayDoc" @@ -132,9 +144,12 @@ Feature: ConstraintToParamsDocTransformer - Fully configured LessThan & LessThan Given I have the following Constraint: """ use Symfony\Component\Validator\Constraints as ConstraintNS; - return new ConstraintNS\LessThanOrEqual([ - 'value' => 2, - 'payload' => [ + return new ConstraintNS\LessThanOrEqual( + 2, + null, + null, + null, + [ 'documentation' => [ 'description' => 'description', 'default' => 'default', @@ -143,7 +158,7 @@ Feature: ConstraintToParamsDocTransformer - Fully configured LessThan & LessThan 'nullable' => false ] ] - ]); + ); """ When I transform constraint Then I should have a constraint doc of class "Yoanm\JsonRpcServerDoc\Domain\Model\Type\TypeDoc" @@ -161,12 +176,14 @@ Feature: ConstraintToParamsDocTransformer - Fully configured LessThan & LessThan Given I have the following Constraint: """ use Symfony\Component\Validator\Constraints as ConstraintNS; - return new ConstraintNS\LessThanOrEqual([ - 'value' => 2, - 'payload' => [ + return new ConstraintNS\LessThanOrEqual( + 2, + null, + null, + null, + [ 'documentation' => [ 'type' => 'integer', - 'description' => 'description', 'default' => 'default', 'example' => 'example', @@ -174,7 +191,7 @@ Feature: ConstraintToParamsDocTransformer - Fully configured LessThan & LessThan 'nullable' => false ] ] - ]); + ); """ When I transform constraint Then I should have a constraint doc of class "Yoanm\JsonRpcServerDoc\Domain\Model\Type\IntegerDoc" @@ -195,12 +212,14 @@ Feature: ConstraintToParamsDocTransformer - Fully configured LessThan & LessThan Given I have the following Constraint: """ use Symfony\Component\Validator\Constraints as ConstraintNS; - return new ConstraintNS\LessThanOrEqual([ - 'value' => 2.4, - 'payload' => [ + return new ConstraintNS\LessThanOrEqual( + 2.4, + null, + null, + null, + [ 'documentation' => [ 'type' => 'float', - 'description' => 'description', 'default' => 'default', 'example' => 'example', @@ -208,7 +227,7 @@ Feature: ConstraintToParamsDocTransformer - Fully configured LessThan & LessThan 'nullable' => false ] ] - ]); + ); """ When I transform constraint Then I should have a constraint doc of class "Yoanm\JsonRpcServerDoc\Domain\Model\Type\FloatDoc" @@ -229,12 +248,14 @@ Feature: ConstraintToParamsDocTransformer - Fully configured LessThan & LessThan Given I have the following Constraint: """ use Symfony\Component\Validator\Constraints as ConstraintNS; - return new ConstraintNS\LessThanOrEqual([ - 'value' => 4, - 'payload' => [ + return new ConstraintNS\LessThanOrEqual( + 4, + null, + null, + null, + [ 'documentation' => [ 'type' => 'array', - 'description' => 'description', 'default' => 'default', 'example' => 'example', @@ -242,7 +263,7 @@ Feature: ConstraintToParamsDocTransformer - Fully configured LessThan & LessThan 'nullable' => false ] ] - ]); + ); """ When I transform constraint Then I should have a constraint doc of class "Yoanm\JsonRpcServerDoc\Domain\Model\Type\ArrayDoc" diff --git a/features/04_date-constraints/dateTime-constraint.feature b/features/04_date-constraints/dateTime-constraint.feature index 1317cc7..ecb1cbb 100644 --- a/features/04_date-constraints/dateTime-constraint.feature +++ b/features/04_date-constraints/dateTime-constraint.feature @@ -25,9 +25,11 @@ Feature: ConstraintToParamsDocTransformer - DateTime constraint Given I have the following Constraint: """ use Symfony\Component\Validator\Constraints as ConstraintNS; - return new ConstraintNS\DateTime([ - 'format' => 'Y-m-d -- H:i:s', - 'payload' => [ + return new ConstraintNS\DateTime( + 'Y-m-d -- H:i:s', + null, + null, + [ 'documentation' => [ 'description' => 'description', 'default' => 'default', @@ -36,7 +38,7 @@ Feature: ConstraintToParamsDocTransformer - DateTime constraint 'nullable' => false ] ] - ]); + ); """ When I transform constraint Then I should have a constraint doc of class "Yoanm\JsonRpcServerDoc\Domain\Model\Type\StringDoc" @@ -51,4 +53,3 @@ Feature: ConstraintToParamsDocTransformer - DateTime constraint And constraint doc "getAllowedValueList" should return an empty array And constraint doc "getMinLength" should return null And constraint doc "getMaxLength" should return null - diff --git a/features/08_others-constraints/callback-constraint.feature b/features/08_others-constraints/callback-constraint.feature index 5b04bc8..bf0ca53 100644 --- a/features/08_others-constraints/callback-constraint.feature +++ b/features/08_others-constraints/callback-constraint.feature @@ -28,13 +28,14 @@ Feature: ConstraintToParamsDocTransformer - Callback constraint Given I have the following Constraint: """ use Symfony\Component\Validator\Constraints as ConstraintNS; - return new ConstraintNS\Callback([ - 'callback' => function () { + return new ConstraintNS\Callback( + function () { return new ConstraintNS\Required( new ConstraintNS\Type('string') ); }, - 'payload' => [ + null, + [ 'documentation' => [ 'description' => 'description', 'default' => 'default', @@ -42,7 +43,7 @@ Feature: ConstraintToParamsDocTransformer - Callback constraint 'nullable' => false ] ] - ]); + ); """ When I transform constraint Then I should have a constraint doc of class "Yoanm\JsonRpcServerDoc\Domain\Model\Type\StringDoc" diff --git a/tests/Functional/App/Helper/MinMaxHelper/CollectionTest.php b/tests/Functional/App/Helper/MinMaxHelper/CollectionTest.php index 65efdb8..32752aa 100644 --- a/tests/Functional/App/Helper/MinMaxHelper/CollectionTest.php +++ b/tests/Functional/App/Helper/MinMaxHelper/CollectionTest.php @@ -91,34 +91,46 @@ public function provideConstraintsClass() 'expectedMax' => null, ], 'GreaterThan constraint with array type' => [ - 'constraint' => new Assert\GreaterThan([ - 'value' => 2, - 'payload' => ['documentation' => ['type' => 'array']] - ]), + 'constraint' => new Assert\GreaterThan( + 2, + null, + null, + null, + ['documentation' => ['type' => 'array']] + ), 'expectedMin' => 3, 'expectedMax' => null, ], 'GreaterThanOrEqual constraint with array type' => [ - 'constraint' => new Assert\GreaterThanOrEqual([ - 'value' => 2, - 'payload' => ['documentation' => ['type' => 'array']] - ]), + 'constraint' => new Assert\GreaterThanOrEqual( + 2, + null, + null, + null, + ['documentation' => ['type' => 'array']] + ), 'expectedMin' => 2, 'expectedMax' => null, ], 'LessThan constraint with array type' => [ - 'constraint' => new Assert\LessThan([ - 'value' => 3, - 'payload' => ['documentation' => ['type' => 'array']] - ]), + 'constraint' => new Assert\LessThan( + 3, + null, + null, + null, + ['documentation' => ['type' => 'array']] + ), 'expectedMin' => null, 'expectedMax' => 2, ], 'LessThanOrEqual constraint with array type' => [ - 'constraint' => new Assert\LessThanOrEqual([ - 'value' => 3, - 'payload' => ['documentation' => ['type' => 'array']] - ]), + 'constraint' => new Assert\LessThanOrEqual( + 3, + null, + null, + null, + ['documentation' => ['type' => 'array']] + ), 'expectedMin' => null, 'expectedMax' => 3, ], diff --git a/tests/Functional/App/Helper/TypeGuesserTest.php b/tests/Functional/App/Helper/TypeGuesserTest.php index a3dbff3..69b336f 100644 --- a/tests/Functional/App/Helper/TypeGuesserTest.php +++ b/tests/Functional/App/Helper/TypeGuesserTest.php @@ -125,7 +125,7 @@ public function provideConstraints() 'expectedClass' => StringDoc::class, ], 'DateTime to Scalar' => [ - 'constraint' => new Assert\DateTime(['format' => 'U']), + 'constraint' => new Assert\DateTime('U'), 'expectedClass' => ScalarDoc::class, ], 'DateTime to String' => [ @@ -141,11 +141,11 @@ public function provideConstraints() 'expectedClass' => BooleanDoc::class, ], 'Collection to Array' => [ - 'constraint' => new Assert\Collection(['fields' => [0 => [], 1 => []]]), + 'constraint' => new Assert\Collection([0 => [], 1 => []]), 'expectedClass' => ArrayDoc::class, ], 'Collection to Object' => [ - 'constraint' => new Assert\Collection(['fields' => ['a' => [], 'b' => []]]), + 'constraint' => new Assert\Collection(['a' => [], 'b' => []]), 'expectedClass' => ObjectDoc::class, ], 'Choice (multiple) to Array' => [