mirror of
				https://github.com/kevinveenbirkenbach/infinito.git
				synced 2025-11-03 18:58:01 +00:00 
			
		
		
		
	Added DefaultController
This commit is contained in:
		
							
								
								
									
										30
									
								
								application/src/Controller/DefaultController.php
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										30
									
								
								application/src/Controller/DefaultController.php
									
									
									
									
									
										Normal 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!");
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
							
								
								
									
										17
									
								
								application/src/Controller/DefaultControllerInterface.php
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										17
									
								
								application/src/Controller/DefaultControllerInterface.php
									
									
									
									
									
										Normal 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;
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
							
								
								
									
										27
									
								
								application/src/Controller/DefaultControllerTest.php
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										27
									
								
								application/src/Controller/DefaultControllerTest.php
									
									
									
									
									
										Normal 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());
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		Reference in New Issue
	
	Block a user