'Php, reflection, how to remove "final" declaration?

I want to test a class which is declared:

"final class testme"

and cannot be mocked. How to remove the "final" keyword with reflections?



Solution 1:[1]

Yea, got the solution.

https://tomasvotruba.com/blog/2019/03/28/how-to-mock-final-classes-in-phpunit/

there is a "wrapper" to load php files and remove "final" in the meantime.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 John Smith