Skip to content

Commit 9874c77

Browse files
Merge branch '6.2' into 6.3
* 6.2: [Routing] Fix testMissingPrefixLocale and testMissingRouteLocale
2 parents 1b7c668 + 1e54cc8 commit 9874c77

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+
namespace Symfony\Component\Routing\Tests\Fixtures\AttributeFixtures;
4+
5+
use Symfony\Component\Routing\Annotation\Route;
6+
7+
#[Route(path: ['nl' => '/nl'])]
8+
class LocalizedPrefixMissingLocaleActionController
9+
{
10+
#[Route(path: ['nl' => '/actie', 'en' => '/action'], name: 'action')]
11+
public function action()
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+
namespace Symfony\Component\Routing\Tests\Fixtures\AttributeFixtures;
4+
5+
use Symfony\Component\Routing\Annotation\Route;
6+
7+
#[Route(path: ['nl' => '/nl', 'en' => '/en'])]
8+
class LocalizedPrefixMissingRouteLocaleActionController
9+
{
10+
#[Route(path: ['nl' => '/actie'], name: 'action')]
11+
public function action()
12+
{
13+
}
14+
}

Tests/Loader/AnnotationClassLoaderTestCase.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -200,12 +200,14 @@ public function testInvokableClassMultipleRouteLoad()
200200
public function testMissingPrefixLocale()
201201
{
202202
$this->expectException(\LogicException::class);
203+
$this->expectExceptionMessage(sprintf('Route to "action" with locale "en" is missing a corresponding prefix in class "%s\LocalizedPrefixMissingLocaleActionController".', $this->getNamespace()));
203204
$this->loader->load($this->getNamespace().'\LocalizedPrefixMissingLocaleActionController');
204205
}
205206

206207
public function testMissingRouteLocale()
207208
{
208209
$this->expectException(\LogicException::class);
210+
$this->expectExceptionMessage(sprintf('Route to "%s\LocalizedPrefixMissingRouteLocaleActionController::action" is missing paths for locale(s) "en".', $this->getNamespace()));
209211
$this->loader->load($this->getNamespace().'\LocalizedPrefixMissingRouteLocaleActionController');
210212
}
211213

0 commit comments

Comments
 (0)