Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 2 additions & 15 deletions tests/Maker/MakeRegistrationFormTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,22 +34,9 @@ private function createRegistrationFormTest(): MakerTestDetails
);

if (60000 > $runner->getSymfonyVersion()) {
/*
* @Legacy - Drop when Symfony 6.0 is LTS
*
* This is a round about way to handle empty yaml files and YamlSourceManipulator.
* Prior to Symfony 6.0, the routes.yaml was empty w/ a comment line. YSM
* requires a top level array structure to manipulate them.
*/
$runner->writeFile('config/routes.yaml', 'app_homepage:');
// @legacy - In 5.4 tests, we need to tell Symfony to look for the route attributes in `src/Controller`
$runner->copy('router-annotations.yaml', 'config/routes/annotations.yaml');
}

$runner->modifyYamlFile('config/routes.yaml', function (array $yaml) {
$yaml['app_homepage'] = ['path' => '/', 'controller' => 'App\Controller\TestingController::homepage'];
$yaml['app_anonymous'] = ['path' => '/anonymous', 'controller' => 'App\Controller\TestingController::anonymous'];

return $yaml;
});
})
;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,19 @@

use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\Routing\Annotation\Route;

class TestingController extends AbstractController
{
#[Route(path: '/', name: 'app_homepage')]
public function homepage()
{
$this->denyAccessUnlessGranted('ROLE_USER');

return new Response('Page Success');
}

#[Route(path: '/anonymous', name: 'app_anonymous')]
public function anonymous()
{
return new Response('Page Success');
Expand Down