File tree Expand file tree Collapse file tree 2 files changed +19
-6
lines changed Expand file tree Collapse file tree 2 files changed +19
-6
lines changed Original file line number Diff line number Diff line change 12
12
namespace Symfony \Cmf \Bundle \RoutingBundle \Form \Type ;
13
13
14
14
use Symfony \Component \Form \AbstractType ;
15
+ use Symfony \Component \OptionsResolver \OptionsResolver ;
15
16
use Symfony \Component \OptionsResolver \OptionsResolverInterface ;
16
17
17
18
class RouteTypeType extends AbstractType
18
19
{
19
20
protected $ routeTypes = array ();
20
21
protected $ translator ;
21
22
22
- public function setDefaultOptions (OptionsResolverInterface $ resolver )
23
+ /**
24
+ * {@inheritdoc}
25
+ */
26
+ public function configureOptions (OptionsResolver $ resolver )
23
27
{
24
28
$ choices = array ();
25
29
foreach ($ this ->routeTypes as $ routeType ) {
@@ -32,6 +36,16 @@ public function setDefaultOptions(OptionsResolverInterface $resolver)
32
36
));
33
37
}
34
38
39
+ /**
40
+ * {@inheritdoc}
41
+ *
42
+ * @todo Remove when Symfony <2.7 support is dropped.
43
+ */
44
+ public function setDefaultOptions (OptionsResolverInterface $ resolver )
45
+ {
46
+ $ this ->configureOptions ($ resolver );
47
+ }
48
+
35
49
/**
36
50
* Register a route type
37
51
*
Original file line number Diff line number Diff line change @@ -19,16 +19,14 @@ class RouteTypeTypeTest extends \PHPUnit_Framework_Testcase
19
19
public function setUp ()
20
20
{
21
21
$ this ->type = new RouteTypeType ;
22
- $ this ->ori = $ this ->getMock (
23
- 'Symfony\Component\OptionsResolver\OptionsResolverInterface ' );
24
22
}
25
23
26
24
public function testSetDefaultOptions ()
27
25
{
28
26
$ type = new RouteTypeType ;
29
27
$ optionsResolver = new OptionsResolver ();
30
28
31
- $ type ->setDefaultOptions ($ optionsResolver );
29
+ $ type ->configureOptions ($ optionsResolver );
32
30
33
31
$ options = $ optionsResolver ->resolve ();
34
32
@@ -40,7 +38,8 @@ public function testDefaultsSet()
40
38
$ this ->type ->addRouteType ('foobar ' );
41
39
$ this ->type ->addRouteType ('barfoo ' );
42
40
43
- $ this ->ori ->expects ($ this ->once ())
41
+ $ optionsResolver = $ this ->getMock ('Symfony\Component\OptionsResolver\OptionsResolver ' );
42
+ $ optionsResolver ->expects ($ this ->once ())
44
43
->method ('setDefaults ' )
45
44
->with (array (
46
45
'choices ' => array (
@@ -50,6 +49,6 @@ public function testDefaultsSet()
50
49
'translation_domain ' => 'CmfRoutingBundle ' ,
51
50
));
52
51
53
- $ this ->type ->setDefaultOptions ( $ this -> ori );
52
+ $ this ->type ->configureOptions ( $ optionsResolver );
54
53
}
55
54
}
You can’t perform that action at this time.
0 commit comments