From 66f1326dca20caccdd61e6568be085619ce6ccad Mon Sep 17 00:00:00 2001 From: Polonkai Gergely Date: Fri, 13 Apr 2012 19:50:37 +0000 Subject: [PATCH] Created the InfoBundle for informational pages Signed-off-by: Gergely POLONKAI (W00d5t0ck) --- app/AppKernel.php | 1 + app/config/routing.yml | 4 +++ .../Controller/DefaultController.php | 15 ++++++++++ .../DependencyInjection/Configuration.php | 29 +++++++++++++++++++ .../OpenScrumInfoExtension.php | 28 ++++++++++++++++++ .../InfoBundle/OpenScrumInfoBundle.php | 9 ++++++ .../InfoBundle/Resources/config/routing.yml | 3 ++ .../InfoBundle/Resources/config/services.yml | 7 +++++ .../Resources/views/Default/index.html.twig | 1 + .../Controller/DefaultControllerTest.php | 17 +++++++++++ 10 files changed, 114 insertions(+) create mode 100644 src/OpenScrum/InfoBundle/Controller/DefaultController.php create mode 100644 src/OpenScrum/InfoBundle/DependencyInjection/Configuration.php create mode 100644 src/OpenScrum/InfoBundle/DependencyInjection/OpenScrumInfoExtension.php create mode 100644 src/OpenScrum/InfoBundle/OpenScrumInfoBundle.php create mode 100644 src/OpenScrum/InfoBundle/Resources/config/routing.yml create mode 100644 src/OpenScrum/InfoBundle/Resources/config/services.yml create mode 100644 src/OpenScrum/InfoBundle/Resources/views/Default/index.html.twig create mode 100644 src/OpenScrum/InfoBundle/Tests/Controller/DefaultControllerTest.php diff --git a/app/AppKernel.php b/app/AppKernel.php index cecead7..78e546d 100644 --- a/app/AppKernel.php +++ b/app/AppKernel.php @@ -17,6 +17,7 @@ class AppKernel extends Kernel new Symfony\Bundle\AsseticBundle\AsseticBundle(), new Sensio\Bundle\FrameworkExtraBundle\SensioFrameworkExtraBundle(), new JMS\SecurityExtraBundle\JMSSecurityExtraBundle(), + new OpenScrum\InfoBundle\OpenScrumInfoBundle(), ); if (in_array($this->getEnvironment(), array('dev', 'test'))) { diff --git a/app/config/routing.yml b/app/config/routing.yml index 8b4740a..674dbdc 100644 --- a/app/config/routing.yml +++ b/app/config/routing.yml @@ -1,3 +1,7 @@ +OpenScrumInfoBundle: + resource: "@OpenScrumInfoBundle/Resources/config/routing.yml" + prefix: / + # Internal routing configuration to handle ESI #_internal: # resource: "@FrameworkBundle/Resources/config/routing/internal.xml" diff --git a/src/OpenScrum/InfoBundle/Controller/DefaultController.php b/src/OpenScrum/InfoBundle/Controller/DefaultController.php new file mode 100644 index 0000000..ef60b01 --- /dev/null +++ b/src/OpenScrum/InfoBundle/Controller/DefaultController.php @@ -0,0 +1,15 @@ +render('OpenScrumInfoBundle:Default:index.html.twig', array('name' => $name)); + } +} diff --git a/src/OpenScrum/InfoBundle/DependencyInjection/Configuration.php b/src/OpenScrum/InfoBundle/DependencyInjection/Configuration.php new file mode 100644 index 0000000..38d8f5c --- /dev/null +++ b/src/OpenScrum/InfoBundle/DependencyInjection/Configuration.php @@ -0,0 +1,29 @@ +root('open_scrum_info'); + + // Here you should define the parameters that are allowed to + // configure your bundle. See the documentation linked above for + // more information on that topic. + + return $treeBuilder; + } +} diff --git a/src/OpenScrum/InfoBundle/DependencyInjection/OpenScrumInfoExtension.php b/src/OpenScrum/InfoBundle/DependencyInjection/OpenScrumInfoExtension.php new file mode 100644 index 0000000..7bdc0b2 --- /dev/null +++ b/src/OpenScrum/InfoBundle/DependencyInjection/OpenScrumInfoExtension.php @@ -0,0 +1,28 @@ +processConfiguration($configuration, $configs); + + $loader = new Loader\YamlFileLoader($container, new FileLocator(__DIR__.'/../Resources/config')); + $loader->load('services.yml'); + } +} diff --git a/src/OpenScrum/InfoBundle/OpenScrumInfoBundle.php b/src/OpenScrum/InfoBundle/OpenScrumInfoBundle.php new file mode 100644 index 0000000..b6dc719 --- /dev/null +++ b/src/OpenScrum/InfoBundle/OpenScrumInfoBundle.php @@ -0,0 +1,9 @@ +request('GET', '/hello/Fabien'); + + $this->assertTrue($crawler->filter('html:contains("Hello Fabien")')->count() > 0); + } +}