Skip to content

Commit

Permalink
Bump minimum requirements & supports SF 7.0
Browse files Browse the repository at this point in the history
  • Loading branch information
odolbeau committed Nov 29, 2023
1 parent d08880d commit 3b75470
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 27 deletions.
12 changes: 5 additions & 7 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,12 @@ jobs:
strategy:
matrix:
include:
- php: '7.4'
symfony-require: 4.4.*
- php: '8.0'
symfony-require: 5.3.*
- php: '8.0'
symfony-require: 6.0.*
stability: dev
- php: '8.1'
symfony-require: 6.3.*
- php: '8.2'
symfony-require: 7.0.*
stability: dev
- php: '8.3'
fail-fast: false

steps:
Expand Down
23 changes: 10 additions & 13 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,22 +12,22 @@
"sort-packages": true
},
"require": {
"php": ">=7.4",
"php": ">=8.1",
"giggsey/libphonenumber-for-php": "^8.0",
"symfony/framework-bundle": "^4.4|^5.3|^6.0",
"symfony/intl": "^4.4|^5.3|^6.0",
"symfony/framework-bundle": "^5.4|^6.3|^7.0",
"symfony/intl": "^5.4|^6.3|^7.0",
"symfony/polyfill-mbstring": "^1.28"
},
"require-dev": {
"doctrine/doctrine-bundle": "^1.12|^2.0",
"phpspec/prophecy-phpunit": "^2.0",
"phpunit/phpunit": "^9.5",
"symfony/form": "^4.4|^5.3|^6.0",
"symfony/phpunit-bridge": "^6.2",
"symfony/property-access": "^4.4|^5.3|^6.0",
"symfony/serializer": "^4.4|^5.3|^6.0.1",
"symfony/twig-bundle": "^4.4|^5.3|^6.0",
"symfony/validator": "^4.4|^5.3|^6.0"
"symfony/form": "^5.4|^6.3|^7.0",
"symfony/phpunit-bridge": "^7.0",
"symfony/property-access": "^5.4|^6.3|^7.0",
"symfony/serializer": "^5.4|^6.3|^7.0",
"symfony/twig-bundle": "^5.4|^6.3|^7.0",
"symfony/validator": "^5.4|^6.3|^7.0"
},
"suggest": {
"doctrine/doctrine-bundle": "Add a DBAL mapping type",
Expand All @@ -52,10 +52,7 @@
},
"extra": {
"branch-alias": {
"dev-master": "3.6.x-dev"
"dev-master": "3.10.x-dev"
}
},
"conflict": {
"symfony/serializer": "6.0.0"
}
}
8 changes: 4 additions & 4 deletions tests/Validator/Constraints/PhoneNumberTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,10 @@ public function testProperties()
{
$phoneNumber = new PhoneNumber();

$this->assertObjectHasAttribute('message', $phoneNumber);
$this->assertObjectHasAttribute('type', $phoneNumber);
$this->assertObjectHasAttribute('defaultRegion', $phoneNumber);
$this->assertObjectHasAttribute('regionPath', $phoneNumber);
$this->assertObjectHasProperty('message', $phoneNumber);
$this->assertObjectHasProperty('type', $phoneNumber);
$this->assertObjectHasProperty('defaultRegion', $phoneNumber);
$this->assertObjectHasProperty('regionPath', $phoneNumber);
}

/**
Expand Down
11 changes: 8 additions & 3 deletions tests/Validator/Constraints/PhoneNumberValidatorTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
use Symfony\Component\Validator\Exception\UnexpectedTypeException;
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;

/**
Expand Down Expand Up @@ -68,8 +69,7 @@ public function testValidate($value, $violates, $type = null, $defaultRegion = n
->with($this->isType('string'))
->willReturn($constraintViolationBuilder);
$constraintViolationBuilder
->method('addViolation')
->willReturn($constraintViolationBuilder);
->method('addViolation');

$this->context
->expects($this->once())
Expand All @@ -89,7 +89,12 @@ public function testValidate($value, $violates, $type = null, $defaultRegion = n
public function testValidateFromAttribute()
{
$classMetadata = new ClassMetadata(PhoneNumberDummy::class);
(new AnnotationLoader())->loadClassMetadata($classMetadata);
if (class_exists(AttributeLoader::class)) {
(new AttributeLoader())->loadClassMetadata($classMetadata);
} else {
// AnnotationLoader have been removed in favor of AttributeLoader in 7.0
(new AnnotationLoader())->loadClassMetadata($classMetadata);
}

[$constraint1] = $classMetadata->properties['phoneNumber1']->constraints;
[$constraint2] = $classMetadata->properties['phoneNumber2']->constraints;
Expand Down

0 comments on commit 3b75470

Please sign in to comment.