Skip to content

Commit 1e54cc8

Browse files
Merge branch '5.4' into 6.2
* 5.4: [Routing] Fix testMissingPrefixLocale and testMissingRouteLocale
2 parents b1fd2e9 + 853fc7d commit 1e54cc8

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
@@ -198,12 +198,14 @@ public function testInvokableClassMultipleRouteLoad()
198198
public function testMissingPrefixLocale()
199199
{
200200
$this->expectException(\LogicException::class);
201+
$this->expectExceptionMessage(sprintf('Route to "action" with locale "en" is missing a corresponding prefix in class "%s\LocalizedPrefixMissingLocaleActionController".', $this->getNamespace()));
201202
$this->loader->load($this->getNamespace().'\LocalizedPrefixMissingLocaleActionController');
202203
}
203204

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

0 commit comments

Comments
 (0)