/** * @dataProvider getAddRESTControllerTests */ public function testAddRESTController($bundle, $controller, $startingConfig, $expectedConfig) { $configurationPath = $this->tmpDir . '/routing.yml'; file_put_contents($configurationPath, $startingConfig); $manipulator = new RESTRoutingManipulator($configurationPath); $manipulator->addRESTController($bundle, $controller); $resultConfig = file_get_contents($configurationPath); $this->assertEquals($expectedConfig, $resultConfig); }
protected function updateAnnotationRouting(BundleInterface $bundle, $entity, $prefix) { $rootDir = $this->getContainer()->getParameter('kernel.root_dir'); $parts = explode('\\', $entity); $controller = array_pop($parts); $routing = new RoutingManipulator($bundle->getPath() . '/Resources/config/routing.yml'); if (!$routing->hasControllerInAnnotation($bundle->getName(), $controller)) { $ret = $routing->addRESTController($bundle->getName(), $controller); } }