Skip to content

Commit 849df01

Browse files
committed
fix tests
1 parent 4d2480c commit 849df01

File tree

4 files changed

+30
-28
lines changed

4 files changed

+30
-28
lines changed

src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/FrameworkExtensionTestCase.php

+2-1
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@
4343
use Symfony\Component\DependencyInjection\Definition;
4444
use Symfony\Component\DependencyInjection\Exception\LogicException;
4545
use Symfony\Component\DependencyInjection\Loader\ClosureLoader;
46+
use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator;
4647
use Symfony\Component\DependencyInjection\ParameterBag\EnvPlaceholderParameterBag;
4748
use Symfony\Component\DependencyInjection\Reference;
4849
use Symfony\Component\EventDispatcher\EventDispatcherInterface;
@@ -1760,7 +1761,7 @@ public function testCachePoolServices()
17601761
->replaceArgument(0, $expectedSeed)
17611762
->replaceArgument(1, 12),
17621763
(new ChildDefinition('cache.adapter.redis'))
1763-
->replaceArgument(0, new Reference('.cache_connection.kYdiLgf'))
1764+
->replaceArgument(0, new Reference('.cache_connection.'.(\count((new \ReflectionMethod(ContainerConfigurator::class, 'extension'))->getParameters()) > 2 ? 'U5HliuY' : 'kYdiLgf')))
17641765
->replaceArgument(1, $expectedSeed)
17651766
->replaceArgument(2, 12),
17661767
],

src/Symfony/Bundle/SecurityBundle/Tests/DependencyInjection/CompleteConfigurationTestCase.php

