We have moved our forum to GitHub Discussions. For questions about Phalcon v3/v4/v5 you can visit here and for Phalcon v6 here.

How to call Phalcon route/controller from unit test

In Laravel (which I got used to use) it's quite easy to test endpoints with built in methods like $response = $this->route('POST', 'route_name', $data);. This calls a particular route (controller) with some set of GET/POST data. I wonder how to do the same thing in Phalcon.

I need to test API endpoints - call it with particular set of (POST) arguments and check the response. Ideally I would use just default Phalcon and PHPunit features without installing any extensions.

I think a simple, you can make

$_POST[''name"]="test";

and call controller or create a Command Line