有人告诉我,我们还必须测试 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.'));
}
}
}
谢谢