+3-2
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
use Symfony\Component\DependencyInjection\Argument\IteratorArgument;
1919
use Symfony\Component\DependencyInjection\ContainerBuilder;
2020
use Symfony\Component\DependencyInjection\Definition;
21+
use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator;
2122
use Symfony\Component\DependencyInjection\Reference;
2223
use Symfony\Component\HttpFoundation\RequestMatcher\AttributesRequestMatcher;
2324
use Symfony\Component\HttpFoundation\RequestMatcher\HostRequestMatcher;
@@ -137,7 +138,7 @@ public function testFirewalls()
137138
[
138139
'simple',
139140
'security.user_checker',
140-
'.security.request_matcher.h5ibf38',
141+
\count((new \ReflectionMethod(ContainerConfigurator::class, 'extension'))->getParameters()) > 2 ? '.security.request_matcher.rud_2nr' : '.security.request_matcher.h5ibf38',
141142
false,
142143
false,
143144
'',
@@ -187,7 +188,7 @@ public function testFirewalls()
187188
[
188189
'host',
189190
'security.user_checker',
190-
'.security.request_matcher.bcmu4fb',
191+
\count((new \ReflectionMethod(ContainerConfigurator::class, 'extension'))->getParameters()) > 2 ? '.security.request_matcher.ap9sh8g' : '.security.request_matcher.bcmu4fb',
191192
true,
192193
false,
193194
'security.user.provider.concrete.default',

src/Symfony/Component/Translation/Bridge/Crowdin/Tests/CrowdinProviderTest.php

+20-20
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ public function testCompleteWriteProcessAddFiles()
7575
<tool tool-id="symfony" tool-name="Symfony"/>
7676
</header>
7777
<body>
78-
<trans-unit id="ypeBEso" resname="a">
78+
<trans-unit id="%s" resname="a">
7979
<source>a</source>
8080
<target>trans_en_a</target>
8181
</trans-unit>
@@ -93,7 +93,7 @@ public function testCompleteWriteProcessAddFiles()
9393
<tool tool-id="symfony" tool-name="Symfony"/>
9494
</header>
9595
<body>
96-
<trans-unit id="is7pld7" resname="post.num_comments">
96+
<trans-unit id="%s" resname="post.num_comments">
9797
<source>post.num_comments</source>
9898
<target>{count, plural, one {# comment} other {# comments}}</target>
9999
</trans-unit>
@@ -116,7 +116,7 @@ public function testCompleteWriteProcessAddFiles()
116116
$this->assertSame('https://api.crowdin.com/api/v2/storages', $url);
117117
$this->assertSame('Content-Type: application/octet-stream', $options['normalized_headers']['content-type'][0]);
118118
$this->assertSame('Crowdin-API-FileName: messages.xlf', $options['normalized_headers']['crowdin-api-filename'][0]);
119-
$this->assertSame($expectedMessagesFileContent, $options['body']);
119+
$this->assertStringMatchesFormat($expectedMessagesFileContent, $options['body']);
120120

121121
return new JsonMockResponse(['data' => ['id' => 19]], ['http_code' => 201]);
122122
},
@@ -132,7 +132,7 @@ public function testCompleteWriteProcessAddFiles()
132132
$this->assertSame('https://api.crowdin.com/api/v2/storages', $url);
133133
$this->assertSame('Content-Type: application/octet-stream', $options['normalized_headers']['content-type'][0]);
134134
$this->assertSame('Crowdin-API-FileName: validators.xlf', $options['normalized_headers']['crowdin-api-filename'][0]);
135-
$this->assertSame($expectedValidatorsFileContent, $options['body']);
135+
$this->assertStringMatchesFormat($expectedValidatorsFileContent, $options['body']);
136136

137137
return new JsonMockResponse(['data' => ['id' => 19]], ['http_code' => 201]);
138138
},
@@ -171,7 +171,7 @@ public function testWriteAddFileServerError()
171171
<tool tool-id="symfony" tool-name="Symfony"/>
172172
</header>
173173
<body>
174-
<trans-unit id="ypeBEso" resname="a">
174+
<trans-unit id="%s" resname="a">
175175
<source>a</source>
176176
<target>trans_en_a</target>
177177
</trans-unit>
@@ -194,7 +194,7 @@ public function testWriteAddFileServerError()
194194
$this->assertSame('https://api.crowdin.com/api/v2/storages', $url);
195195
$this->assertSame('Content-Type: application/octet-stream', $options['normalized_headers']['content-type'][0]);
196196
$this->assertSame('Crowdin-API-FileName: messages.xlf', $options['normalized_headers']['crowdin-api-filename'][0]);
197-
$this->assertSame($expectedMessagesFileContent, $options['body']);
197+
$this->assertStringMatchesFormat($expectedMessagesFileContent, $options['body']);
198198

199199
return new JsonMockResponse(['data' => ['id' => 19]], ['http_code' => 201]);
200200
},
@@ -236,7 +236,7 @@ public function testWriteUpdateFileServerError()
236236
<tool tool-id="symfony" tool-name="Symfony"/>
237237
</header>
238238
<body>
239-
<trans-unit id="ypeBEso" resname="a">
239+
<trans-unit id="%s" resname="a">
240240
<source>a</source>
241241
<target>trans_en_a</target>
242242
</trans-unit>
@@ -266,7 +266,7 @@ public function testWriteUpdateFileServerError()
266266
$this->assertSame('https://api.crowdin.com/api/v2/storages', $url);
267267
$this->assertSame('Content-Type: application/octet-stream', $options['normalized_headers']['content-type'][0]);
268268
$this->assertSame('Crowdin-API-FileName: messages.xlf', $options['normalized_headers']['crowdin-api-filename'][0]);
269-
$this->assertSame($expectedMessagesFileContent, $options['body']);
269+
$this->assertStringMatchesFormat($expectedMessagesFileContent, $options['body']);
270270

271271
return new JsonMockResponse(['data' => ['id' => 19]], ['http_code' => 201]);
272272
},
@@ -308,7 +308,7 @@ public function testWriteUploadTranslationsServerError()
308308
<tool tool-id="symfony" tool-name="Symfony"/>
309309
</header>
310310
<body>
311-
<trans-unit id="ypeBEso" resname="a">
311+
<trans-unit id="%s" resname="a">
312312
<source>a</source>
313313
<target>trans_fr_a</target>
314314
</trans-unit>
@@ -326,7 +326,7 @@ public function testWriteUploadTranslationsServerError()
326326
<tool tool-id="symfony" tool-name="Symfony"/>
327327
</header>
328328
<body>
329-
<trans-unit id="ypeBEso" resname="a">
329+
<trans-unit id="%s" resname="a">
330330
<source>a</source>
331331
<target>trans_en_a</target>
332332
</trans-unit>
@@ -355,7 +355,7 @@ public function testWriteUploadTranslationsServerError()
355355
$this->assertSame('https://api.crowdin.com/api/v2/storages', $url);
356356
$this->assertSame('Content-Type: application/octet-stream', $options['normalized_headers']['content-type'][0]);
357357
$this->assertSame('Crowdin-API-FileName: messages.xlf', $options['normalized_headers']['crowdin-api-filename'][0]);
358-
$this->assertSame($expectedMessagesFileContent, $options['body']);
358+
$this->assertStringMatchesFormat($expectedMessagesFileContent, $options['body']);
359359

