Skip to content

Commit 571e13a

Browse files
author
Robin Chalas
committed
[Form] Fix tests
1 parent c82e2df commit 571e13a

File tree

2 files changed

+11
-1
lines changed

2 files changed

+11
-1
lines changed

src/Symfony/Component/Form/Extension/Core/CoreExtension.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ protected function loadTypes()
6969
new Type\TimeType(),
7070
new Type\TimezoneType(),
7171
new Type\UrlType(),
72-
new Type\FileType(),
72+
new Type\FileType($this->translator),
7373
new Type\ButtonType(),
7474
new Type\SubmitType(),
7575
new Type\ResetType(),

src/Symfony/Component/Form/Tests/Extension/Core/Type/FileTypeTest.php

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,16 +11,26 @@
1111

1212
namespace Symfony\Component\Form\Tests\Extension\Core\Type;
1313

14+
use Symfony\Component\Form\Extension\Core\CoreExtension;
1415
use Symfony\Component\Form\Extension\HttpFoundation\HttpFoundationRequestHandler;
1516
use Symfony\Component\Form\NativeRequestHandler;
1617
use Symfony\Component\Form\RequestHandlerInterface;
1718
use Symfony\Component\HttpFoundation\File\File;
1819
use Symfony\Component\HttpFoundation\File\UploadedFile;
20+
use Symfony\Component\Translation\TranslatorInterface;
1921

2022
class FileTypeTest extends BaseTypeTest
2123
{
2224
const TESTED_TYPE = 'Symfony\Component\Form\Extension\Core\Type\FileType';
2325

26+
protected function getExtensions()
27+
{
28+
$translator = $this->createMock(TranslatorInterface::class);
29+
$translator->expects($this->any())->method('trans')->willReturnArgument(0);
30+
31+
return array_merge(parent::getExtensions(), [new CoreExtension(null, null, $translator)]);
32+
}
33+
2434
// https://github.com/symfony/symfony/pull/5028
2535
public function testSetData()
2636
{

0 commit comments

Comments
 (0)