Added DefaultController

This commit is contained in:
Kevin Frantz 2018-09-05 09:11:08 +02:00
parent 24e2ac8a34
commit edb60f395c
3 changed files with 74 additions and 0 deletions

View File

@ -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!");
}
}

View File

@ -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;
}

View File

@ -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());
}
}