@@ -610,56 +610,56 @@ public function run(TestResult $result = null): TestResult
610
610
611
611
$ test = null ;
612
612
613
- try {
614
- foreach ($ hookMethods ['beforeClass ' ] as $ beforeClassMethod ) {
615
- if ($ this ->testCase &&
616
- class_exists ($ this ->name , false ) &&
617
- method_exists ($ this ->name , $ beforeClassMethod )) {
618
- if ($ missingRequirements = TestUtil::getMissingRequirements ($ this ->name , $ beforeClassMethod )) {
619
- $ this ->markTestSuiteSkipped (implode (PHP_EOL , $ missingRequirements ));
620
- }
613
+ if ($ this ->testCase && class_exists ($ this ->name , false )) {
614
+ try {
615
+ foreach ($ hookMethods ['beforeClass ' ] as $ beforeClassMethod ) {
616
+ if (method_exists ($ this ->name , $ beforeClassMethod )) {
617
+ if ($ missingRequirements = TestUtil::getMissingRequirements ($ this ->name , $ beforeClassMethod )) {
618
+ $ this ->markTestSuiteSkipped (implode (PHP_EOL , $ missingRequirements ));
619
+ }
621
620
622
- call_user_func ([$ this ->name , $ beforeClassMethod ]);
621
+ call_user_func ([$ this ->name , $ beforeClassMethod ]);
622
+ }
623
+ }
624
+ } catch (SkippedTestSuiteError $ error ) {
625
+ foreach ($ this ->tests () as $ test ) {
626
+ $ result ->startTest ($ test );
627
+ $ result ->addFailure ($ test , $ error , 0 );
628
+ $ result ->endTest ($ test , 0 );
623
629
}
624
- }
625
- } catch (SkippedTestSuiteError $ error ) {
626
- foreach ($ this ->tests () as $ test ) {
627
- $ result ->startTest ($ test );
628
- $ result ->addFailure ($ test , $ error , 0 );
629
- $ result ->endTest ($ test , 0 );
630
- }
631
630
632
- $ result ->endTestSuite ($ this );
631
+ $ result ->endTestSuite ($ this );
633
632
634
- return $ result ;
635
- } catch (Throwable $ t ) {
636
- $ errorAdded = false ;
633
+ return $ result ;
634
+ } catch (Throwable $ t ) {
635
+ $ errorAdded = false ;
637
636
638
- foreach ($ this ->tests () as $ test ) {
639
- if ($ result ->shouldStop ()) {
640
- break ;
641
- }
637
+ foreach ($ this ->tests () as $ test ) {
638
+ if ($ result ->shouldStop ()) {
639
+ break ;
640
+ }
642
641
643
- $ result ->startTest ($ test );
642
+ $ result ->startTest ($ test );
644
643
645
- if (!$ errorAdded ) {
646
- $ result ->addError ($ test , $ t , 0 );
644
+ if (!$ errorAdded ) {
645
+ $ result ->addError ($ test , $ t , 0 );
647
646
648
- $ errorAdded = true ;
649
- } else {
650
- $ result ->addFailure (
651
- $ test ,
652
- new SkippedTestError ('Test skipped because of an error in hook method ' ),
653
- 0
654
- );
655
- }
647
+ $ errorAdded = true ;
648
+ } else {
649
+ $ result ->addFailure (
650
+ $ test ,
651
+ new SkippedTestError ('Test skipped because of an error in hook method ' ),
652
+ 0
653
+ );
654
+ }
656
655
657
- $ result ->endTest ($ test , 0 );
658
- }
656
+ $ result ->endTest ($ test , 0 );
657
+ }
659
658
660
- $ result ->endTestSuite ($ this );
659
+ $ result ->endTestSuite ($ this );
661
660
662
- return $ result ;
661
+ return $ result ;
662
+ }
663
663
}
664
664
665
665
foreach ($ this as $ test ) {
@@ -677,22 +677,22 @@ class_exists($this->name, false) &&
677
677
$ test ->run ($ result );
678
678
}
679
679
680
- foreach ($ hookMethods ['afterClass ' ] as $ afterClassMethod ) {
681
- if ($ this ->testCase &&
682
- class_exists ($ this ->name , false ) &&
683
- method_exists ($ this ->name , $ afterClassMethod )) {
684
- try {
685
- call_user_func ([$ this ->name , $ afterClassMethod ]);
686
- } catch (Throwable $ t ) {
687
- $ message = "Exception in {$ this ->name }:: {$ afterClassMethod }" . PHP_EOL . $ t ->getMessage ();
688
- $ error = new SyntheticError ($ message , 0 , $ t ->getFile (), $ t ->getLine (), $ t ->getTrace ());
680
+ if ($ this ->testCase && class_exists ($ this ->name , false )) {
681
+ foreach ($ hookMethods ['afterClass ' ] as $ afterClassMethod ) {
682
+ if (method_exists ($ this ->name , $ afterClassMethod )) {
683
+ try {
684
+ call_user_func ([$ this ->name , $ afterClassMethod ]);
685
+ } catch (Throwable $ t ) {
686
+ $ message = "Exception in {$ this ->name }:: {$ afterClassMethod }" . PHP_EOL . $ t ->getMessage ();
687
+ $ error = new SyntheticError ($ message , 0 , $ t ->getFile (), $ t ->getLine (), $ t ->getTrace ());
689
688
690
- $ placeholderTest = clone $ test ;
691
- $ placeholderTest ->setName ($ afterClassMethod );
689
+ $ placeholderTest = clone $ test ;
690
+ $ placeholderTest ->setName ($ afterClassMethod );
692
691
693
- $ result ->startTest ($ placeholderTest );
694
- $ result ->addFailure ($ placeholderTest , $ error , 0 );
695
- $ result ->endTest ($ placeholderTest , 0 );
692
+ $ result ->startTest ($ placeholderTest );
693
+ $ result ->addFailure ($ placeholderTest , $ error , 0 );
694
+ $ result ->endTest ($ placeholderTest , 0 );
695
+ }
696
696
}
697
697
}
698
698
}
0 commit comments