Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit8b82019

Browse files
minor#51084 [Routing] FixtestMissingPrefixLocale andtestMissingRouteLocale (derrabus)
This PR was merged into the 5.4 branch.Discussion----------[Routing] Fix `testMissingPrefixLocale` and `testMissingRouteLocale`| Q | A| ------------- | ---| Branch? | 5.4| Bug fix? | yes| New feature? | no| Deprecations? | no| Tickets |#51082 (comment)| License | MIT| Doc PR | not neededThose two fixtures only exist as annotation versions. Their attribute counterparts were missing.The corresponding tests only expected a `LogicException` which is what `AnnotationClassLoader` would raise for undefined classes as well.This PR adds new assertions for the exception messages which would have discovered the missing fixtures. Finally, the two missing fixtures are added.Commits-------6ba9864 [Routing] Fix testMissingPrefixLocale and testMissingRouteLocale
2 parents0bc39e8 +6ba9864 commit8b82019

File tree

3 files changed

+30
-0
lines changed

3 files changed

+30
-0
lines changed
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
<?php
2+
3+
namespaceSymfony\Component\Routing\Tests\Fixtures\AttributeFixtures;
4+
5+
useSymfony\Component\Routing\Annotation\Route;
6+
7+
#[Route(path: ['nl' =>'/nl'])]
8+
class LocalizedPrefixMissingLocaleActionController
9+
{
10+
#[Route(path: ['nl' =>'/actie','en' =>'/action'], name:'action')]
11+
publicfunctionaction()
12+
{
13+
}
14+
}
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
<?php
2+
3+
namespaceSymfony\Component\Routing\Tests\Fixtures\AttributeFixtures;
4+
5+
useSymfony\Component\Routing\Annotation\Route;
6+
7+
#[Route(path: ['nl' =>'/nl','en' =>'/en'])]
8+
class LocalizedPrefixMissingRouteLocaleActionController
9+
{
10+
#[Route(path: ['nl' =>'/actie'], name:'action')]
11+
publicfunctionaction()
12+
{
13+
}
14+
}

‎src/Symfony/Component/Routing/Tests/Loader/AnnotationClassLoaderTestCase.php‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -197,12 +197,14 @@ public function testInvokableClassMultipleRouteLoad()
197197
publicfunctiontestMissingPrefixLocale()
198198
{
199199
$this->expectException(\LogicException::class);
200+
$this->expectExceptionMessage(sprintf('Route to "action" with locale "en" is missing a corresponding prefix in class "%s\LocalizedPrefixMissingLocaleActionController".',$this->getNamespace()));
200201
$this->loader->load($this->getNamespace().'\LocalizedPrefixMissingLocaleActionController');
201202
}
202203

203204
publicfunctiontestMissingRouteLocale()
204205
{
205206
$this->expectException(\LogicException::class);
207+
$this->expectExceptionMessage(sprintf('Route to "%s\LocalizedPrefixMissingRouteLocaleActionController::action" is missing paths for locale(s) "en".',$this->getNamespace()));
206208
$this->loader->load($this->getNamespace().'\LocalizedPrefixMissingRouteLocaleActionController');
207209
}
208210

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp