rectorphp / rector-phpunit

Rector upgrade rules for PHPUnit
http://getrector.com
MIT License
61 stars 46 forks source link

[PhpUnit60] Handle before stmt execute to test on DelegateExceptionArgumentsRector #298

Closed samsonasik closed 6 months ago

samsonasik commented 6 months ago

It currently add expectExceptionMessage() after test part, it should be immediate after expectException()

There was 1 failure:

1) Rector\PHPUnit\Tests\PHPUnit60\Rector\MethodCall\DelegateExceptionArgumentsRector\DelegateExceptionArgumentsRectorTest::test with data set #1
Failed on fixture file "before_test_stmt.php.inc"
Failed asserting that string matches format description.
--- Expected
+++ Actual
@@ @@
     public function test()
     {
         $this->expectException('SecondException');
+        $this->execute();
         $this->expectExceptionMessage($message);
-        $this->execute();
     }

     private function execute()

Ref https://getrector.com/demo/d1033af1-10a9-4406-ab5e-775bef099e4f

samsonasik commented 6 months ago

Fixed 🎉

samsonasik commented 6 months ago

All checks have passed 🎉 @TomasVotruba I am merging it ;)