【发布时间】:2015-04-22 09:10:09
【问题描述】:
不幸的是,我在 ZF2 和单元测试中绝对为零。 我写了简单的视图助手(Zend Translate 的包装函数),现在我必须为此编写一个测试。我正在尝试在现有测试类中添加一个测试,所以一切都已配置......也许。我只需要开始使用这段代码:
public function testTranslation()
{
$result = $this->t('about');
$expected = "About";
$this->assertEquals($exp, $res);
}
我也尝试像在控制器中那样获得功能,但没有运气:
$t = $this->getServiceLocator()->get('ViewHelperManager')->get('t');
$result = $t('about');
有什么帮助吗?
【问题讨论】:
标签: unit-testing zend-framework2 phpunit