diff --git a/app/Config/routes.yaml b/app/Config/routes.yaml
index e69de29..328f1d5 100644
--- a/app/Config/routes.yaml
+++ b/app/Config/routes.yaml
@@ -0,0 +1,4 @@
+home:
+ uri: /home
+ controller: Controller\HomeController
+ httpMethod: [GET]
diff --git a/app/Controller/HomeController.php b/app/Controller/HomeController.php
new file mode 100644
index 0000000..f3c5a24
--- /dev/null
+++ b/app/Controller/HomeController.php
@@ -0,0 +1,23 @@
+render('home/home.html.twig',
+ [
+ "titre" => 'HomeController',
+ "request" => $request
+ ]
+ );
+ }
+}
diff --git a/app/Template/home/home.html.twig b/app/Template/home/home.html.twig
new file mode 100644
index 0000000..60bd144
--- /dev/null
+++ b/app/Template/home/home.html.twig
@@ -0,0 +1,7 @@
+{% extends "base.html.twig" %}
+
+{% block title %}{{ titre }}{% endblock %}
+
+{% block content %}
+
{{ titre }}
+{% endblock %}
\ No newline at end of file
diff --git a/compose.yaml b/compose.yaml
index d23d92f..c2c8f27 100644
--- a/compose.yaml
+++ b/compose.yaml
@@ -10,8 +10,8 @@ services:
restart: always
environment:
MYSQL_DATABASE: app_db
- #MYSQL_ALLOW_EMPTY_PASSWORD: 'yes'
- MYSQL_ROOT_PASSWORD: root
+ MYSQL_ALLOW_EMPTY_PASSWORD: 'yes'
+ #MYSQL_ROOT_PASSWORD: root
#MYSQL_USER: app_db_user
#MYSQL_PASSWORD: app_db_password
volumes:
diff --git a/src/EduFramework/Core/Controller/Route.php b/src/EduFramework/Core/Controller/Route.php
index 7aa8f5e..0a512a8 100644
--- a/src/EduFramework/Core/Controller/Route.php
+++ b/src/EduFramework/Core/Controller/Route.php
@@ -17,24 +17,23 @@
class Route
{
-
/**
* Chemin du fichier de configuration des routes
*/
private const ROUTE_FILE_PATH = './app/Config/';
/**
- * @var array $listRoutes Tableau contenant les informations des routes
+ * @var array $listRoutes Tableau contenant les informations des routes
*/
private array $listRoutes = [];
/**
* Récupère le nom de la route et les paramètres pour renvoyer le chemin de la route
* @param string $name Nom de la route à récupérer dans le fichier config/routes.yaml
- * @param array $param Tableau associatif des paramètres de la route
+ * @param array $param Tableau associatif des paramètres de la route
* @return string URL
- * @throws ParseException
- * @throws BadRouteException
+ * @throws ParseException
+ * @throws BadRouteException
*/
public function getNameToPath(string $name, array $param = []): string
{
@@ -42,7 +41,7 @@ public function getNameToPath(string $name, array $param = []): string
$this->getRouteInfo();
}
if (array_key_exists($name, $this->listRoutes)) {
- $url = "";
+ $url = "";
foreach ($this->listRoutes[$name]["uri_parse"][0] as $uri) {
if (is_string($uri)) {
$url .= $uri;
@@ -54,14 +53,14 @@ public function getNameToPath(string $name, array $param = []): string
}
}
return $url;
- }
+ }
throw new BadRouteException("La route $name n'existe pas");
}
/**
* Renseigne et renvoi un tableau contenant les informations des route du fichier config/routes.yaml
- * @return array Tableau contenant les informations des routes
+ * @return array Tableau contenant les informations des routes
*/
public function getRouteInfo(): array
{
@@ -76,7 +75,7 @@ public function getRouteInfo(): array
/**
* Récupération du fichier config/routes.yaml
* @param string $pathConfigFile
- * @return array|bool Tableau des routes ou false si le fichier n'existe pas
+ * @return array|bool Tableau des routes ou false si le fichier n'existe pas
*/
public function loadRoute(string $pathConfigFile): array|bool
{
diff --git a/tests/Command/AppCommandTest.php b/tests/Command/AppCommandTest.php
index 7874b9f..dfb147e 100644
--- a/tests/Command/AppCommandTest.php
+++ b/tests/Command/AppCommandTest.php
@@ -17,6 +17,6 @@ public function testCommandDefault(): void
$commandeTester->execute([]);
$output = $commandeTester->getDisplay();
- $this->assertStringContainsString('Liste des commandes :', $output);
+ $this->assertStringContainsString('Liste :', $output);
}
}
diff --git a/tests/Controller/FastRouteCoreTest.php b/tests/Controller/FastRouteCoreTest.php
index ca830a9..7f08481 100644
--- a/tests/Controller/FastRouteCoreTest.php
+++ b/tests/Controller/FastRouteCoreTest.php
@@ -27,7 +27,7 @@ public function testGetDispatcher()
$_SERVER['REQUEST_METHOD'] = 'GET';
$_SERVER['REQUEST_URI'] = '/';
- $this->assertEquals('ae6360270b7dcefbf34d532945857ce80db09501', sha1($route->getRoute()));
+ $this->assertEquals('d7045e6af8910d38af6c42f0b610e51c644e5ec1', sha1($route->getRoute()));
}
public function testGetDispatcherWithExceptionNotFound()
@@ -37,7 +37,7 @@ public function testGetDispatcherWithExceptionNotFound()
$_SERVER['REQUEST_METHOD'] = 'GET';
$_SERVER['REQUEST_URI'] = '/test';
- $this->assertEquals('f2bb0fc64c96efcc763fa677baf54f160448f7c0', sha1($route->getRoute()));
+ $this->assertEquals('1ab50275de77fa6215e882b0833350c32cfcd7a2', sha1($route->getRoute()));
}
public function testGetDispatcherWithExceptionMethodNotAllowed()
@@ -47,7 +47,7 @@ public function testGetDispatcherWithExceptionMethodNotAllowed()
$_SERVER['REQUEST_METHOD'] = 'POST';
$_SERVER['REQUEST_URI'] = '/';
- $this->assertEquals('b66101b47494d181b51cf0bf2f6988e40ab2e95f', sha1($route->getRoute()));
+ $this->assertEquals('ed2ad24f02864b53319ab611d414ceac5c322751', sha1($route->getRoute()));
}
public function testGetDispatcherWithExceptionMethodNotAllowedAndNotFound()
@@ -57,7 +57,7 @@ public function testGetDispatcherWithExceptionMethodNotAllowedAndNotFound()
$_SERVER['REQUEST_METHOD'] = 'POST';
$_SERVER['REQUEST_URI'] = '/test';
- $this->assertEquals('f2bb0fc64c96efcc763fa677baf54f160448f7c0', sha1($route->getRoute()));
+ $this->assertEquals('1ab50275de77fa6215e882b0833350c32cfcd7a2', sha1($route->getRoute()));
}
public function testLoadRoutesMatchSuccess()
@@ -67,7 +67,7 @@ public function testLoadRoutesMatchSuccess()
$_SERVER['REQUEST_METHOD'] = 'GET';
$_SERVER['REQUEST_URI'] = '/';
- $this->assertEquals('ae6360270b7dcefbf34d532945857ce80db09501', sha1($route->getRoute()));
+ $this->assertEquals('d7045e6af8910d38af6c42f0b610e51c644e5ec1', sha1($route->getRoute()));
}
public function testLoadRoutesMatchSuccessWithExceptionNotFound()
@@ -77,7 +77,7 @@ public function testLoadRoutesMatchSuccessWithExceptionNotFound()
$_SERVER['REQUEST_METHOD'] = 'GET';
$_SERVER['REQUEST_URI'] = '/test';
- $this->assertEquals('f2bb0fc64c96efcc763fa677baf54f160448f7c0', sha1($route->getRoute()));
+ $this->assertEquals('1ab50275de77fa6215e882b0833350c32cfcd7a2', sha1($route->getRoute()));
}
public function testLoadRoutesMatchSuccessWithExceptionMethodNotAllowedAndNotFound()
@@ -87,6 +87,6 @@ public function testLoadRoutesMatchSuccessWithExceptionMethodNotAllowedAndNotFou
$_SERVER['REQUEST_METHOD'] = 'POST';
$_SERVER['REQUEST_URI'] = '/';
- $this->assertEquals('b66101b47494d181b51cf0bf2f6988e40ab2e95f', sha1($route->getRoute()));
+ $this->assertEquals('ed2ad24f02864b53319ab611d414ceac5c322751', sha1($route->getRoute()));
}
}