Skip to content

Commit fa8284c

Browse files
committed
add homepage scaffold recipe
1 parent 5ece69c commit fa8284c

File tree

4 files changed

+57
-0
lines changed

4 files changed

+57
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"copy-from-recipe": {
3+
"src/": "src/",
4+
"templates/": "templates/",
5+
"tests/": "tests/"
6+
}
7+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
<?php
2+
3+
namespace App\Controller;
4+
5+
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
6+
use Symfony\Component\HttpFoundation\Response;
7+
use Symfony\Component\Routing\Annotation\Route;
8+
9+
class HomepageController extends AbstractController
10+
{
11+
#[Route('/', name: 'homepage')]
12+
public function __invoke(): Response
13+
{
14+
return $this->render('homepage.html.twig');
15+
}
16+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
{% extends 'base.html.twig' %}
2+
3+
{% block title %}Home{% endblock %}
4+
5+
{% block body %}
6+
<h1>Home</h1>
7+
8+
{% for type, messages in app.flashes %}
9+
{% for message in messages %}
10+
<div class="alert alert-{{ type|replace({error: 'danger'}) }}">
11+
{{ message }}
12+
</div>
13+
{% endfor %}
14+
{% endfor %}
15+
{% endblock %}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
<?php
2+
3+
namespace App\Tests\Functional;
4+
5+
use Symfony\Bundle\FrameworkBundle\Test\KernelTestCase;
6+
use Zenstruck\Browser\Test\HasBrowser;
7+
8+
class HomepageTest extends KernelTestCase
9+
{
10+
use HasBrowser;
11+
12+
public function testVisitHomepage(): void
13+
{
14+
$this->browser()
15+
->visit('/')
16+
->assertSuccessful()
17+
;
18+
}
19+
}

0 commit comments

Comments
 (0)