【发布时间】:2012-04-16 11:48:44
【问题描述】:
有人告诉我,我们还必须测试 Cake 创建的函数,例如添加/删除...
如果我有这样的功能,如果它没有任何返回、重定向甚至视图,我该如何测试它? (我使用ajax来执行)
public function add() {
if ($this->request->is('post')) {
$this->Comment->create();
if ($this->Comment->save($this->request->data)) {
$this->Session->setFlash(__('The comment has been saved'));
} else {
$this->Session->setFlash(__('The comment could not be saved. Please, try again.'));
}
}
}
谢谢
【问题讨论】:
标签: unit-testing cakephp testing cakephp-2.0 add