The problem with static methods in PHP: dependencies and mocking

Опубликовано: 17 Октябрь 2024
на канале: Dave Hollingworth
4,639
68

Access the full course ➤ https://davehollingworth.net/phpunity

You'll probably come across some articles and opinions that say static methods can't be tested, and that using static methods should be avoided. The problem with static methods comes when trying to mock them. In this video we'll look at an example of why you can't stub a static method with PHPUnit.