0

In php, there are many aop packages that generate proxy classes to replace the original classes in the composer class map. I'm not sure how to properly generate a code coverage report if this is the case. Can someone please tell me?

I tried to load the proxy class path inside phpunit.xml as well. This generates the proxy class report. But it doesn't make any sense.

If you can, please let me know how to generate the code coverage report correctly in this case. Much appreciated.

The code is here.mineadmin

I am sorry for the unclear description earlier. Here is an example: I have a commonController controller. In this controller, I use the Inject annotation provided by the Hyperf framework. When using this annotation, Hyperf generates a commonController.proxy.php file to automatically inject instances annotated with Inject. The generated proxy file is located in runtime/container/proxy directory. The issue I am facing is that when running unit tests for code coverage report, it actually uses commonController.proxy.php instead of commonController.php. This results in code coverage detection for commonController.php not being accurate. This is frustrating because I want the correct coverage report for automation processes to accurately measure the actual coverage.

5
  • what have you tried, what errors are you getting. Commented Feb 29, 2024 at 5:59
  • I tried to configure the proxy class directory inside phpunit.xml in an attempt to gather a code coverage report for the original class, but the actual report generated is for the proxy class directory in the Commented Feb 29, 2024 at 6:04
  • I apologize for the confusion. What I am looking for is to have coverage reports collected for the original classes in the code coverage report, rather than for the proxy classes. Commented Feb 29, 2024 at 6:08
  • Please share more details, like the code involved. What do you mean by "it doesn't make any sense"? Are you facing any specific problem? Commented Feb 29, 2024 at 8:42
  • I'm sorry, my description was not clear enough. I have revised my question. Commented Feb 29, 2024 at 9:01

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.