Skip to content

Commit 33e698a

Browse files
committed
minor #1077 [ci] fix overriding entire route config (jrushlow)
This PR was merged into the 1.0-dev branch. Discussion ---------- [ci] fix overriding entire route config Previously we were replacing the `config/routes.yaml` file generated by recipes with our own. This broke several tests when symfony/recipes#1030 was resolved in Symfony 6. To better test against a "real" environment, we use the generated `routes.yaml` file and then append our static routes to it. Commits ------- 3a8a38a [ci] fix overriding entire route config
2 parents bff3fbb + 3a8a38a commit 33e698a

File tree

2 files changed

+18
-7
lines changed

2 files changed

+18
-7
lines changed

tests/Maker/MakeRegistrationFormTest.php

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,24 @@ private function createRegistrationFormTest(): MakerTestDetails
3333
''
3434
);
3535
$runner->adjustAuthenticatorForLegacyPassportInterface('src/Security/StubAuthenticator.php');
36+
37+
if (60000 > $runner->getSymfonyVersion()) {
38+
/*
39+
* @Legacy - Drop when Symfony 6.0 is LTS
40+
*
41+
* This is a round about way to handle empty yaml files and YamlSourceManipulator.
42+
* Prior to Symfony 6.0, the routes.yaml was empty w/ a comment line. YSM
43+
* requires a top level array structure to manipulate them.
44+
*/
45+
$runner->writeFile('config/routes.yaml', 'app_homepage:');
46+
}
47+
48+
$runner->modifyYamlFile('config/routes.yaml', function (array $yaml) {
49+
$yaml['app_homepage'] = ['path' => '/', 'controller' => 'App\Controller\TestingController::homepage'];
50+
$yaml['app_anonymous'] = ['path' => '/anonymous', 'controller' => 'App\Controller\TestingController::anonymous'];
51+
52+
return $yaml;
53+
});
3654
})
3755
;
3856
}

tests/fixtures/make-registration-form/standard_setup/config/routes.yaml

Lines changed: 0 additions & 7 deletions
This file was deleted.

0 commit comments

Comments
 (0)