Skip to content

Commit

Permalink
Merge branch '6.2' into 6.3
Browse files Browse the repository at this point in the history
* 6.2:
  [Routing] Fix testMissingPrefixLocale and testMissingRouteLocale
  • Loading branch information
nicolas-grekas committed Jul 24, 2023
2 parents 1b7c668 + 1e54cc8 commit 9874c77
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<?php

namespace Symfony\Component\Routing\Tests\Fixtures\AttributeFixtures;

use Symfony\Component\Routing\Annotation\Route;

#[Route(path: ['nl' => '/nl'])]
class LocalizedPrefixMissingLocaleActionController
{
#[Route(path: ['nl' => '/actie', 'en' => '/action'], name: 'action')]
public function action()
{
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<?php

namespace Symfony\Component\Routing\Tests\Fixtures\AttributeFixtures;

use Symfony\Component\Routing\Annotation\Route;

#[Route(path: ['nl' => '/nl', 'en' => '/en'])]
class LocalizedPrefixMissingRouteLocaleActionController
{
#[Route(path: ['nl' => '/actie'], name: 'action')]
public function action()
{
}
}
2 changes: 2 additions & 0 deletions Tests/Loader/AnnotationClassLoaderTestCase.php
Original file line number Diff line number Diff line change
Expand Up @@ -200,12 +200,14 @@ public function testInvokableClassMultipleRouteLoad()
public function testMissingPrefixLocale()
{
$this->expectException(\LogicException::class);
$this->expectExceptionMessage(sprintf('Route to "action" with locale "en" is missing a corresponding prefix in class "%s\LocalizedPrefixMissingLocaleActionController".', $this->getNamespace()));
$this->loader->load($this->getNamespace().'\LocalizedPrefixMissingLocaleActionController');
}

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

Expand Down

0 comments on commit 9874c77

Please sign in to comment.