360360
return new JsonMockResponse(['data' => ['id' => 19]], ['http_code' => 201]);
361361
},
@@ -371,7 +371,7 @@ public function testWriteUploadTranslationsServerError()
371371
$this->assertSame('https://api.crowdin.com/api/v2/storages', $url);
372372
$this->assertSame('Content-Type: application/octet-stream', $options['normalized_headers']['content-type'][0]);
373373
$this->assertSame('Crowdin-API-FileName: messages.xlf', $options['normalized_headers']['crowdin-api-filename'][0]);
374-
$this->assertSame($expectedMessagesTranslationsContent, $options['body']);
374+
$this->assertStringMatchesFormat($expectedMessagesTranslationsContent, $options['body']);
375375

376376
return new JsonMockResponse(['data' => ['id' => 19]], ['http_code' => 201]);
377377
},
@@ -415,11 +415,11 @@ public function testCompleteWriteProcessUpdateFiles()
415415
<tool tool-id="symfony" tool-name="Symfony"/>
416416
</header>
417417
<body>
418-
<trans-unit id="ypeBEso" resname="a">
418+
<trans-unit id="%s" resname="a">
419419
<source>a</source>
420420
<target>trans_en_a</target>
421421
</trans-unit>
422-
<trans-unit id="PiPoFgA" resname="b">
422+
<trans-unit id="%s" resname="b">
423423
<source>b</source>
424424
<target>trans_en_b</target>
425425
</trans-unit>
@@ -448,7 +448,7 @@ public function testCompleteWriteProcessUpdateFiles()
448448
$this->assertSame('https://api.crowdin.com/api/v2/storages', $url);
449449
$this->assertSame('Content-Type: application/octet-stream', $options['normalized_headers']['content-type'][0]);
450450
$this->assertSame('Crowdin-API-FileName: messages.xlf', $options['normalized_headers']['crowdin-api-filename'][0]);
451-
$this->assertSame($expectedMessagesFileContent, $options['body']);
451+
$this->assertStringMatchesFormat($expectedMessagesFileContent, $options['body']);
452452

453453
return new JsonMockResponse(['data' => ['id' => 19]], ['http_code' => 201]);
454454
},
@@ -489,7 +489,7 @@ public function testCompleteWriteProcessAddFileAndUploadTranslations(TranslatorB
489489
<tool tool-id="symfony" tool-name="Symfony"/>
490490
</header>
491491
<body>
492-
<trans-unit id="ypeBEso" resname="a">
492+
<trans-unit id="%s" resname="a">
493493
<source>a</source>
494494
<target>trans_en_a</target>
495495
</trans-unit>
@@ -518,7 +518,7 @@ public function testCompleteWriteProcessAddFileAndUploadTranslations(TranslatorB
518518
$this->assertSame('https://api.crowdin.com/api/v2/storages', $url);
519519
$this->assertSame('Content-Type: application/octet-stream', $options['normalized_headers']['content-type'][0]);
520520
$this->assertSame('Crowdin-API-FileName: messages.xlf', $options['normalized_headers']['crowdin-api-filename'][0]);
521-
$this->assertSame($expectedMessagesFileContent, $options['body']);
521+
$this->assertStringMatchesFormat($expectedMessagesFileContent, $options['body']);
522522

523523
return new JsonMockResponse(['data' => ['id' => 19]], ['http_code' => 201]);
524524
},
@@ -534,7 +534,7 @@ public function testCompleteWriteProcessAddFileAndUploadTranslations(TranslatorB
534534
$this->assertSame('https://api.crowdin.com/api/v2/storages', $url);
535535
$this->assertSame('Content-Type: application/octet-stream', $options['normalized_headers']['content-type'][0]);
536536
$this->assertSame('Crowdin-API-FileName: messages.xlf', $options['normalized_headers']['crowdin-api-filename'][0]);
537-
$this->assertSame($expectedMessagesTranslationsContent, $options['body']);
537+
$this->assertStringMatchesFormat($expectedMessagesTranslationsContent, $options['body']);
538538

539539
return new JsonMockResponse(['data' => ['id' => 19]], ['http_code' => 201]);
540540
},
@@ -575,7 +575,7 @@ public static function getResponsesForProcessAddFileAndUploadTranslations(): \Ge
575575
<tool tool-id="symfony" tool-name="Symfony"/>
576576
</header>
577577
<body>
578-
<trans-unit id="ypeBEso" resname="a">
578+
<trans-unit id="%s" resname="a">
579579
<source>a</source>
580580
<target>trans_fr_a</target>
581581
</trans-unit>
@@ -602,7 +602,7 @@ public static function getResponsesForProcessAddFileAndUploadTranslations(): \Ge
602602
<tool tool-id="symfony" tool-name="Symfony"/>
603603
</header>
604604
<body>
605-
<trans-unit id="ypeBEso" resname="a">
605+
<trans-unit id="%s" resname="a">
606606
<source>a</source>
607607
<target>trans_en_gb_a</target>
608608
</trans-unit>

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

+5-5
Original file line numberDiff line numberDiff line change
@@ -693,7 +693,7 @@ public function testWrite(string $locale, string $localeId, string $domain, stri
693693
}
694694

695695
if (str_starts_with($part, '<?xml')) {
696-
$this->assertSame($content, $part);
696+
$this->assertStringMatchesFormat($content, $part);
697697
$testedContent = true;
698698
}
699699

@@ -797,11 +797,11 @@ public function writeProvider(): \Generator
797797
<tool tool-id="symfony" tool-name="Symfony"/>
798798
</header>
799799
<body>
800-
<trans-unit id="qdGDk9Z" resname="general.back">
800+
<trans-unit id="%s" resname="general.back">
801801
<source>general.back</source>
802802
<target><![CDATA[back &!]]></target>
803803
</trans-unit>
804-
<trans-unit id="0ESGki9" resname="general.cancel">
804+
<trans-unit id="%s" resname="general.cancel">
805805
<source>general.cancel</source>
806806
<target>Cancel</target>
807807
</trans-unit>
@@ -837,11 +837,11 @@ public function writeProvider(): \Generator
837837
<tool tool-id="symfony" tool-name="Symfony"/>
838838
</header>
839839
<body>
840-
<trans-unit id="qdGDk9Z" resname="general.back">
840+
<trans-unit id="%s" resname="general.back">
841841
<source>general.back</source>
842842
<target>zurück</target>
843843
</trans-unit>
844-
<trans-unit id="0ESGki9" resname="general.cancel">
844+
<trans-unit id="%s" resname="general.cancel">
845845
<source>general.cancel</source>
846846
<target>Abbrechen</target>
847847
</trans-unit>

0 commit comments

Comments
 (0)