Skip to content

Commit d5e749d

Browse files
Merge branch '6.4' into 7.3
* 6.4: [Validator] Update Romanian translations fix tests [String][Inflector] Fix edge cases [Security] Fix attribute-based chained user providers [Intl] Fix Intl::getIcuStubVersion()
2 parents 6e42b36 + 6cf6a92 commit d5e749d

File tree

7 files changed

+95
-48
lines changed

7 files changed

+95
-48
lines changed

src/Symfony/Component/Intl/Intl.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ public static function getIcuDataVersion(): string
106106
*/
107107
public static function getIcuStubVersion(): string
108108
{
109-
return '76.1';
109+
return '77.1';
110110
}
111111

112112
/**

src/Symfony/Component/Security/Core/Tests/User/ChainUserProviderTest.php

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,14 @@
1414
use PHPUnit\Framework\TestCase;
1515
use Symfony\Component\Security\Core\Exception\UnsupportedUserException;
1616
use Symfony\Component\Security\Core\Exception\UserNotFoundException;
17+
use Symfony\Component\Security\Core\User\AttributesBasedUserProviderInterface;
1718
use Symfony\Component\Security\Core\User\ChainUserProvider;
1819
use Symfony\Component\Security\Core\User\InMemoryUser;
1920
use Symfony\Component\Security\Core\User\InMemoryUserProvider;
2021
use Symfony\Component\Security\Core\User\PasswordAuthenticatedUserInterface;
2122
use Symfony\Component\Security\Core\User\PasswordUpgraderInterface;
2223
use Symfony\Component\Security\Core\User\UserInterface;
24+
use Symfony\Component\Security\Core\User\UserProviderInterface;
2325

2426
class ChainUserProviderTest extends TestCase
2527
{
@@ -45,6 +47,28 @@ public function testLoadUserByIdentifier()
4547
$this->assertSame($account, $provider->loadUserByIdentifier('foo'));
4648
}
4749

50+
public function testLoadUserByIdentifierWithAttributes()
51+
{
52+
$provider1 = $this->createMock(UserProviderInterface::class);
53+
$provider1
54+
->expects($this->once())
55+
->method('loadUserByIdentifier')
56+
->with($this->equalTo('foo'))
57+
->willThrowException(new UserNotFoundException('not found'))
58+
;
59+
60+
$provider2 = $this->createMock(AttributesBasedUserProviderInterface::class);
61+
$provider2
62+
->expects($this->once())
63+
->method('loadUserByIdentifier')
64+
->with($this->equalTo('foo'), $this->equalTo(['attr' => 5]))
65+
->willReturn($account = $this->createMock(UserInterface::class))
66+
;
67+
68+
$provider = new ChainUserProvider([$provider1, $provider2]);
69+
$this->assertSame($account, $provider->loadUserByIdentifier('foo', ['attr' => 5]));
70+
}
71+
4872
public function testLoadUserByIdentifierThrowsUserNotFoundException()
4973
{
5074
$provider1 = $this->createMock(InMemoryUserProvider::class);

src/Symfony/Component/Security/Core/User/ChainUserProvider.php

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,10 +46,18 @@ public function getProviders(): array
4646
return $this->providers;
4747
}
4848

49-
public function loadUserByIdentifier(string $identifier): UserInterface
49+
/**
50+
* @param array $attributes
51+
*/
52+
public function loadUserByIdentifier(string $identifier/* , array $attributes = [] */): UserInterface
5053
{
54+
$attributes = \func_num_args() > 1 ? func_get_arg(1) : [];
5155
foreach ($this->providers as $provider) {
5256
try {
57+
if ($provider instanceof AttributesBasedUserProviderInterface) {
58+
return $provider->loadUserByIdentifier($identifier, $attributes);
59+
}
60+
5361
return $provider->loadUserByIdentifier($identifier);
5462
} catch (UserNotFoundException) {
5563
// try next one

src/Symfony/Component/Serializer/Tests/Normalizer/DateTimeNormalizerTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,7 @@ public static function normalizeUsingTimeZonePassedInContextAndExpectedFormatWit
139139
'2018-12-01T18:03:06.067634',
140140
new \DateTimeZone('UTC')
141141
),
142-
new \DateTimeZone('Europe/Kyiv'),
142+
new \DateTimeZone(\in_array('Europe/Kyiv', \DateTimeZone::listIdentifiers(), true) ? 'Europe/Kyiv' : 'Europe/Kiev'),
143143
];
144144

145145
yield [

src/Symfony/Component/String/Inflector/EnglishInflector.php

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,13 @@ final class EnglishInflector implements InflectorInterface
2525
// Fourth entry: Whether the suffix may succeed a consonant
2626
// Fifth entry: singular suffix, normal
2727

28+
// insignias (insigne), insignia (insigne)
29+
['saingisni', 9, true, true, 'insigne'],
30+
['aingisni', 8, true, true, 'insigne'],
31+
32+
// passersby (passerby)
33+
['ybsressap', 9, true, true, 'passerby'],
34+
2835
// nodes (node)
2936
['sedon', 5, true, true, 'node'],
3037

@@ -205,6 +212,12 @@ final class EnglishInflector implements InflectorInterface
205212
// Fourth entry: Whether the suffix may succeed a consonant
206213
// Fifth entry: plural suffix, normal
207214

215+
// passerby (passersby)
216+
['ybressap', 8, true, true, 'passersby'],
217+
218+
// insigne (insignia, insignias)
219+
['engisni', 7, true, true, ['insignia', 'insignias']],
220+
208221
// nodes (node)
209222
['edon', 4, true, true, 'nodes'],
210223

src/Symfony/Component/String/Tests/Inflector/EnglishInflectorTest.php

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -171,16 +171,15 @@ public static function singularizeProvider()
171171
['waltzes', ['waltz', 'waltze']],
172172
['wives', 'wife'],
173173
['zombies', 'zombie'],
174+
['passersby', 'passerby'],
175+
['rattles', 'rattle'],
176+
['insignia', 'insigne'],
177+
['insignias', 'insigne'],
174178

175179
// test casing: if the first letter was uppercase, it should remain so
176180
['Men', 'Man'],
177181
['GrandChildren', 'GrandChild'],
178182
['SubTrees', 'SubTree'],
179-
180-
// Known issues
181-
// ['insignia', 'insigne'],
182-
// ['insignias', 'insigne'],
183-
// ['rattles', 'rattle'],
184183
];
185184
}
186185

@@ -262,6 +261,7 @@ public static function pluralizeProvider()
262261
['house', 'houses'],
263262
['icon', 'icons'],
264263
['index', ['indicies', 'indexes']],
264+
['insigne', ['insignia', 'insignias']],
265265
['ion', 'ions'],
266266
['iris', 'irises'],
267267
['issue', 'issues'],
@@ -287,6 +287,7 @@ public static function pluralizeProvider()
287287
['objective', 'objectives'],
288288
['ox', 'oxen'],
289289
['party', 'parties'],
290+
['passerby', 'passersby'],
290291
['person', ['persons', 'people']],
291292
['phenomenon', 'phenomena'],
292293
['photo', 'photos'],
@@ -298,6 +299,7 @@ public static function pluralizeProvider()
298299
['quiz', 'quizzes'],
299300
['quorum', ['quora', 'quorums']],
300301
['radius', 'radii'],
302+
['rattle', 'rattles'],
301303
['roof', ['roofs', 'rooves']],
302304
['rose', 'roses'],
303305
['sandwich', 'sandwiches'],

0 commit comments

Comments
 (0)