@@ -112,6 +112,14 @@ final class Builder
112
112
'fail-on-risky ' ,
113
113
'fail-on-skipped ' ,
114
114
'fail-on-warning ' ,
115
+ 'do-not-fail-on-deprecation ' ,
116
+ 'do-not-fail-on-phpunit-deprecation ' ,
117
+ 'do-not-fail-on-empty-test-suite ' ,
118
+ 'do-not-fail-on-incomplete ' ,
119
+ 'do-not-fail-on-notice ' ,
120
+ 'do-not-fail-on-risky ' ,
121
+ 'do-not-fail-on-skipped ' ,
122
+ 'do-not-fail-on-warning ' ,
115
123
'stop-on-defect ' ,
116
124
'stop-on-deprecation ' ,
117
125
'stop-on-error ' ,
@@ -211,6 +219,14 @@ public function fromParameters(array $parameters): Configuration
211
219
$ failOnRisky = null ;
212
220
$ failOnSkipped = null ;
213
221
$ failOnWarning = null ;
222
+ $ doNotFailOnDeprecation = null ;
223
+ $ doNotFailOnPhpunitDeprecation = null ;
224
+ $ doNotFailOnEmptyTestSuite = null ;
225
+ $ doNotFailOnIncomplete = null ;
226
+ $ doNotFailOnNotice = null ;
227
+ $ doNotFailOnRisky = null ;
228
+ $ doNotFailOnSkipped = null ;
229
+ $ doNotFailOnWarning = null ;
214
230
$ stopOnDefect = null ;
215
231
$ stopOnDeprecation = null ;
216
232
$ stopOnError = null ;
@@ -579,45 +595,181 @@ public function fromParameters(array $parameters): Configuration
579
595
break ;
580
596
581
597
case '--fail-on-deprecation ' :
598
+ $ this ->warnWhenOptionsConflict (
599
+ $ doNotFailOnDeprecation ,
600
+ '--fail-on-deprecation ' ,
601
+ '--do-not-fail-on-deprecation ' ,
602
+ );
603
+
582
604
$ failOnDeprecation = true ;
583
605
584
606
break ;
585
607
586
608
case '--fail-on-phpunit-deprecation ' :
609
+ $ this ->warnWhenOptionsConflict (
610
+ $ doNotFailOnPhpunitDeprecation ,
611
+ '--fail-on-phpunit-deprecation ' ,
612
+ '--do-not-fail-on-phpunit-deprecation ' ,
613
+ );
614
+
587
615
$ failOnPhpunitDeprecation = true ;
588
616
589
617
break ;
590
618
591
619
case '--fail-on-empty-test-suite ' :
620
+ $ this ->warnWhenOptionsConflict (
621
+ $ doNotFailOnEmptyTestSuite ,
622
+ '--fail-on-empty-test-suite ' ,
623
+ '--do-not-fail-on-empty-test-suite ' ,
624
+ );
625
+
592
626
$ failOnEmptyTestSuite = true ;
593
627
594
628
break ;
595
629
596
630
case '--fail-on-incomplete ' :
631
+ $ this ->warnWhenOptionsConflict (
632
+ $ doNotFailOnIncomplete ,
633
+ '--fail-on-incomplete ' ,
634
+ '--do-not-fail-on-incomplete ' ,
635
+ );
636
+
597
637
$ failOnIncomplete = true ;
598
638
599
639
break ;
600
640
601
641
case '--fail-on-notice ' :
642
+ $ this ->warnWhenOptionsConflict (
643
+ $ doNotFailOnNotice ,
644
+ '--fail-on-notice ' ,
645
+ '--do-not-fail-on-notice ' ,
646
+ );
647
+
602
648
$ failOnNotice = true ;
603
649
604
650
break ;
605
651
606
652
case '--fail-on-risky ' :
653
+ $ this ->warnWhenOptionsConflict (
654
+ $ doNotFailOnRisky ,
655
+ '--fail-on-risky ' ,
656
+ '--do-not-fail-on-risky ' ,
657
+ );
658
+
607
659
$ failOnRisky = true ;
608
660
609
661
break ;
610
662
611
663
case '--fail-on-skipped ' :
664
+ $ this ->warnWhenOptionsConflict (
665
+ $ doNotFailOnSkipped ,
666
+ '--fail-on-skipped ' ,
667
+ '--do-not-fail-on-skipped ' ,
668
+ );
669
+
612
670
$ failOnSkipped = true ;
613
671
614
672
break ;
615
673
616
674
case '--fail-on-warning ' :
675
+ $ this ->warnWhenOptionsConflict (
676
+ $ doNotFailOnWarning ,
677
+ '--fail-on-warning ' ,
678
+ '--do-not-fail-on-warning ' ,
679
+ );
680
+
617
681
$ failOnWarning = true ;
618
682
619
683
break ;
620
684
685
+ case '--do-not-fail-on-deprecation ' :
686
+ $ this ->warnWhenOptionsConflict (
687
+ $ failOnDeprecation ,
688
+ '--do-not-fail-on-deprecation ' ,
689
+ '--fail-on-deprecation ' ,
690
+ );
691
+
692
+ $ doNotFailOnDeprecation = true ;
693
+
694
+ break ;
695
+
696
+ case '--do-not-fail-on-phpunit-deprecation ' :
697
+ $ this ->warnWhenOptionsConflict (
698
+ $ failOnPhpunitDeprecation ,
699
+ '--do-not-fail-on-phpunit-deprecation ' ,
700
+ '--fail-on-phpunit-deprecation ' ,
701
+ );
702
+
703
+ $ doNotFailOnPhpunitDeprecation = true ;
704
+
705
+ break ;
706
+
707
+ case '--do-not-fail-on-empty-test-suite ' :
708
+ $ this ->warnWhenOptionsConflict (
709
+ $ failOnEmptyTestSuite ,
710
+ '--do-not-fail-on-empty-test-suite ' ,
711
+ '--fail-on-empty-test-suite ' ,
712
+ );
713
+
714
+ $ doNotFailOnEmptyTestSuite = true ;
715
+
716
+ break ;
717
+
718
+ case '--do-not-fail-on-incomplete ' :
719
+ $ this ->warnWhenOptionsConflict (
720
+ $ failOnIncomplete ,
721
+ '--do-not-fail-on-incomplete ' ,
722
+ '--fail-on-incomplete ' ,
723
+ );
724
+
725
+ $ doNotFailOnIncomplete = true ;
726
+
727
+ break ;
728
+
729
+ case '--do-not-fail-on-notice ' :
730
+ $ this ->warnWhenOptionsConflict (
731
+ $ failOnNotice ,
732
+ '--do-not-fail-on-notice ' ,
733
+ '--fail-on-notice ' ,
734
+ );
735
+
736
+ $ doNotFailOnNotice = true ;
737
+
738
+ break ;
739
+
740
+ case '--do-not-fail-on-risky ' :
741
+ $ this ->warnWhenOptionsConflict (
742
+ $ failOnRisky ,
743
+ '--do-not-fail-on-risky ' ,
744
+ '--fail-on-risky ' ,
745
+ );
746
+
747
+ $ doNotFailOnRisky = true ;
748
+
749
+ break ;
750
+
751
+ case '--do-not-fail-on-skipped ' :
752
+ $ this ->warnWhenOptionsConflict (
753
+ $ failOnSkipped ,
754
+ '--do-not-fail-on-skipped ' ,
755
+ '--fail-on-skipped ' ,
756
+ );
757
+
758
+ $ doNotFailOnSkipped = true ;
759
+
760
+ break ;
761
+
762
+ case '--do-not-fail-on-warning ' :
763
+ $ this ->warnWhenOptionsConflict (
764
+ $ failOnWarning ,
765
+ '--do-not-fail-on-warning ' ,
766
+ '--fail-on-warning ' ,
767
+ );
768
+
769
+ $ doNotFailOnWarning = true ;
770
+
771
+ break ;
772
+
621
773
case '--stop-on-defect ' :
622
774
$ stopOnDefect = true ;
623
775
@@ -949,6 +1101,14 @@ public function fromParameters(array $parameters): Configuration
949
1101
$ failOnRisky ,
950
1102
$ failOnSkipped ,
951
1103
$ failOnWarning ,
1104
+ $ doNotFailOnDeprecation ,
1105
+ $ doNotFailOnPhpunitDeprecation ,
1106
+ $ doNotFailOnEmptyTestSuite ,
1107
+ $ doNotFailOnIncomplete ,
1108
+ $ doNotFailOnNotice ,
1109
+ $ doNotFailOnRisky ,
1110
+ $ doNotFailOnSkipped ,
1111
+ $ doNotFailOnWarning ,
952
1112
$ stopOnDefect ,
953
1113
$ stopOnDeprecation ,
954
1114
$ stopOnError ,
@@ -1035,4 +1195,22 @@ private function markProcessed(string $option): void
1035
1195
);
1036
1196
}
1037
1197
}
1198
+
1199
+ /**
1200
+ * @psalm-param non-empty-string $option
1201
+ */
1202
+ private function warnWhenOptionsConflict (?bool $ current , string $ option , string $ opposite ): void
1203
+ {
1204
+ if ($ current === null ) {
1205
+ return ;
1206
+ }
1207
+
1208
+ EventFacade::emitter ()->testRunnerTriggeredPhpunitWarning (
1209
+ sprintf (
1210
+ 'Options %s and %s cannot be used together ' ,
1211
+ $ option ,
1212
+ $ opposite ,
1213
+ ),
1214
+ );
1215
+ }
1038
1216
}
0 commit comments