Access the full course ➤ [ Ссылка ]
As we just saw, if you have a method that's calling a static method in another class, you can't test this class in isolation because you can't stub the method call.
The easiest way to overcome this problem is to simply change the static method into an instance one. You can of course only do this if you have full control of the code - if you're using a class you have no control over, for example in a third-party library, then this won't be possible.
In this video we'll see how we can test a dependency using PHPUnit by refactoring code to remove a static method.
Ещё видео!