【发布时间】:2014-03-15 23:30:01
【问题描述】:
我是测试的初学者。 有一个应用程序。使用 singelton(方法 A :: getMainApp () 将返回到应用程序)。 在测试类中有一个方法:
protected function endApp ()
{
$ logger = new MainLogger ();
$ logger-> log ();
$ this-> response-> send ();
exit ( 0);
}
此方法使用两个类(MainLogger、ResponseManager ($ this-> response)),而后者甚至可能使用其他类。
在这个测试中,我不需要“模拟和创建”所有必需的类吗?
我基本上需要测试所谓的log (), response-> send () and exit ( 0) 他们的结果我会检查我何时分别测试每个类以及何时在“浏览器级别”测试应用程序对吗?
如何验证该方法以正确的顺序准确地诱导出所需的功能? 我知道我不能使用模拟对象,因为我使用单格?
谢谢。
【问题讨论】: