Skip to content

Commit a59bc1d

Browse files
committed
Merge pull request #36 from fre5h/feature-symfony-3.0
Symfony 3.0 support
2 parents 2a19583 + fcf8184 commit a59bc1d

File tree

5 files changed

+33
-16
lines changed

5 files changed

+33
-16
lines changed

.travis.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,13 @@ sudo: false
33

44
php:
55
- 5.4
6-
- 5.6
76
- 7.0
87
- hhvm
98

109
env:
10+
- SYMFONY_VERSION=2.6.*
1111
- SYMFONY_VERSION=2.7.*
12-
- SYMFONY_VERSION=3.0.*@dev
12+
- SYMFONY_VERSION=3.0.*
1313

1414
allow_failures:
1515
- php: hhvm

README.md

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,15 @@ Provides support of **ENUM type** for Doctrine in Symfony applications.
2222

2323
## Installation
2424

25-
#### Latest stable version
25+
#### Latest actual stable version (includes support of Symfony3)
26+
27+
* PHP >= 5.4
28+
* Symfony >= 2.6, **also works with Symfony 3.0**
29+
* Doctrine >= 2.2
30+
31+
```php composer.phar require fresh/doctrine-enum-bundle='v4.0'```
32+
33+
#### Latest stable version for Symfony <=2.8
2634

2735
* PHP >= 5.4
2836
* Symfony >= 2.3 and <= 2.8

Resources/config/services.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ services:
2121
enum_type_guesser:
2222
class: %enum_type_guesser.class%
2323
arguments:
24-
- @doctrine
24+
- "@doctrine"
2525
- %doctrine.dbal.connection_factory.types%
2626
tags:
2727
- { name: form.type_guesser }

Tests/Validator/EnumValidatorTest.php

Lines changed: 20 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ public function setUp()
3939
{
4040
$this->enumValidator = new EnumValidator();
4141

42-
$this->context = $this->getMockBuilder('Symfony\Component\Validator\ExecutionContext')
42+
$this->context = $this->getMockBuilder('Symfony\Component\Validator\Context\ExecutionContext')
4343
->disableOriginalConstructor()
4444
->getMock();
4545
}
@@ -67,9 +67,8 @@ public function testValidBasketballPositionType()
6767
'entity' => 'Fresh\DoctrineEnumBundle\Tests\Fixtures\DBAL\Types\BasketballPositionType',
6868
]);
6969

70-
$this->context
71-
->expects($this->never())
72-
->method('addViolation');
70+
$this->context->expects($this->never())
71+
->method('buildViolation');
7372

7473
$this->enumValidator->initialize($this->context);
7574
$this->enumValidator->validate(BasketballPositionType::SMALL_FORWARD, $constraint);
@@ -84,13 +83,23 @@ public function testInvalidBasketballPositionType()
8483
'entity' => 'Fresh\DoctrineEnumBundle\Tests\Fixtures\DBAL\Types\BasketballPositionType',
8584
]);
8685

87-
$this->context
88-
->expects($this->once())
89-
->method('addViolation')
90-
->with(
91-
$this->equalTo('The value you selected is not a valid choice.'),
92-
$this->equalTo(['{{ value }}' => '"Pitcher"'])
93-
);
86+
$constraintValidationBuilder = $this->getMockBuilder('Symfony\Component\Validator\Violation\ConstraintViolationBuilder')
87+
->disableOriginalConstructor()
88+
->getMock();
89+
90+
$constraintValidationBuilder->expects($this->once())
91+
->method('setParameter')
92+
->with($this->equalTo('{{ value }}'), $this->equalTo('"Pitcher"'))
93+
->will($this->returnSelf());
94+
95+
$constraintValidationBuilder->expects($this->once())
96+
->method('setCode')
97+
->will($this->returnSelf());
98+
99+
$this->context->expects($this->once())
100+
->method('buildViolation')
101+
->with($this->equalTo('The value you selected is not a valid choice.'))
102+
->will($this->returnValue($constraintValidationBuilder));
94103

95104
$this->enumValidator->initialize($this->context);
96105
$this->enumValidator->validate('Pitcher', $constraint); // It's not a baseball =)

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
},
2424
"require": {
2525
"php": ">=5.4.0",
26-
"symfony/symfony": "~2.3",
26+
"symfony/symfony": "~2.6|~3.0",
2727
"doctrine/orm": "~2.2"
2828
},
2929
"require-dev": {

0 commit comments

Comments
 (0)