@@ -501,7 +501,7 @@ public function testLazyDeprecationFailsIfInvalidDeprecationMessageType()
501501
502502/**
503503 * @expectedException \Symfony\Component\OptionsResolver\Exception\OptionDefinitionException
504- * @expectedExceptionMessage The options "bar ", "foo " have a cyclic dependency.
504+ * @expectedExceptionMessage The options "foo ", "bar " have a cyclic dependency.
505505 */
506506public function testFailsIfCyclicDependencyBetweenDeprecation ()
507507 {
@@ -538,10 +538,15 @@ public function testIsNotDeprecatedIfEmptyString()
538538/**
539539 * @dataProvider provideDeprecationData
540540 */
541- public function testDeprecationMessages (\Closure $ configureOptions ,array $ options , ?array $ expectedError )
541+ public function testDeprecationMessages (\Closure $ configureOptions ,array $ options , ?array $ expectedError, int $ expectedCount )
542542 {
543+ $ count =0 ;
543544error_clear_last ();
544- set_error_handler (function () {return false ; });
545+ set_error_handler (function ()use (&$ count ) {
546+ ++$ count ;
547+
548+ return false ;
549+ });
545550$ e =error_reporting (0 );
546551
547552$ configureOptions ($ this ->resolver );
@@ -554,6 +559,7 @@ public function testDeprecationMessages(\Closure $configureOptions, array $optio
554559 unset($ lastError ['file ' ],$ lastError ['line ' ]);
555560
556561$ this ->assertSame ($ expectedError ,$ lastError );
562+ $ this ->assertSame ($ expectedCount ,$ count );
557563 }
558564
559565public function provideDeprecationData ()
@@ -570,6 +576,7 @@ function (OptionsResolver $resolver) {
570576'type ' =>E_USER_DEPRECATED ,
571577'message ' =>'The option "foo" is deprecated. ' ,
572578 ),
579+ 1 ,
573580 );
574581
575582yield 'It deprecates an option with custom message ' =>array (
@@ -587,6 +594,7 @@ function (OptionsResolver $resolver) {
587594'type ' =>E_USER_DEPRECATED ,
588595'message ' =>'The option "foo" is deprecated, use "bar" option instead. ' ,
589596 ),
597+ 2 ,
590598 );
591599
592600yield 'It does not deprecates a missing option with default value ' =>array (
@@ -598,6 +606,7 @@ function (OptionsResolver $resolver) {
598606 },
599607array (),
600608null ,
609+ 0 ,
601610 );
602611
603612yield 'It deprecates an option evaluated in another definition ' =>array (
@@ -617,6 +626,7 @@ function (OptionsResolver $resolver) {
617626'type ' =>E_USER_DEPRECATED ,
618627'message ' =>'The option "foo" is deprecated. ' ,
619628 ),
629+ 1 ,
620630 );
621631
622632yield 'It deprecates allowed type and value ' =>array (
@@ -638,6 +648,7 @@ function (OptionsResolver $resolver) {
638648'type ' =>E_USER_DEPRECATED ,
639649'message ' =>'Passing an instance of "stdClass" to option "foo" is deprecated, pass its FQCN instead. ' ,
640650 ),
651+ 1 ,
641652 );
642653
643654yield 'It ignores deprecation for missing option without default value ' =>array (
@@ -649,6 +660,7 @@ function (OptionsResolver $resolver) {
649660 },
650661array ('bar ' =>'baz ' ),
651662null ,
663+ 0 ,
652664 );
653665
654666yield 'It ignores deprecation if closure returns an empty string ' =>array (
@@ -662,6 +674,7 @@ function (OptionsResolver $resolver) {
662674 },
663675array ('foo ' => Bar::class),
664676null ,
677+ 0 ,
665678 );
666679
667680yield 'It deprecates value depending on other option value ' =>array (
@@ -683,6 +696,7 @@ function (OptionsResolver $resolver) {
683696'type ' =>E_USER_DEPRECATED ,
684697'message ' =>'Using the "date_format" option when the "widget" option is set to "single_text" is deprecated. ' ,
685698 ),
699+ 1 ,
686700 );
687701 }
688702