Hi all! i'm back again.
I'm having trouble in understanding where and when the $this->response in a controller is populated.
My question come up from the development of unit-tests. Actually in the setup method (run before each test case), i instantiate a NEW app passing to it a new DI container where i force the 'response' object to reset with this cose
$di=DI::getDefault(); $resp=new \Phalcon\Http\Response(); $di->remove("response"); $di->setShared("response", $resp);
and infact this work as in the debugger, when i'm in an action method, i see that response object is empty... but just can't understand why $this->response contain the response returned by the previous test case...
i'm pretty sure the Phalcon Application object that execute the action method is brand new as the first lines of my test case is the following
$app=new Application($this->getDI()); $resp=$app->handle("/controller1/action1"); $cont=$resp->getContent();
where getDI return the $di object just resetted by the setup method.