Skip to content

Commit 6ee334d

Browse files
authored
[make:authenticator] doctrine/annotations not needed in tests (#1263)
1 parent 97f9fa5 commit 6ee334d

File tree

2 files changed

+14
-2
lines changed

2 files changed

+14
-2
lines changed

tests/Maker/MakeAuthenticatorTest.php

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,7 @@ public function getTestDetails(): \Generator
164164
];
165165

166166
yield 'auth_login_form_no_entity_custom_username_field' => [$this->createMakerTest()
167-
->addExtraDependencies('doctrine/annotations', 'twig', 'symfony/form')
167+
->addExtraDependencies('twig', 'symfony/form')
168168
->run(function (MakerTestRunner $runner) {
169169
$this->makeUser($runner, 'userEmail', false);
170170

@@ -193,7 +193,7 @@ public function getTestDetails(): \Generator
193193
];
194194

195195
yield 'auth_login_form_user_not_entity_with_hasher' => [$this->createMakerTest()
196-
->addExtraDependencies('doctrine/annotations', 'twig', 'symfony/form')
196+
->addExtraDependencies('twig', 'symfony/form')
197197
->run(function (MakerTestRunner $runner) {
198198
$this->makeUser($runner, 'email', false);
199199

@@ -282,6 +282,11 @@ private function runLoginTest(MakerTestRunner $runner, string $userIdentifier, b
282282
]
283283
);
284284

285+
// @legacy - In 5.4 tests, we need to tell Symfony to look for route attributes in `src/Controller`
286+
if ('60000' > $runner->getSymfonyVersion()) {
287+
$runner->copy('make-auth/annotations.yaml', 'config/routes/annotations.yaml');
288+
}
289+
285290
// plaintext password: needed for entities, simplifies overall
286291
$runner->modifyYamlFile('config/packages/security.yaml', function (array $config) {
287292
if (isset($config['when@test']['security']['password_hashers'])) {
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
controllers:
2+
resource: ../../src/Controller/
3+
type: annotation
4+
5+
kernel:
6+
resource: ../../src/Kernel.php
7+
type: annotation

0 commit comments

Comments
 (0)