Thanks to visit codestin.com
Credit goes to github.com

Skip to content
This repository was archived by the owner on Nov 27, 2020. It is now read-only.

Added a new AppBundle to comply with Symfony Best Practices #728

Closed
wants to merge 5 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions app/AppKernel.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ public function registerBundles()
new Symfony\Bundle\AsseticBundle\AsseticBundle(),
new Doctrine\Bundle\DoctrineBundle\DoctrineBundle(),
new Sensio\Bundle\FrameworkExtraBundle\SensioFrameworkExtraBundle(),
new AppBundle\AppBundle(),
);

if (in_array($this->getEnvironment(), array('dev', 'test'))) {
Expand Down
5 changes: 5 additions & 0 deletions app/Resources/views/default/index.html.twig
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{% extends 'base.html.twig' %}

{% block body %}
Homepage.
{% endblock %}
2 changes: 1 addition & 1 deletion app/config/config_dev.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ monolog:
# level: info

assetic:
use_controller: "%use_assetic_controller%"
use_controller: true

#swiftmailer:
# delivery_address: [email protected]
3 changes: 3 additions & 0 deletions app/config/routing.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
app:
resource: @AppBundle/Controller/
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should be "@AppBundle/Controller/"

type: annotation
9 changes: 9 additions & 0 deletions src/AppBundle/AppBundle.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<?php

namespace AppBundle;

use Symfony\Component\HttpKernel\Bundle\Bundle;

class AppBundle extends Bundle
{
}
17 changes: 17 additions & 0 deletions src/AppBundle/Controller/DefaultController.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<?php

namespace AppBundle\Controller;

use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route;
use Symfony\Bundle\FrameworkBundle\Controller\Controller;

class DefaultController extends Controller
{
/**
* @Route("/", name="homepage")
*/
public function indexAction()
{
return $this->render('default/index.html.twig');
}
}
17 changes: 17 additions & 0 deletions src/AppBundle/Tests/Controller/DefaultControllerTest.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<?php

namespace AppBundle\Tests\Controller;

use Symfony\Bundle\FrameworkBundle\Test\WebTestCase;

class DefaultControllerTest extends WebTestCase
{
public function testIndex()
{
$client = static::createClient();

$crawler = $client->request('GET', '/');

$this->assertTrue($crawler->filter('html:contains("Homepage")')->count() > 0);
}
}