Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[POC][WIP] scaffolding system #1088

Draft
wants to merge 2 commits into
base: main
Choose a base branch
from
Draft
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
8 changes: 8 additions & 0 deletions kbond/homepage-scaffold/0.1/config/packages/twig.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
twig:
default_path: '%kernel.project_dir%/templates'
form_themes:
- bootstrap_5_layout.html.twig

when@test:
twig:
strict_variables: true
8 changes: 8 additions & 0 deletions kbond/homepage-scaffold/0.1/manifest.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"copy-from-recipe": {
"config/": "config/",
"src/": "src/",
"templates/": "templates/",
"tests/": "tests/"
}
}
16 changes: 16 additions & 0 deletions kbond/homepage-scaffold/0.1/src/Controller/HomepageController.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<?php

namespace App\Controller;

use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\Routing\Annotation\Route;

class HomepageController extends AbstractController
{
#[Route('/', name: 'homepage')]
public function __invoke(): Response
{
return $this->render('homepage.html.twig');
}
}
15 changes: 15 additions & 0 deletions kbond/homepage-scaffold/0.1/templates/homepage.html.twig
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{% extends 'base.html.twig' %}

{% block title %}Home{% endblock %}

{% block body %}
<h1>Home</h1>

{% for type, messages in app.flashes %}
{% for message in messages %}
<div class="alert alert-{{ type|replace({error: 'danger'}) }}">
{{ message }}
</div>
{% endfor %}
{% endfor %}
{% endblock %}
19 changes: 19 additions & 0 deletions kbond/homepage-scaffold/0.1/tests/Functional/HomepageTest.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
<?php

namespace App\Tests\Functional;

use Symfony\Bundle\FrameworkBundle\Test\KernelTestCase;
use Zenstruck\Browser\Test\HasBrowser;

class HomepageTest extends KernelTestCase
{
use HasBrowser;

public function testVisitHomepage(): void
{
$this->browser()
->visit('/')
->assertSuccessful()
;
}
}