/**
  * Gets all routes for controller.
  *
  * @return array
  */
 public function getRelatedRoutes()
 {
     $annotatedControllerRouteLoader = new AnnotatedRouteControllerLoader(new AnnotationReader());
     $routeCollection = $annotatedControllerRouteLoader->load(get_class($this));
     $routes = [];
     foreach ($routeCollection->all() as $routeName => $routeDetails) {
         $explodedController = explode(':', $routeDetails->getDefaults()['_controller']);
         $routes[str_replace('Action', '', $explodedController[count($explodedController) - 1])] = $routeName;
     }
     return $routes;
 }
 public function testLoad()
 {
     $loader = new AnnotatedRouteControllerLoader(new AnnotationReader());
     AnnotationRegistry::registerLoader('class_exists');
     $rc = $loader->load('Sensio\\Bundle\\FrameworkExtraBundle\\Tests\\Routing\\Fixtures\\FoobarController');
     $this->assertInstanceOf('Symfony\\Component\\Routing\\RouteCollection', $rc);
     $this->assertCount(2, $rc);
     $this->assertInstanceOf('Symfony\\Component\\Routing\\Route', $rc->get('index'));
     $this->assertEquals(array('GET'), $rc->get('index')->getMethods());
     $this->assertInstanceOf('Symfony\\Component\\Routing\\Route', $rc->get('new'));
     $this->assertEquals(array('POST'), $rc->get('new')->getMethods());
 }
 public function testLoad()
 {
     $loader = new AnnotatedRouteControllerLoader(new AnnotationReader());
     AnnotationRegistry::registerLoader('class_exists');
     $rc = $loader->load('Sensio\\Bundle\\FrameworkExtraBundle\\Tests\\Routing\\Fixtures\\FoobarController');
     $this->assertInstanceOf('Symfony\\Component\\Routing\\RouteCollection', $rc);
     $this->assertCount(2, $rc);
     $this->assertInstanceOf('Symfony\\Component\\Routing\\Route', $rc->get('index'));
     // depending on the Symfony version, it can return GET or an empty array (on 2.3)
     // which has the same behavior anyway
     $methods = $rc->get('index')->getMethods();
     $this->assertTrue(empty($methods) || array('GET') == $methods);
     $this->assertInstanceOf('Symfony\\Component\\Routing\\Route', $rc->get('new'));
     $this->assertEquals(array('POST'), $rc->get('new')->getMethods());
 }