Here is my RouterTest.php
It is extends from 'UnitTestCase' phalcon provided.
class RouterTest extends UnitTestCase
{
protected function setUp()
{
parent::setUp();
$config = $this->config;
$this->di->set(
'router',
function() use ($config) {
require_once __DIR__.'/../../app/core/router.php';
return $router;
}
);
$this->di->set(
'request',
function(){
return new Request();
}
);
}
/**
* @dataProvider providerTestRouter
*/
public function testRouter($method, $uri, $module, $controller, $action, $params)
{
$router = $this->di->get('router');
$router->handle($uri);
$_SERVER['REQUEST_METHOD'] = $method;
$this->assertEquals($router->getModuleName(), $module);
$this->assertEquals($router->getControllerName(), $controller);
$this->assertEquals($router->getActionName(), $action);
$this->assertEquals($router->getparams(), $params);
}