Discussing how to BDD Symfony2 Router+URL Mapper

I got a response but still roughly thanks to Marcin Sikon
hmm, maybe this:

$container->get('router')->match('/review')
// result of this function is false or array with '_controller' and '_route',
 
_controller looks like 'Acme\Bundles\DemoBundle\Controller\DefaultController::indexAction'

now you must parse this string for get action and bundle name …

is there a way to have it already parsed through some component…
from kernel $container->get(‘kernel’) get registerBundles and find bundle matching to bundle namespace
any more ideas? anyone?

I got another response from Dmitry Bykadorov:

Finally I’m using this solution:

       $serviceContainer = self::$kernel->getContainer();
       $router = $serviceContainer->get('router');
       $crawler = $client->request('GET', $router-
>generate('admin_blogpost'));

– “Now I’m tesing both controller & routing )”

So in view of this we can do:

Leave a Reply

Your email address will not be published. Required fields are marked *