merged branch stfalcon/patch-1 (PR #5028)
This PR was submitted for the master branch but it was merged into the 2.1 branch instead (closes #5028). Commits ------- 5bfe757 Update src/Symfony/Component/Form/Extension/Core/Type/FileType.php Discussion ---------- Update src/Symfony/Component/Form/Extension/Core/Type/FileType.php fixed https://github.com/dustin10/VichUploaderBundle/issues/27 --------------------------------------------------------------------------- by bschussek at 2012-07-24T12:44:11Z Thank you for the PR! Could you please add a test case? --------------------------------------------------------------------------- by stfalcon at 2012-07-25T13:53:24Z > Could you please add a test case? And what to check? I added one static option :) --------------------------------------------------------------------------- by bschussek at 2012-07-25T14:22:40Z Whatever was the reason for adding the option ;) The test should fail when the option is not added and succeed when the option is there. Probably it is sufficient to create a new field of type "file" in the test which comes prefilled with a `File` object. ``` $file = $this->getMock('Symfony\Component\HttpFoundation\File\File'); $this->factory->create('file', $file) ``` --------------------------------------------------------------------------- by stfalcon at 2012-11-15T12:32:01Z sorry, it's bug in VichUploaderBundle --------------------------------------------------------------------------- by stfalcon at 2012-11-21T17:00:59Z or not :) --------------------------------------------------------------------------- by stfalcon at 2012-11-22T19:47:34Z @bschussek done! it was really a bug with FileType --------------------------------------------------------------------------- by stfalcon at 2012-11-22T22:15:18Z @stof who can merge it? I want close this bug https://github.com/dustin10/VichUploaderBundle/issues/27 :) --------------------------------------------------------------------------- by stof at 2012-11-23T02:15:46Z @stfalcon the rule is that only @fabpot merges PRs on symfony. --------------------------------------------------------------------------- by stfalcon at 2012-11-23T10:12:05Z @fabpot do you have a minute :)? it's simple PR but many people wait for it
This commit is contained in:
commit
ac24f3e514
@ -46,6 +46,7 @@ class FileType extends AbstractType
|
||||
{
|
||||
$resolver->setDefaults(array(
|
||||
'compound' => false,
|
||||
'data_class' => 'Symfony\Component\HttpFoundation\File\File'
|
||||
));
|
||||
}
|
||||
|
||||
|
@ -15,6 +15,22 @@ use Symfony\Component\HttpFoundation\File\UploadedFile;
|
||||
|
||||
class FileTypeTest extends TypeTestCase
|
||||
{
|
||||
|
||||
public function testFormBuilderIfEntityHasFile()
|
||||
{
|
||||
$entity = new \StdClass;
|
||||
$entity->imageFile = $this->createUploadedFileMock('abcdef', 'original.jpg', true);
|
||||
|
||||
try {
|
||||
$form = $this->factory->createBuilder('form', $entity)
|
||||
->add('imageFile', 'file')
|
||||
->getForm();
|
||||
return;
|
||||
} catch (\Symfony\Component\Form\Exception\FormException $e) {
|
||||
$this->fail();
|
||||
}
|
||||
}
|
||||
|
||||
public function testDontPassValueToView()
|
||||
{
|
||||
$form = $this->factory->create('file');
|
||||
|
Reference in New Issue
Block a user