mirror of
https://github.com/kevinveenbirkenbach/infinito.git
synced 2026-10-30 09:12:09 +00:00
Added DefaultController
This commit is contained in:
1 parent
24e2ac8a34
commit
edb60f395c
3 files changed
+74
No files matched your search
@@ -0,0 +1,30 @@
|
|||||||
|
<?php
|
||||||
|
namespace App\Controller;
|
||||||
|
|
||||||
|
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
|
||||||
|
use Symfony\Component\Routing\Annotation\Route;
|
||||||
|
use Symfony\Component\HttpFoundation\Response;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author kevinfrantz
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
class DefaultController extends AbstractController implements DefaultControllerInterface
|
||||||
|
{
|
||||||
|
public function imprint(): Response
|
||||||
|
{
|
||||||
|
return new Response("Hello World!");
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Matches /
|
||||||
|
*
|
||||||
|
* @Route("/", name="homepage")
|
||||||
|
*/
|
||||||
|
public function homepage(): Response
|
||||||
|
{
|
||||||
|
return new Response("Hello World!");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@@ -0,0 +1,17 @@
|
|||||||
|
<?php
|
||||||
|
namespace App\Controller;
|
||||||
|
|
||||||
|
use Symfony\Component\HttpFoundation\Response;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author kevinfrantz
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
interface DefaultControllerInterface
|
||||||
|
{
|
||||||
|
public function homepage():Response;
|
||||||
|
|
||||||
|
public function imprint():Response;
|
||||||
|
}
|
||||||
|
|
||||||
@@ -0,0 +1,27 @@
|
|||||||
|
<?php
|
||||||
|
namespace App\Controller;
|
||||||
|
|
||||||
|
use PHPUnit\Framework\TestCase;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author kevinfrantz
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
class DefaultControllerTest extends TestCase
|
||||||
|
{
|
||||||
|
protected $defaultController;
|
||||||
|
|
||||||
|
public function setUp():void{
|
||||||
|
$this->defaultController = new DefaultController();
|
||||||
|
}
|
||||||
|
|
||||||
|
public function testHomepage():void{
|
||||||
|
$this->assertEquals(true, $this->defaultController->homepage()->isSuccessful());
|
||||||
|
}
|
||||||
|
|
||||||
|
public function testImprint():void{
|
||||||
|
$this->assertEquals(true, $this->defaultController->imprint()->isSuccessful());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
Reference in new issue
Block a user