我正在使用phpunit测试php代码,我遇到了一个问题:
我正在测试课程:
class ClassName
{
public function MethodName()
{
// something
$objectName = new Object();
$variableName = $objectName->execute();
// something
}
}
Run Code Online (Sandbox Code Playgroud)
我想创建对象的模拟.我不想调用实际方法execute().我不知道怎么用phpunit.我知道依赖注入,但恕我直言这种情况并没有通过依赖注入来解决.
谢谢你的回答.我很抱歉我的英语.