Skip to content

Commit

Permalink
Merge pull request #2314 from dreamsxin/2313
Browse files Browse the repository at this point in the history
Fix #2313 about Phalcon\Annotations\Annotation
  • Loading branch information
Phalcon committed Apr 12, 2014
2 parents 305b0cf + d59c83d commit 82960cb
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 2 deletions.
2 changes: 1 addition & 1 deletion ext/mvc/router/annotations.c
Original file line number Diff line number Diff line change
Expand Up @@ -528,7 +528,7 @@ PHP_METHOD(Phalcon_Mvc_Router_Annotations, processActionAnnotation){
}

phalcon_array_update_string(&paths, ISL(controller), controller, PH_COPY);
phalcon_array_update_string(&paths, ISL(action), action_name, PH_COPY);
phalcon_array_update_string(&paths, ISL(action), real_action_name, PH_COPY);
phalcon_array_update_string(&paths, SL("\0exact"), PHALCON_GLOBAL(z_true), PH_COPY);

PHALCON_INIT_VAR(position);
Expand Down
17 changes: 16 additions & 1 deletion unit-tests/RouterMvcAnnotationsTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,14 @@ public function saveAction()

}

/**
* @Route("/delete/{id:[0-9]+}", methods={"POST", "DELETE"}, name="delete-robot")
*/
public function deleteRobotAction()
{

}

}

class ProductsController
Expand Down Expand Up @@ -100,7 +108,7 @@ public function testRouterFullResources()

$router->handle();

$this->assertEquals(count($router->getRoutes()), 6);
$this->assertEquals(count($router->getRoutes()), 7);

$route = $router->getRouteByName('save-robot');
$this->assertTrue(is_object($route));
Expand Down Expand Up @@ -160,6 +168,13 @@ public function testRouterFullResources()
'action' => 'save',
'params' => array()
),
array(
'uri' => '/robots/delete/100',
'method' => 'POST',
'controller' => 'Robots',
'action' => 'deleteRobot',
'params' => array('id' => '100')
),
);

foreach ($routes as $route) {
Expand Down

0 comments on commit 82960cb

Please sign in to comment.