@@ -69,9 +69,9 @@ class ResolvedFormTypeTest extends \PHPUnit_Framework_TestCase
6969
7070 protected function setUp ()
7171 {
72- $ this ->dispatcher = $ this ->getMock ('Symfony\Component\EventDispatcher\EventDispatcherInterface ' );
73- $ this ->factory = $ this ->getMock ('Symfony\Component\Form\FormFactoryInterface ' );
74- $ this ->dataMapper = $ this ->getMock ('Symfony\Component\Form\DataMapperInterface ' );
72+ $ this ->dispatcher = $ this ->getMockBuilder ('Symfony\Component\EventDispatcher\EventDispatcherInterface ' )-> getMock ( );
73+ $ this ->factory = $ this ->getMockBuilder ('Symfony\Component\Form\FormFactoryInterface ' )-> getMock ( );
74+ $ this ->dataMapper = $ this ->getMockBuilder ('Symfony\Component\Form\DataMapperInterface ' )-> getMock ( );
7575 $ this ->parentType = $ this ->getMockFormType ();
7676 $ this ->type = $ this ->getMockFormType ();
7777 $ this ->extension1 = $ this ->getMockFormTypeExtension ();
@@ -127,7 +127,7 @@ public function testCreateBuilder()
127127 {
128128 $ givenOptions = array ('a ' => 'a_custom ' , 'c ' => 'c_custom ' );
129129 $ resolvedOptions = array ('a ' => 'a_custom ' , 'b ' => 'b_default ' , 'c ' => 'c_custom ' , 'd ' => 'd_default ' );
130- $ optionsResolver = $ this ->getMock ('Symfony\Component\OptionsResolver\OptionsResolverInterface ' );
130+ $ optionsResolver = $ this ->getMockBuilder ('Symfony\Component\OptionsResolver\OptionsResolverInterface ' )-> getMock ( );
131131
132132 $ this ->resolvedType = $ this ->getMockBuilder ('Symfony\Component\Form\ResolvedFormType ' )
133133 ->setConstructorArgs (array ($ this ->type , array ($ this ->extension1 , $ this ->extension2 ), $ this ->parentResolvedType ))
@@ -155,7 +155,7 @@ public function testCreateBuilderWithDataClassOption()
155155 {
156156 $ givenOptions = array ('data_class ' => 'Foo ' );
157157 $ resolvedOptions = array ('data_class ' => '\stdClass ' );
158- $ optionsResolver = $ this ->getMock ('Symfony\Component\OptionsResolver\OptionsResolverInterface ' );
158+ $ optionsResolver = $ this ->getMockBuilder ('Symfony\Component\OptionsResolver\OptionsResolverInterface ' )-> getMock ( );
159159
160160 $ this ->resolvedType = $ this ->getMockBuilder ('Symfony\Component\Form\ResolvedFormType ' )
161161 ->setConstructorArgs (array ($ this ->type , array ($ this ->extension1 , $ this ->extension2 ), $ this ->parentResolvedType ))
@@ -194,7 +194,7 @@ public function testBuildForm()
194194 };
195195
196196 $ options = array ('a ' => 'Foo ' , 'b ' => 'Bar ' );
197- $ builder = $ this ->getMock ('Symfony\Component\Form\Test\FormBuilderInterface ' );
197+ $ builder = $ this ->getMockBuilder ('Symfony\Component\Form\Test\FormBuilderInterface ' )-> getMock ( );
198198
199199 // First the form is built for the super type
200200 $ this ->parentType ->expects ($ this ->once ())
@@ -224,7 +224,7 @@ public function testBuildForm()
224224
225225 public function testCreateView ()
226226 {
227- $ form = $ this ->getMock ('Symfony\Component\Form\Test\FormInterface ' );
227+ $ form = $ this ->getMockBuilder ('Symfony\Component\Form\Test\FormInterface ' )-> getMock ( );
228228
229229 $ view = $ this ->resolvedType ->createView ($ form );
230230
@@ -234,8 +234,8 @@ public function testCreateView()
234234
235235 public function testCreateViewWithParent ()
236236 {
237- $ form = $ this ->getMock ('Symfony\Component\Form\Test\FormInterface ' );
238- $ parentView = $ this ->getMock ('Symfony\Component\Form\FormView ' );
237+ $ form = $ this ->getMockBuilder ('Symfony\Component\Form\Test\FormInterface ' )-> getMock ( );
238+ $ parentView = $ this ->getMockBuilder ('Symfony\Component\Form\FormView ' )-> getMock ( );
239239
240240 $ view = $ this ->resolvedType ->createView ($ form , $ parentView );
241241
@@ -246,8 +246,8 @@ public function testCreateViewWithParent()
246246 public function testBuildView ()
247247 {
248248 $ options = array ('a ' => '1 ' , 'b ' => '2 ' );
249- $ form = $ this ->getMock ('Symfony\Component\Form\Test\FormInterface ' );
250- $ view = $ this ->getMock ('Symfony\Component\Form\FormView ' );
249+ $ form = $ this ->getMockBuilder ('Symfony\Component\Form\Test\FormInterface ' )-> getMock ( );
250+ $ view = $ this ->getMockBuilder ('Symfony\Component\Form\FormView ' )-> getMock ( );
251251
252252 $ test = $ this ;
253253 $ i = 0 ;
@@ -290,8 +290,8 @@ public function testBuildView()
290290 public function testFinishView ()
291291 {
292292 $ options = array ('a ' => '1 ' , 'b ' => '2 ' );
293- $ form = $ this ->getMock ('Symfony\Component\Form\Test\FormInterface ' );
294- $ view = $ this ->getMock ('Symfony\Component\Form\FormView ' );
293+ $ form = $ this ->getMockBuilder ('Symfony\Component\Form\Test\FormInterface ' )-> getMock ( );
294+ $ view = $ this ->getMockBuilder ('Symfony\Component\Form\FormView ' )-> getMock ( );
295295
296296 $ test = $ this ;
297297 $ i = 0 ;
@@ -393,7 +393,7 @@ public function testGetBlockPrefix()
393393 public function testBlockPrefixDefaultsToNameIfSet ()
394394 {
395395 // Type without getBlockPrefix() method
396- $ type = $ this ->getMock ('Symfony\Component\Form\FormTypeInterface ' );
396+ $ type = $ this ->getMockBuilder ('Symfony\Component\Form\FormTypeInterface ' )-> getMock ( );
397397
398398 $ type ->expects ($ this ->once ())
399399 ->method ('getName ' )
@@ -431,23 +431,23 @@ public function provideTypeClassBlockPrefixTuples()
431431 */
432432 private function getMockFormType ($ typeClass = 'Symfony\Component\Form\AbstractType ' )
433433 {
434- return $ this ->getMock ($ typeClass, array ('getName ' , 'getBlockPrefix ' , 'configureOptions ' , 'finishView ' , 'buildView ' , 'buildForm ' ));
434+ return $ this ->getMockBuilder ($ typeClass)-> setMethods ( array ('getName ' , 'getBlockPrefix ' , 'configureOptions ' , 'finishView ' , 'buildView ' , 'buildForm ' ))-> getMock ( );
435435 }
436436
437437 /**
438438 * @return \PHPUnit_Framework_MockObject_MockObject
439439 */
440440 private function getMockFormTypeExtension ()
441441 {
442- return $ this ->getMock ('Symfony\Component\Form\AbstractTypeExtension ' , array ('getExtendedType ' , 'configureOptions ' , 'finishView ' , 'buildView ' , 'buildForm ' ));
442+ return $ this ->getMockBuilder ('Symfony\Component\Form\AbstractTypeExtension ' )-> setMethods ( array ('getExtendedType ' , 'configureOptions ' , 'finishView ' , 'buildView ' , 'buildForm ' ))-> getMock ( );
443443 }
444444
445445 /**
446446 * @return \PHPUnit_Framework_MockObject_MockObject
447447 */
448448 private function getMockFormFactory ()
449449 {
450- return $ this ->getMock ('Symfony\Component\Form\FormFactoryInterface ' );
450+ return $ this ->getMockBuilder ('Symfony\Component\Form\FormFactoryInterface ' )-> getMock ( );
451451 }
452452
453453 /**
0 commit comments