I have been told that we have to test also the functions created by Cake like add/delete...
If i have a function like this one, how can i test it if it doesn't have any return, redirect or even a view? ( i use ajax to execute it)
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.'));
}
}
}
Thanks
Here's a sort of generic way to test it.