8000 Merge branch '6.4' into 7.1 · symfony/symfony@717d2c9 · GitHub
[go: up one dir, main page]

Skip to content

Commit 717d2c9

Browse files
committed
Merge branch '6.4' into 7.1
* 6.4: Make more data providers static fix merge Mutate remaining data providers to static ones
2 parents 5c739b7 + 7e8c7d9 commit 717d2c9

File tree

14 files changed

+44
-60
lines changed

14 files changed

+44
-60
lines changed

src/Symfony/Component/Console/Tests/Formatter/OutputFormatterTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -199,7 +199,7 @@ public static function provideInlineStyleOptionsCases()
199199
];
200200
}
201201

202-
public function provideInlineStyleTagsWithUnknownOptions()
202+
public static function provideInlineStyleTagsWithUnknownOptions()
203203
{
204204
return [
205205
['<options=abc;>', 'abc'],

src/Symfony/Component/DependencyInjection/Tests/Attribute/AutowireTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ public function testCanUseParam()
7474
/**
7575
* @see testCanOnlySetOneParameter
7676
*/
77-
private static function provideMultipleParameters(): iterable
77+
public static function provideMultipleParameters(): iterable
7878
{
7979
yield [['service' => 'id', 'expression' => 'expr']];
8080

src/Symfony/Component/Form/Tests/ChoiceList/Factory/CachingFactoryDecoratorTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -577,7 +577,7 @@ public static function provideDistinguishedChoices()
577577
];
578578
}
579579

580-
public function provideSameKeyChoices()
580+
public static function provideSameKeyChoices()
581581
{
582582
// Only test types here that can be used as array keys
583583
return [
@@ -588,7 +588,7 @@ public function provideSameKeyChoices()
588588
];
589589
}
590590

591-
public function provideDistinguishedKeyChoices()
591+
public static function provideDistinguishedKeyChoices()
592592
{
593593
// Only test types here that can be used as array keys
594594
return [

src/Symfony/Component/HttpFoundation/Tests/Session/Storage/Handler/MongoDbSessionHandlerTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ public function testConstructorShouldThrowExceptionForMissingOptions(array $opti
9898
new MongoDbSessionHandler($this->manager, $options);
9999
}
100100

101-
public function provideInvalidOptions()
101+
public static function provideInvalidOptions(): iterable
102102
{
103103
yield 'empty' => [[]];
104104
yield 'collection missing' => [['database' => 'foo']];

src/Symfony/Component/HttpFoundation/Tests/Test/Constraint/ResponseHeaderLocationSameTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ public function testConstraintSuccess(string $requestUrl, ?string $location, str
3636
self::assertTrue($constraint->evaluate($response, '', true));
3737
}
3838

39-
public function provideSuccessCases(): iterable
39+
public static function provideSuccessCases(): iterable
4040
{
4141
yield ['http://example.com', 'http://example.com', 'http://example.com'];
4242
yield ['http://example.com', 'http://example.com', '//example.com'];
@@ -112,7 +112,7 @@ public function testConstraintFailure(string $requestUrl, ?string $location, str
112112
$constraint->evaluate($response);
113113
}
114114

115-
public function provideFailureCases(): iterable
115+
public static function provideFailureCases(): iterable
116116
{
117117
yield ['http://example.com', null, 'http://example.com'];
118118
yield ['http://example.com', null, '//example.com'];

src/Symfony/Component/Intl/Tests/LocalesTest.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,12 +21,12 @@ class LocalesTest extends ResourceBundleTestCase
2121
{
2222
public function testGetLocales()
2323
{
24-
$this->assertSame($this->getLocales(), Locales::getLocales());
24+
$this->assertSame(static::getLocales(), Locales::getLocales());
2525
}
2626

2727
public function testGetAliases()
2828
{
29-
$this->assertSame($this->getLocaleAliases(), Locales::getAliases());
29+
$this->assertSame(static::getLocaleAliases(), Locales::getAliases());
3030
}
3131

3232
/**
@@ -41,7 +41,7 @@ public function testGetNames($displayLocale)
4141
// We can't assert on exact list of locale, as there's too many variations.
4242
// The best we can do is to make sure getNames() returns a subset of what getLocales() returns.
4343
$this->assertNotEmpty($locales);
44-
$this->assertEmpty(array_diff($locales, $this->getLocales()));
44+
$this->assertEmpty(array_diff($locales, static::getLocales()));
4545
}
4646

4747
public function testGetNamesDefaultLocale()

src/Symfony/Component/Intl/Tests/ResourceBundleTestCase.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -762,24 +762,24 @@ public static function provideLocales()
762762
{
763763
return array_map(
764764
fn ($locale) => [$locale],
765-
self::getLocales()
765+
static::getLocales()
766766
);
767767
}
768768

769769
public static function provideLocaleAliases()
770770
{
771771
return array_map(
772772
fn ($alias, $ofLocale) => [$alias, $ofLocale],
773-
array_keys(self::getLocaleAliases()),
774-
self::getLocaleAliases()
773+
array_keys(static::getLocaleAliases()),
774+
static::getLocaleAliases()
775775
);
776776
}
777777

778778
public static function provideRootLocales()
779779
{
780780
return array_map(
781781
fn ($locale) => [$locale],
782-
self::getRootLocales()
782+
static::getRootLocales()
783783
);
784784
}
785785

@@ -796,8 +796,8 @@ protected static function getLocaleAliases()
796796
protected static function getRootLocales()
797797
{
798798
if (null === self::$rootLocales) {
799-
// ignore locales for which fallback is possible (e.g "en_GB")
800-
self::$rootLocales = array_filter(self::getLocales(), fn ($locale) => !str_contains($locale, '_'));
799+
// no locales for which fallback is possible (e.g "en_GB")
800+
self::$rootLocales = array_filter(static::getLocales(), fn ($locale) => !str_contains($locale, '_'));
801801
}
802802

803803
return self::$rootLocales;

src/Symfony/Component/Messenger/Bridge/Doctrine/Tests/Transport/ConnectionTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -720,7 +720,7 @@ public function testFindAllSqlGenerated(AbstractPlatform $platform, string $expe
720720
$connection->findAll(50);
721721
}
722722

723-
public function provideFindAllSqlGeneratedByPlatform(): iterable
723+
public static function provideFindAllSqlGeneratedByPlatform(): iterable
724724
{
725725
yield 'MySQL' => [
726726
class_exists(MySQLPlatform::class) ? new MySQLPlatform() : new MySQL57Platform(),

src/Symfony/Component/Mime/Tests/MessageTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -306,7 +306,7 @@ public function testEnsureValidity(array $headers, ?string $exceptionClass, ?str
306306
$m->ensureValidity();
307307
}
308308

309-
public function ensureValidityProvider()
309+
public static function ensureValidityProvider(): array
310310
{
311311
return [
312312
'Valid address fields' => [

src/Symfony/Component/Security/Http/Tests/Authenticator/AccessTokenAuthenticatorTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -177,7 +177,7 @@ public function testAccessTokenHeaderRegex(string $input, ?string $expectedToken
177177
$this->assertEquals($expectedToken, $token);
178178
}
179179

180-
F438 public function provideAccessTokenHeaderRegex(): array
180+
public static function provideAccessTokenHeaderRegex(): array
181181
{
182182
return [
183183
['Bearer token', 'token'],

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1191,7 +1191,7 @@ public function testDenormalizeBooleanTypesWithNotMatchingData(array $data, stri
11911191
$normalizer->denormalize($data, $type);
11921192
}
11931193

1194-
public function provideBooleanTypesData()
1194+
public static function provideBooleanTypesData()
11951195
{
11961196
return [
11971197
[['foo' => true], FalsePropertyDummy::class],

src/Symfony/Component/String/Tests/AbstractUnicodeTestCase.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ public function testLocaleTitle(string $locale, string $expected, string $origin
9292
$this->assertSame($expected, (string) $instance);
9393
}
9494

95-
public function provideCreateFromCodePoint(): array
95+
public static function provideCreateFromCodePoint(): array
9696
{
9797
return [
9898
['', []],

src/Symfony/Component/Translation/Bridge/Phrase/Tests/PhraseProviderTest.php

Lines changed: 22 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -51,8 +51,10 @@ class PhraseProviderTest extends TestCase
5151
/**
5252
* @dataProvider toStringProvider
5353
*/
54-
public function testToString(ProviderInterface $provider, string $expected)
54+
public function testToString(?string $endpoint, string $expected)
5555
{
56+
$provider = $this->createProvider(endpoint: $endpoint);
57+
5658
self::assertSame($expected, (string) $provider);
5759
}
5860

@@ -332,7 +334,7 @@ public function testGetCacheItem(mixed $cachedValue, bool $hasMatchHeader)
332334
$provider->read(['messages'], ['en_GB']);
333335
}
334336

335-
public function cacheItemProvider(): \Generator
337+
public static function cacheItemProvider(): \Generator
336338
{
337339
yield 'null value' => [
338340
'cached_value' => null,
@@ -347,7 +349,7 @@ public function cacheItemProvider(): \Generator
347349
];
348350
}
349351

350-
public function cacheKeyProvider(): \Generator
352+
public static function cacheKeyProvider(): \Generator
351353
{
352354
yield 'sortorder one' => [
353355
'options' => [
@@ -787,7 +789,7 @@ public function testWriteProviderExceptions(int $statusCode, string $expectedExc
787789
$provider->write($bag);
788790
}
789791

790-
public function writeProvider(): \Generator
792+
public static function writeProvider(): \Generator
791793
{
792794
$expectedEnglishXliff = <<<'XLIFF'
793795
<?xml version="1.0" encoding="utf-8"?>
@@ -869,84 +871,66 @@ public function writeProvider(): \Generator
869871
];
870872
}
871873

872-
public function toStringProvider(): \Generator
874+
public static function toStringProvider(): \Generator
873875
{
874876
yield 'default endpoint' => [
875-
'provider' => $this->createProvider(httpClient: $this->getHttpClient()->withOptions([
876-
'base_uri' => 'https://api.phrase.com/api/v2/projects/PROJECT_ID/',
877-
'headers' => [
878-
'Authorization' => 'token API_TOKEN',
879-
'User-Agent' => 'myProject',
880-
],
881-
])),
877+
'endpoint' => null,
882878
'expected' => 'phrase://api.phrase.com',
883879
];
884880

885881
yield 'custom endpoint' => [
886-
'provider' => $this->createProvider(httpClient: $this->getHttpClient()->withOptions([
887-
'base_uri' => 'https://api.us.app.phrase.com/api/v2/projects/PROJECT_ID/',
888-
'headers' => [
889-
'Authorization' => 'token API_TOKEN',
890-
'User-Agent' => 'myProject',
891-
],
892-
]), endpoint: 'api.us.app.phrase.com'),
882+
'endpoint' => 'api.us.app.phrase.com',
893883
'expected' => 'phrase://api.us.app.phrase.com',
894884
];
895885

896886
yield 'custom endpoint with port' => [
897-
'provider' => $this->createProvider(httpClient: $this->getHttpClient()->withOptions([
898-
'base_uri' => 'https://api.us.app.phrase.com:8080/api/v2/projects/PROJECT_ID/',
899-
'headers' => [
900-
'Authorization' => 'token API_TOKEN',
901-
'User-Agent' => 'myProject',
902-
],
903-
]), endpoint: 'api.us.app.phrase.com:8080'),
887+
'endpoint' => 'api.us.app.phrase.com:8080',
904888
'expected' => 'phrase://api.us.app.phrase.com:8080',
905889
];
906890
}
907891

908-
public function deleteExceptionsProvider(): array
892+
public static function deleteExceptionsProvider(): array
909893
{
910-
return $this->getExceptionResponses(
894+
return self::getExceptionResponses(
911895
exceptionMessage: 'Unable to delete key in phrase.',
912896
loggerMessage: 'Unable to delete key "key.to.delete" in phrase: "provider error".',
913897
statusCode: 500
914898
);
915899
}
916900

917-
public function writeExceptionsProvider(): array
901+
public static function writeExceptionsProvider(): array
918902
{
919-
return $this->getExceptionResponses(
903+
return self::getExceptionResponses(
920904
exceptionMessage: 'Unable to upload translations to phrase.',
921905
loggerMessage: 'Unable to upload translations for domain "messages" to phrase: "provider error".'
922906
);
923907
}
924908

925-
public function createLocalesExceptionsProvider(): array
909+
public static function createLocalesExceptionsProvider(): array
926910
{
927-
return $this->getExceptionResponses(
911+
return self::getExceptionResponses(
928912
exceptionMessage: 'Unable to create locale phrase.',
929913
loggerMessage: 'Unable to create locale "nl-NL" in phrase: "provider error".'
930914
);
931915
}
932916

933-
public function initLocalesExceptionsProvider(): array
917+
public static function initLocalesExceptionsProvider(): array
934918
{
935-
return $this->getExceptionResponses(
919+
return self::getExceptionResponses(
936920
exceptionMessage: 'Unable to get locales from phrase.',
937921
loggerMessage: 'Unable to get locales from phrase: "provider error".'
938922
);
939923
}
940924

941-
public function readProviderExceptionsProvider(): array
925+
public static function readProviderExceptionsProvider(): array
942926
{
943-
return $this->getExceptionResponses(
927+
return self::getExceptionResponses(
944928
exceptionMessage: 'Unable to get translations from phrase.',
945929
loggerMessage: 'Unable to get translations for locale "en_GB" from phrase: "provider error".'
946930
);
947931
}
948932

949-
public function readProvider(): \Generator
933+
public static function readProvider(): \Generator
950934
{
951935
$bag = new TranslatorBag();
952936
$catalogue = new MessageCatalogue('en_GB', [
@@ -1045,7 +1029,7 @@ public function readProvider(): \Generator
10451029
];
10461030
}
10471031

1048-
private function getExceptionResponses(string $exceptionMessage, string $loggerMessage, int $statusCode = 400): array
1032+
private static function getExceptionResponses(string $exceptionMessage, string $loggerMessage, int $statusCode = 400): array
10491033
{
10501034
return [
10511035
'bad request' => [

src/Symfony/Component/Validator/Tests/Constraints/CssColorValidatorTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -433,7 +433,7 @@ public function testInvalidHSLA($cssColor)
433433
->assertRaised();
434434
}
435435

436-
public function getInvalidHSLA(): array
436+
public static function getInvalidHSLA(): array
437437
{
438438
return [
439439
['hsla(1000, 1000%, 20000%, 999)'],

0 commit comments

Comments
 (0)
0