Skip to content

[Bug] 1.3.0 - adding routes to micro collection #1520

Closed
@Cinderella-Man

Description

@Cinderella-Man

Hi,

When adding routes to micro collection, object implementing RouteInterface should be returned but instead of that method returns collection object.

Testcase:

$handler = new RestHandler($this);
$app = new \Phalcon\Mvc\Micro();

$collection = new \Phalcon\Mvc\Micro\Collection();
$collection->setHandler($handler);

$collection->get('/api/siteA', 'find');
$collection->post('/api/siteB', 'save')->setName ('saveRoute');

$app->mount($collection);

$_SERVER['REQUEST_METHOD'] = 'GET';
$_GET['_url'] = '/api/siteA';

$app->handle();

$this->assertTrue($app->getRouter()->wasMatched());
$this->assertEquals(null, $app->getRouter()->getMatchedRoute()->getName());

$_SERVER['REQUEST_METHOD'] = 'POST';
$_GET['_url'] = '/api/siteB';

$app->handle();

$this->assertTrue($app->getRouter()->wasMatched());
$this->assertEquals('saveRoute', $app->getRouter()->getMatchedRoute()->getName());

Thanks in advance for fixing that,

Kamil

Metadata

Metadata

Assignees

No one assigned

    Labels

    not a bugReported issue is not a bug

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions