Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit b1521f3

Browse files
committed
Merge branch '6.1' into 6.2
* 6.1: [Translation] Fix Crowdin documentation urls ignore missing keys when mapping DateTime objects to uninitialized arrays fix writes to static $kernel property [Notifier] Fix test logic [Validator] Hint that `egulias/email-validator` needs to be installed for strict mode as default config
2 parents 9767b00 + 5ec2016 commit b1521f3

File tree

6 files changed

+53
-22
lines changed

6 files changed

+53
-22
lines changed

src/Symfony/Bundle/FrameworkBundle/Test/KernelTestCase.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ protected static function bootKernel(array $options = []): KernelInterface
7171

7272
$kernel = static::createKernel($options);
7373
$kernel->boot();
74-
self::$kernel = $kernel;
74+
static::$kernel = $kernel;
7575
static::$booted = true;
7676

7777
return static::$kernel;

src/Symfony/Component/Form/Tests/CompoundFormTest.php

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@
1515
use Symfony\Component\EventDispatcher\EventDispatcher;
1616
use Symfony\Component\Form\Exception\AlreadySubmittedException;
1717
use Symfony\Component\Form\Extension\Core\DataMapper\DataMapper;
18+
use Symfony\Component\Form\Extension\Core\DataMapper\PropertyPathMapper;
19+
use Symfony\Component\Form\Extension\Core\Type\DateType;
1820
use Symfony\Component\Form\Extension\Core\Type\SubmitType;
1921
use Symfony\Component\Form\Extension\Core\Type\TextType;
2022
use Symfony\Component\Form\Extension\HttpFoundation\HttpFoundationRequestHandler;
@@ -36,6 +38,7 @@
3638
use Symfony\Component\Form\Tests\Fixtures\Map;
3739
use Symfony\Component\HttpFoundation\File\UploadedFile;
3840
use Symfony\Component\HttpFoundation\Request;
41+
use Symfony\Component\PropertyAccess\PropertyAccess;
3942

4043
class CompoundFormTest extends TestCase
4144
{
@@ -1086,6 +1089,30 @@ public function testFileUpload()
10861089
$this->assertNull($this->form->get('bar')->getData());
10871090
}
10881091

1092+
public function testMapDateTimeObjectsWithEmptyArrayData()
1093+
{
1094+
$propertyAccessor = PropertyAccess::createPropertyAccessorBuilder()
1095+
->enableExceptionOnInvalidIndex()
1096+
->getPropertyAccessor();
1097+
$form = $this->factory->createBuilder()
1098+
->setDataMapper(new PropertyPathMapper($propertyAccessor))
1099+
->add('date', DateType::class, [
1100+
'auto_initialize' => false,
1101+
'format' => 'dd/MM/yyyy',
1102+
'html5' => false,
1103+
'model_timezone' => 'UTC',
1104+
'view_timezone' => 'UTC',
1105+
'widget' => 'single_text',
1106+
])
1107+
->getForm();
1108+
1109+
$form->submit([
1110+
'date' => '04/08/2022',
1111+
]);
1112+
1113+
$this->assertEquals(['date' => new \DateTime('2022-08-04', new \DateTimeZone('UTC'))], $form->getData());
1114+
}
1115+
10891116
private function createForm(string $name = 'name', bool $compound = true): FormInterface
10901117
{
10911118
$builder = $this->getBuilder($name);

src/Symfony/Component/Notifier/Bridge/FakeChat/Tests/FakeChatEmailTransportTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ public function testSendWithCustomTransportAndWithRecipient()
119119
$this->assertSame(sprintf('New Chat message for recipient: %s', $recipient), $sentEmail->getSubject());
120120
$this->assertSame($subject, $sentEmail->getTextBody());
121121
$this->assertTrue($sentEmail->getHeaders()->has('X-Transport'));
122-
$this->assertSame($transportName, $sentEmail->getHeaders()->get('X-Transport')->getBodyAsString());
122+
$this->assertSame($transportName, $sentEmail->getHeaders()->get('X-Transport')->getBody());
123123
}
124124

125125
public function testSendWithCustomTransportAndWithoutRecipient()
@@ -143,6 +143,6 @@ public function testSendWithCustomTransportAndWithoutRecipient()
143143
$this->assertSame('New Chat message without specified recipient!', $sentEmail->getSubject());
144144
$this->assertSame($subject, $sentEmail->getTextBody());
145145
$this->assertTrue($sentEmail->getHeaders()->has('X-Transport'));
146-
$this->assertSame($transportName, $sentEmail->getHeaders()->get('X-Transport')->getBodyAsString());
146+
$this->assertSame($transportName, $sentEmail->getHeaders()->get('X-Transport')->getBody());
147147
}
148148
}

src/Symfony/Component/Notifier/Bridge/FakeSms/Tests/FakeSmsEmailTransportTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,6 @@ public function testSendWithCustomTransport()
9696
$this->assertSame(sprintf('New SMS on phone number: %s', $phone), $sentEmail->getSubject());
9797
$this->assertSame($subject, $sentEmail->getTextBody());
9898
$this->assertTrue($sentEmail->getHeaders()->has('X-Transport'));
99-
$this->assertSame($transportName, $sentEmail->getHeaders()->get('X-Transport')->getBodyAsString());
99+
$this->assertSame($transportName, $sentEmail->getHeaders()->get('X-Transport')->getBody());
100100
}
101101
}

src/Symfony/Component/Translation/Bridge/Crowdin/CrowdinProvider.php

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -228,8 +228,8 @@ private function addFile(string $domain, string $content): ?array
228228
$storageId = $this->addStorage($domain, $content);
229229

230230
/**
231-
* @see https://support.crowdin.com/api/v2/#operation/api.projects.files.getMany (Crowdin API)
232-
* @see https://support.crowdin.com/enterprise/api/#operation/api.projects.files.getMany (Crowdin Enterprise API)
231+
* @see https://developer.crowdin.com/api/v2/#operation/api.projects.files.getMany (Crowdin API)
232+
* @see https://developer.crowdin.com/enterprise/api/v2/#operation/api.projects.files.getMany (Crowdin Enterprise API)
233233
*/
234234
$response = $this->client->request('POST', 'files', [
235235
'json' => [
@@ -252,8 +252,8 @@ private function updateFile(int $fileId, string $domain, string $content): ?arra
252252
$storageId = $this->addStorage($domain, $content);
253253

254254
/**
255-
* @see https://support.crowdin.com/api/v2/#operation/api.projects.files.put (Crowdin API)
256-
* @see https://support.crowdin.com/enterprise/api/#operation/api.projects.files.put (Crowdin Enterprise API)
255+
* @see https://developer.crowdin.com/api/v2/#operation/api.projects.files.put (Crowdin API)
256+
* @see https://developer.crowdin.com/enterprise/api/v2/#operation/api.projects.files.put (Crowdin Enterprise API)
257257
*/
258258
$response = $this->client->request('PUT', 'files/'.$fileId, [
259259
'json' => [
@@ -275,8 +275,8 @@ private function uploadTranslations(int $fileId, string $domain, string $content
275275
$storageId = $this->addStorage($domain, $content);
276276

277277
/*
278-
* @see https://support.crowdin.com/api/v2/#operation/api.projects.translations.postOnLanguage (Crowdin API)
279-
* @see https://support.crowdin.com/enterprise/api/#operation/api.projects.translations.postOnLanguage (Crowdin Enterprise API)
278+
* @see https://developer.crowdin.com/api/v2/#operation/api.projects.translations.postOnLanguage (Crowdin API)
279+
* @see https://developer.crowdin.com/enterprise/api/v2/#operation/api.projects.translations.postOnLanguage (Crowdin Enterprise API)
280280
*/
281281
return $this->client->request('POST', 'translations/'.str_replace('_', '-', $locale), [
282282
'json' => [
@@ -289,8 +289,8 @@ private function uploadTranslations(int $fileId, string $domain, string $content
289289
private function exportProjectTranslations(string $languageId, int $fileId): ResponseInterface
290290
{
291291
/*
292-
* @see https://support.crowdin.com/api/v2/#operation/api.projects.translations.exports.post (Crowdin API)
293-
* @see https://support.crowdin.com/enterprise/api/#operation/api.projects.translations.exports.post (Crowdin Enterprise API)
292+
* @see https://developer.crowdin.com/api/v2/#operation/api.projects.translations.exports.post (Crowdin API)
293+
* @see https://developer.crowdin.com/enterprise/api/v2/#operation/api.projects.translations.exports.post (Crowdin Enterprise API)
294294
*/
295295
return $this->client->request('POST', 'translations/exports', [
296296
'json' => [
@@ -303,17 +303,17 @@ private function exportProjectTranslations(string $languageId, int $fileId): Res
303303
private function downloadSourceFile(int $fileId): ResponseInterface
304304
{
305305
/*
306-
* @see https://support.crowdin.com/api/v2/#operation/api.projects.files.download.get (Crowdin API)
307-
* @see https://support.crowdin.com/enterprise/api/#operation/api.projects.files.download.get (Crowdin Enterprise API)
306+
* @see https://developer.crowdin.com/api/v2/#operation/api.projects.files.download.get (Crowdin API)
307+
* @see https://developer.crowdin.com/enterprise/api/v2/#operation/api.projects.files.download.get (Crowdin Enterprise API)
308308
*/
309309
return $this->client->request('GET', sprintf('files/%d/download', $fileId));
310310
}
311311

312312
private function listStrings(int $fileId, int $limit, int $offset): array
313313
{
314314
/**
315-
* @see https://support.crowdin.com/api/v2/#operation/api.projects.strings.getMany (Crowdin API)
316-
* @see https://support.crowdin.com/enterprise/api/#operation/api.projects.strings.getMany (Crowdin Enterprise API)
315+
* @see https://developer.crowdin.com/api/v2/#operation/api.projects.strings.getMany (Crowdin API)
316+
* @see https://developer.crowdin.com/enterprise/api/v2/#operation/api.projects.strings.getMany (Crowdin Enterprise API)
317317
*/
318318
$response = $this->client->request('GET', 'strings', [
319319
'query' => [
@@ -335,17 +335,17 @@ private function listStrings(int $fileId, int $limit, int $offset): array
335335
private function deleteString(int $stringId): ResponseInterface
336336
{
337337
/*
338-
* @see https://support.crowdin.com/api/v2/#operation/api.projects.strings.delete (Crowdin API)
339-
* @see https://support.crowdin.com/enterprise/api/#operation/api.projects.strings.delete (Crowdin Enterprise API)
338+
* @see https://developer.crowdin.com/api/v2/#operation/api.projects.strings.delete (Crowdin API)
339+
* @see https://developer.crowdin.com/enterprise/api/v2#operation/api.projects.strings.delete (Crowdin Enterprise API)
340340
*/
341341
return $this->client->request('DELETE', 'strings/'.$stringId);
342342
}
343343

344344
private function addStorage(string $domain, string $content): int
345345
{
346346
/**
347-
* @see https://support.crowdin.com/api/v2/#operation/api.storages.post (Crowdin API)
348-
* @see https://support.crowdin.com/enterprise/api/#operation/api.storages.post (Crowdin Enterprise API)
347+
* @see https://developer.crowdin.com/api/v2/#operation/api.storages.post (Crowdin API)
348+
* @see https://developer.crowdin.com/enterprise/api/v2/#operation/api.storages.post (Crowdin Enterprise API)
349349
*/
350350
$response = $this->client->request('POST', '../../storages', [
351351
'headers' => [
@@ -367,8 +367,8 @@ private function getFileList(): array
367367
$result = [];
368368

369369
/**
370-
* @see https://support.crowdin.com/api/v2/#operation/api.projects.files.getMany (Crowdin API)
371-
* @see https://support.crowdin.com/enterprise/api/#operation/api.projects.files.getMany (Crowdin Enterprise API)
370+
* @see https://developer.crowdin.com/api/v2/#operation/api.projects.files.getMany (Crowdin API)
371+
* @see https://developer.crowdin.com/enterprise/api/v2/#operation/api.projects.files.getMany (Crowdin Enterprise API)
372372
*/
373373
$response = $this->client->request('GET', 'files');
374374

src/Symfony/Component/Validator/Constraints/EmailValidator.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,10 @@ public function validate(mixed $value, Constraint $constraint)
7474
}
7575

7676
if (null === $constraint->mode) {
77+
if (Email::VALIDATION_MODE_STRICT === $this->defaultMode && !class_exists(EguliasEmailValidator::class)) {
78+
throw new LogicException(sprintf('The "egulias/email-validator" component is required to make the "%s" constraint default to strict mode.', EguliasEmailValidator::class));
79+
}
80+
7781
$constraint->mode = $this->defaultMode;
7882
}
7983

0 commit comments

Comments
 (0)