feat: Ajoute HomeController et son test

This commit is contained in:
Serreau Jovann
2025-07-16 11:38:46 +02:00
parent 0b7f9cca89
commit 693397d03c
3 changed files with 43 additions and 0 deletions

View File

@@ -41,6 +41,8 @@
<include>
<directory>src</directory>
</include>
<exclude>
</exclude>
<deprecationTrigger>

View File

@@ -0,0 +1,18 @@
<?php
namespace App\Controller;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\Component\HttpFoundation\JsonResponse;
use Symfony\Component\Routing\Attribute\Route;
class HomeController extends AbstractController
{
#[Route(path: '/',name: 'toot',methods: 'GET')]
public function index(): JsonResponse
{
return$this->json([]);
}
}

View File

@@ -0,0 +1,23 @@
<?php
declare(strict_types=1);
namespace App\Tests\Controller;
use Symfony\Bundle\FrameworkBundle\Test\WebTestCase;
class HomeControllerTest extends WebTestCase
{
public function testIndex(): void
{
$client = static::createClient();
// Request a specific page
$crawler = $client->request('GET', '/');
// Validate a successful response and some content
$this->assertResponseIsSuccessful();
$this->assertResponseHeaderSame('Content-Type', 'application/json');
}
}