Skip to content

Commit

Permalink
Allow symfony 7 (#12)
Browse files Browse the repository at this point in the history
Allow symfony 7
  • Loading branch information
thomasbeaujean authored Apr 19, 2024
1 parent eb888e9 commit caff067
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 18 deletions.
19 changes: 14 additions & 5 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,23 @@ jobs:
strategy:
max-parallel: 10
matrix:
php: [ '7.2', '7.3', '7.4', '8.0' ]
sf_version: [ '3.4.*', '4.4.*', '5.3.*' ]
versions:
- sf: '6.4.*'
php: '8.1'
- sf: '6.4.*'
php: '8.2'
- sf: '6.4.*'
php: '8.3'
- sf: '7.1.*'
php: '8.2'
- sf: '7.1.*'
php: '8.3'

steps:
- name: Set up PHP
uses: shivammathur/[email protected]
with:
php-version: ${{ matrix.php }}
php-version: ${{ matrix.versions.php }}
coverage: none
tools: flex

Expand All @@ -24,7 +33,7 @@ jobs:

- name: Download dependencies
env:
SYMFONY_REQUIRE: ${{ matrix.sf_version }}
SYMFONY_REQUIRE: ${{ matrix.versions.sf }}
uses: ramsey/composer-install@v1

- name: Run tests
Expand All @@ -37,7 +46,7 @@ jobs:
- name: Set up PHP
uses: shivammathur/[email protected]
with:
php-version: 7.3
php-version: 8.3
coverage: none

- name: Checkout code
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/static.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ jobs:
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: 8.0
php-version: 8.3
coverage: none
tools: phpstan:0.12.92, cs2pr

Expand Down Expand Up @@ -51,7 +51,7 @@ jobs:
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: 8.0
php-version: 8.3
coverage: none
tools: vimeo/psalm:4.8.1

Expand All @@ -69,7 +69,7 @@ jobs:
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: 8.0
php-version: 8.3
coverage: none
tools: composer-normalize

Expand Down
7 changes: 4 additions & 3 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,13 @@
}
],
"require": {
"php": "^7.2 || ^8.0",
"php": "^8.1",
"doctrine/orm": "^2.4",
"symfony/validator": "^3.4 || ^4.4 || ^5.0 || ^6.0"
"symfony/validator": "^6.0 || ^7.0"
},
"require-dev": {
"symfony/phpunit-bridge": "^5.3"
"symfony/phpunit-bridge": "^6.0",
"symfony/validator": "^6.4 || ^7.0"
},
"autoload": {
"psr-4": {
Expand Down
9 changes: 2 additions & 7 deletions tests/EntityExistValidatorTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
use Symfony\Component\Validator\Constraints\NotNull;
use Symfony\Component\Validator\Context\ExecutionContextInterface;
use Symfony\Component\Validator\Mapping\ClassMetadata;
use Symfony\Component\Validator\Mapping\Loader\AnnotationLoader;
use Symfony\Component\Validator\Mapping\Loader\AttributeLoader;
use Symfony\Component\Validator\Violation\ConstraintViolationBuilderInterface;

class EntityExistValidatorTest extends TestCase
Expand Down Expand Up @@ -166,15 +166,10 @@ public function testValidateInvalidEntity(): void
*/
public function testValidateFromAttribute()
{
$numRequired = (new \ReflectionMethod(AnnotationLoader::class, '__construct'))->getNumberOfRequiredParameters();
if ($numRequired > 0) {
$this->markTestSkipped('This test is skipped on Symfony <5.2');
}

$this->context->expects($this->never())->method('buildViolation');

$classMetadata = new ClassMetadata(EntityDummy::class);
(new AnnotationLoader())->loadClassMetadata($classMetadata);
(new AttributeLoader())->loadClassMetadata($classMetadata);

[$constraint] = $classMetadata->properties['user']->constraints;

Expand Down

0 comments on commit caff067

Please sign in to comment.